Grabbing GPS coordinates with WAP3

  • Hello,

    I'm working on a .net application written in C# and I need to be able to grab the longitude and latitude from the gps module and store it.  It seems like an easy enough task, however after referencing the OpenNETCF.IO.Serial.GPS dll with some function calls, I am still getting zeros in the Position.Latitude_Decimal and Position.Longitude_Decimal fields.  Any help pointing me to the correct logic and function calls here would be awesome!

    Thank you,

    Dan

  • First thing to note, the latitude and longitude will be zero until you have a valid active fix.  Also, you will not get a valid fix indoors or really bad weather.  Lastly, it may take several minutes to get your first fix.

    When using the OpenNetCf library you will want to set the BauRate (9600 or 4800 depending on hardware) and the communication port (COM2: for less than 11, \$device\COM11 for higher values).

    After setting the values call the start method.

    I typically trap the GpsSentence event and dump the sentence to a listbox or debug.  If you are getting this event you know you have the baud rate and com port settings correct.

    I then typically trap the Position event as it is fired when the position is acquired (fixed) or the position changes.  The more satellites and longer the fix the more accurate your readings will be.  So the first time this is fired it may not be very accurate, it will then usually fire a few more times as it gets more accurate.

    Instead of trapping the Position method you could check the FixType property before checking the POS property.

  • I am getting the sentence data through a GpsSentenceEventArgs handler.  This event handler fires several times.  I also have a GpsCommStateEventArgs handler.  It fires when the state is opening and when it is stopping.  I will look into the FixType property and POS properties.  Will these indicate when the coordinates are legit?  Thank you for your prompt response!  I need to get this working within the next few hours.  :)

    Thanks,

    Dan

  • I hope you got it working.  Yes FixType does tell you if you have a legit Active Fix, but it doesn't tell you how accureate of a fix.  For that you will need to use the Hdop, Vdop, and Pdop properties.

  • Thanks!  Well, I did get it grabbing sentences and found a good resource online to decode these.  But my coordinates and values are still highly inaccurate, even based on the $GPGLL values.  The coordinates that the pre-installed PT GPS software returns are very accurate and the sentences seem to come in about once per second.  But with my software, it runs for a couple of seconds and then stops.  Is there a way to set a timeout variable or something?  Really stressing about getting this done.  Do you know if this needs to be multi-threaded to work properly?  Thanks again.

  • Added GPS, NoteDG tags for MDSDK documentation