Tutorial :Access GPS functionality in WinMobile phones



Question:

Say you have a Windows Mobile 6.0 phone that also has a GPS receiver. Does the WinMobile SDK support accessing GPS functionality?

If not, what are the options (API) for programming with the GPS i.e write apps that will use the GPS capability. I am mainly interested in Windows Mobile 6.x but please do include generic replies also.

I will surely vote for the most helpful answers.

Thanks in advance.


Solution:1

Two options:

  1. There is the intermediate GPS driver, which has a howto article for .Net on MSDN
  2. You could connect to the serial port (configurable in UI, of course) and parse the NMEA strings yourself

Option (1) is probably advisable


Solution:2

Chris Craft had a lot of source code for this sort of thing in his Series 30 Days of .NET Windows Mobile Applications

  • Week 1 - Including GPS Compass
  • Week 3 - Including GPS Speedometer and GPS Altimeter
  • Week 4 - Including GPS Clock

Sadly this blog series appears to have died, but thankfully the code is preserved on Codeplex:

30 Days of Windows Mobile Applications

And a port to C and some discussion around some of the original posts can be found on /dev/mobile

There's also some notes on using the Intermediate GPS driver on Raffaele Limosani's blog


Edit to add:

GPS.NET has recently become open source, and is now available on CodePlex:

GPS.NET 3.0


Solution:3

If you are planning to develop in the .NET Compact Framework, there is a quite extensive GPS example in the Windows Mobile Developer Samples. That basically makes use of wraps around gpsapi.dll but it shows the works. I have installed the WM6 kit in C:\Program Files\Windows Mobile 6 SDK and the GPS sample is then in C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS

Good luck!


Solution:4

Try to have a look at some of the solutions on CodeProject.com. There are a lot of very good articles about Windows Mobile and GPS.


Solution:5

And for testing code that uses the intermediate driver (see other answers), don't forget the FakeGPS utility from the SDK that you can use to pipe a NMEA stream stored in a file through this intermediate driver so you can easily test GPS software on that location data without actually having to have GPS reception and start moving around.


Solution:6

From my point of view it is much easier to read serial port (in my case COM5, baudrate 4800) and parse received data. (how to parse the string can be found via Google and phrase: gps NMEA sentences)

For me is impossible to understand the example on address:

C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS  

It is all so complicated and unstraightforward. I would expect much easier and usefull interface like:

myGps = new GPS()  myGPS.getPosition  

But this is probably not possible :(

And how to do it via RS232? (I work in VB.NET)

In GUI (or programatically) create object System.IO.Ports.SerialPort and use its event DataReceived. Whenever data come from GPS, this event occures and in it's body you can process it.

Data is in format of a loooong string devided into sections $GPGGA, $GPGSA etc. Important is $GPGGA. Each particular information is delimited by comma. Than you only parse this string - in VB.net using: myArray = myData.Split(","c).

http://aprs.gids.nl/nmea/

PS: ","c means that the comma is ment as a Char, not String (VB.NET)

As you can see there is no need to write more than a few lines of code. Example by MS is needlessly difficult and is not for beginners.

PS2: Note that you do not send any commands to GPS. It automatically and periodically sends data to your program. You just open port, read all data from buffer, convert it to string using Chr() and parse it. No big deal.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »