New GPSDriver library

Erel

B4X founder
Staff member
Licensed User
Longtime User
The GPSDriver uses Microsoft GPS Intermediate Driver to receive GPS data.
This library can work with both internal and external GPS devices.
Using this library is simpler than with the GPS library as there is no need to manually connect to a serial port.
This library should be added to both the desktop and the device, however the functionality is not available on the desktop.
Requirements are Windows Mobile 5.0 or newer devices installed with .Net Compact Framework 2.0.

I want to thank Agraham for writing the first version of this library. :sign0188:

Setup instructions:
- Unzip the attached file.
- Copy GPSDriver.cs, GPSDriver.dll and GPSDriver.chm to Basic4ppc libraries folder:
C:\Program Files\Anywhere Software\Basic4ppc Desktop\Libraries

Edit: V1.11 is attached. This version fixes a bug in the GPSConverter object related to conversions of negative longitude coordinates.

An example is also included in the zip file.
The online manual is available here: GPSDriver

See this post about external GPS devices: http://www.b4x.com/forum/official-updates/3268-new-gpsdriver-library-3.html#post18443
 

Attachments

  • GPSDriver.zip
    31.4 KB · Views: 605

agraham

Expert
Licensed User
Longtime User
Found it! - A security issue I've not come across before :sign0161: I keep the settings on my machines quite tight.

Right-click the CHM file, and then click Properties.
Click Unblock.
Double-click the .chm file to open the file.

If anyone with Vista has this problem note that you can't unblock it while it is in the "Libraries" folder owing to Vista security. You will need to copy it to a folder outside "Program Files", unblock it, delete the one in "Libraries" and copy the unblocked one back. At least that's what I had to do!
 
Last edited:

agraham

Expert
Licensed User
Longtime User
A bug :( EllipsoidAltitude is checking the wrong flag for validity
B4X:
public float EllipsoidAltitude
{ get { return SeaLevelAltitudeValid ? gpsdata.flAltitudeWRTEllipsoid : InvalidData; } }
And a comment.

There is inconsistent naming of "SatellitesInViewCount which is plural and SatelliteInUseCount which is singular.
 

Mr_Gee

Active Member
Licensed User
Longtime User
Hi Erel, this is great news!!
thanks for this new lib (and you too Agraham )

Just tried your demo application, when I run it and click connect i get an error
B4X:
An error occurred on sub main.displaygps

Line number : 53

If Satellites.shouldCalculate Then Satellites.UpdateSatellites

Error description
Format exception
Continue?

If I click yes then the error pops up again, but If I click yes and click on satellites (menu item) quickly the table shows and gets updated
when I close the satellites form works like it should...

:confused:
 

derez

Expert
Licensed User
Longtime User
altitude

Erel and Agraham
thanbks for this library, I'm already running my navigation program and it works nicely. The satellites code becomes very easy with the new structured array which includes the "Used".:)

Still I'm not sure that EllipsoidAltitude is doing what it should - I get the same altitude all the time (usually there are variations of few meters as the gps stabilizes).

Please explain the difference between the two types of altitudes. all altitude calculations are with reference to a specific Geoid which is defined by each country or for an area, or by using the general WGS84.(see attached list)
What does "sealevel" use ?
 

Attachments

  • all_datum.txt
    10.4 KB · Views: 36

agraham

Expert
Licensed User
Longtime User
Still I'm not sure that EllipsoidAltitude is doing what it should - I get the same altitude all the time (usually there are variations of few meters as the gps stabilizes).
As long as you have version 1.01 then Ellipsoid altitude does what I expect on my Diamond. It appears to return (correctly) the present altitude above the WGS84 ellipsoid which when corrected using the transformation equations and parameters specified by our national mapping agency (the Ordnance Survey) give a good match to my latitude, longitude and altitude on our national standard geoid (OSGB36/ODN) on which our UK maps are drawn.

I don't have the detailed knowledge to answer the rest of your query as I have only researched the WGS84 to UK standard transformation using the equation and data supplied by our Ordnance Survey.
 

derez

Expert
Licensed User
Longtime User
altitude

Agraham
I used this code to display both altitudes on the same form:

If gpsd.SeaLevelAltitude <> gpsd.InvalidData Then
t_alt = gpsd.SeaLevelAltitude
tb1.Text = t_alt
If gpsd.EllipsoidAltitude<> gpsd.InvalidData Then tb2.Text = gpsd.EllipsoidAltitude Else tb2.Text = "x"
End If

what I see is that while the sealevel Alt is changing , as a result of non-optimized satellites reception, the ellipsoid is static. It is not functioning correctly, at least in my device and program.
Can you please check or tell me what I'm doing wrong ?

thanks
 

Attachments

  • Screen01.jpg
    Screen01.jpg
    49.5 KB · Views: 32

agraham

Expert
Licensed User
Longtime User
Your code looks OK. It looks like your device insn't returning a valid EllipsoidHeight. You didn't confirm that you are using version 1.01 of the library. On my device SealevelAltitude is always invalid.

I really can't help any more as the driver is returning whatever you are getting. However this archive includes my test program which has an extra library "GSPDriverNMEA.dll" that can retrieve the actual NMEA sentences from the Intermediate driver. Using this you can check at a lower level what the data actually is.

Run the app on your device (with all the libraries), select NMEA from the menu and then press Open. The textbox will fill with data. Clear will clear the textbox at any time and log will write the present textbox text to a file "NMEA.log" in the application directory. You could then check what the device is producing. The "usual" messages are documented in the NMEAsentences.txt file in the archive.
 

Attachments

  • GPSDriverDemo.zip
    68.2 KB · Views: 43

derez

Expert
Licensed User
Longtime User
Agraham
Before checking the program let me tell you what I saw on the way home from work.
I drove 40 Km north, and the Elipsoid altitude crept slowly from 16.6 to 17.1 while the real altitude travelled +- 50 meters. I thought that this may be showing that the parameter is a difference between the WGS84 and the sealevel altitude.
When I got home I saw your post and I find this inside:

$GPGGA,162651.6,5316.057660,N,00241.434673,W,1,03,666.6,149.2,M,0,M,,*69
Global Positioning System Fix Data
eg3. $GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh
1 = UTC of Position
2 = Latitude
3 = N or S
4 = Longitude
5 = E or W
6 = GPS quality indicator (0=invalid; 1=GPS fix; 2=Diff. GPS fix)
7 = Number of satellites in use [not those in view]
8 = Horizontal dilution of position
9 = Antenna altitude above/below mean sea level (geoid)
10 = Meters (Antenna height unit)
11 = Geoidal separation (Diff. between WGS-84 earth ellipsoid and
mean sea level. -=geoid is below WGS-84 ellipsoid)

12 = Meters (Units of geoidal separation)
13 = Age in seconds since last update from diff. reference station
14 = Diff. reference station ID#
15 = Checksum

I believe that there must be some mix of the use of this part in the stream.
Now I'm going to check the program...:)


by the way - the sealevel altitude is very accurate, I compared to trig point on the map near the road !!!
 

agraham

Expert
Licensed User
Longtime User
9 = Antenna altitude above/below mean sea level (geoid)
10 = Meters (Antenna height unit)
11 = Geoidal separation (Diff. between WGS-84 earth ellipsoid and
mean sea level. -=geoid is below WGS-84 ellipsoid)
I wouldn't read too much into those descriptions. They are off just one site I found and I wouldn't trust it as a definitive description. On my device item 9 seems to really be the altitude above WGS84 and is the value being returned for EllipsoidAltitude. Item 11 is always 0. and SeaLevelAltitude is returned as Invalid.
 

derez

Expert
Licensed User
Longtime User
I cannot see any nmea stream in the test program. It counts the readings but no data. on the parameters display I see all.

I tried to compile your program but it provides an error.

As you see the accuracy I get with the sealevel is excelent so I will continue to use it, but I really would like to know how the GPS knows this sealevel altitude, and if it is accurate all over the world or just here because this is where Erel lives...

I also wish you could supply the stream, so that it is used for debuging. I find very strange phenomena in devices that operate my program and this whould help.

Thanks.

edit: I checked here NMEA data and it is the same definition.
here: GPS - NMEA sentence information the same definition.
And here you'll see that other people get also confused by this issue : SpringerLink - Journal Article
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I cannot see any nmea stream in the test program. It counts the readings but no data.
Did you put the correct COM port in the textbox below the Open button? The GPSDriver library does not need a COM port but the GPSDriverNMEA library does. It is the COM port listed under Settings->System-> External GPS (on my device anyway).


I tried to compile your program but it provides an error.
The library relies upon stuff that came in with Windows Mobile 5.0. I suspect that your computer needs the WM 5.0 SDK installed to have this stuff available. Perhaps Erel can comment if he sees this post?
 

derez

Expert
Licensed User
Longtime User
I have internal GPS reciever, but entering its com port didn't help either.
Never mind, I think I understand now what is going on and it's Okay.

thanks.
 

schimanski

Well-Known Member
Licensed User
Longtime User
GPSDriver and external GPS

Hello!

I have tested the new GPSDriver.dll with my Eten Glofiish X600 and a HTC Touch Diamond, and it' runs very fine!!!!:sign0188:

Now,i have treid to use it on a Qtek S200 with WM5 and a external GPS-Bluetooth mouse. But this doesn't run. Where is the mistake?


thanks

schimanski
 

agraham

Expert
Licensed User
Longtime User
external GPS-Bluetooth mouse
This is the mistake. The new library only works on internal GPS because only they have the Intermediate Driver that this library uses. This library was needed because of an incompatibility between the .NET SerialPort used by the Serial2 library and some internal GPS drivers. For an external GPS you should be able to use the exsting Serial2 and GPS libraries. I am considering writing a new GPS library for external GPS that uses the same methods and properties as the new GSPDriver library - but it will be a short while before it is available if I decide to do it and a long while if I decide not!.
 

Mr_Gee

Active Member
Licensed User
Longtime User
Hi Agraham,

Wouldn't it be a better idea to include both internal & external in the new GPS driver lib?
 
Top