Jump to content
The simFlight Network Forums
Sign in to follow this  
Mouseviator

Sending GPS data on more COM ports on Client

Recommended Posts

Hello guys,

 

this time not reporting an issue, just a short looooooong info about how did I setup GPS output on two (or more) programs (devices) using FSUIPC, WideFS and virtual serial ports. Just in case someone would find this helpful.

 

What I had:

 

A simulator server PC

A client PC (an old notebook) with map application.

 

I did setup a server pc to send out GPS data via network to client PC using FSUIPC and WideClient.

 

Recently I got a new android phone...

 

Now, what I wanted to have:

 

Since I do not have blue-tooth on my server, I cannot use second GSPOut to send gps data to android phone. But I have blue-tooth on my old notebook, which is already receiving GPS data.

 

So what I wanted to do, is to read GPS data on client PC (notebook) by two programs - a map application that is already working and a map application on android phone connected via blue-tooth to client PC.

 

How did I do it:

 

It is also important to say that:

 

Both, the server and client runs on 64bit version of Windows 10.

I want the solution based on freeware apps if possible.

 

1) Server config:

 

Just as you could have seen many times, I need only to setup GPSOut in FSUIPC.ini:

[GPSout]
Port=WideFS
Speed=19200
Interval=500
PosTo6Decimal=No
Sentences=RMC,GGA, PGRMZ
GPSoutEnabled=Yes
SimModeIndicator=No

 

2) Client config:

 

To receive GPS data with WideClient, we need something like this in WideClient.ini:

 

[GPSout]

Port=com4

Speed=19200

 

Now the tricky part comes in :) I need a virtual COM ports (since I do not have real ones). The problems are:

 

a) It is not that easy to find freeware virtual COM ports for 64bit system.

- But I found this: com0com

 

b) Only one application can "access" a COM port at a time, thus a pair of COM ports is needed – so that one application can write to a COM port (WideClient writing GPS data) and the other can read a COM port (a map application). And also, it is required that the GPS data entering one COM port comes out exactly the same on the other COM port (side).

 

- That is exactly what above com0com program does. It creates virtual COM port pairs like if we had two COM ports interconnected directly via a cable.

 

c) I said I wanted to read the data with two applications, but com0com can only do pairs of COM ports - Ok, something like COM hub would come handy to share the data that are being written to one COM port by WideClient to be accessible on more than one COM ports.

 

- Luckily, "HUB for communications", a part of com0com project does exactly this.

 

So, first I downloaded com0com and installed it:

https://sourceforge.net/projects/com0com

 

Actual version right now is 3.0.0

 

After installing, I created these virtual COM pairs:

 

COM4-COM5

COM10-COM11

 

as on following picture:

com0com.jpg

Oh, make sure you run this Setup app As Administrator. All you need to do is click “Add Pair” button. A pair of COM ports should appear in the list. Make sure you have “use Ports class” and “emulate baud rate” selected for both COM ports and click Apply.

 

The Setup might throw an exception at you after clicking Add Pair or Apply button, not sure when it did for me. But you can ignore this, close the program, open it again and your changes should be there.

 

Confirm in Device manager that the COM ports are installed:

dev_mgr.jpg

If they show that yellow warning triangle, just right click on them and choose “Update Driver Software…”, than “Browse my computer for driver software” and navigate to the folder where com0com is installed (In my case, it is C:\com0com). In this folder there is only one INF file (a file with .inf extension) so select it and the driver should get updated and the warning triangle should go away.

 

If you are going to use Android or other device connected by blue-tooth, you need to add one COM port for this too.

 

It is described here:

http://forum.simflight.com/topic/75481-sending-gps-data-to-android-apps-bluetooth/

 

but to make this tutor complete, here is how I did it on Windows 10:

Go to: Settings → Devices → Bluetooth

Turn on bluetooth

Click “More Bluetooth options”

Click the “COM Ports” tab

Click “Add...” button

Check “Incoming (device initiates the connection)”

Click Ok

A COM port should be added in the list, like COM9 in my case:

bluetooth.jpg

No we have our COM ports, 5 of them to be precise.

 

The last thing to get show going is to start the COM hub. Download hub4com from here:

https://sourceforge.net/projects/com0com/files/hub4com/

 

and extract is somewhere, like C:\hub4com

 

the you need to start the COM hub using a command like this:

 

hub4com \\.\COM5 \\.\COM9 \\.\COM10

 

which a placed in batch file and running it along WideClient. It would be good if you take a look at the readme file for hub4com, to get a little familiar with the software.

 

Ok, if everything done Ok, you should be able to read GPS data by two applications now (on port COM5 and COM10 in my case)

 

Ok, what the hell? Why all those COM ports?

 

Remember I wrote: only one application can access a COM port? If for example WideClient opens a COM port to write GPS data to it, no other application can use the COM port. To explain my setup:

 

COM4 – WideClient writes GPS data here.

COM4-COM5 is COM pair, thus like one COM port. Hub4com creates hub from COM5, COM9 and COM10, so the data that are on one of these ports are on all three ports. Hope I understand it right that, WideClient writes to COM5 (via COM4).

COM9 is for blue-tooth, so once my Android device connects, it will find GPS data there.

COM10 – is COM pair (COM10-COM11), so what is on COM10 is mirrored to COM11.

COM11 – on this port my Windows map application can read GPS data.

 

You cannot point your applications directly to COM5 or COM10, as these are open by hub4com. The COM9 used by blue-tooth is some sort of exception, which I cannot explain, but it works for me.

 

On Android device, as described here:

http://forum.simflight.com/topic/75481-sending-gps-data-to-android-apps-bluetooth/

 

you need to use something like “BluetoothGPS”

https://play.google.com/store/apps/details?id=googoo.android.btgps

- Pair your Android toy with PC

- Allow “Mock positions”

- Open BluetoothGPS app and connect to PC (there is a list of paired devices on the top of the screen)

- If successfully connected, you should see GPS data on the screen...(FSX or Prepar3D must be running)

- Leave BluetoothGPS and open whatever navigation or other GPS related app you want to use (most of them should be tricked it is real GPS connected via blue-tooth and should use the data).

 

Hope you fellow flight simmers will find this helpful. Not saying this is the best solution, but is free and the best I found so far.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.