Introducing the GPS Intermediate Driver for Windows Mobile


It's always cool to get to add new features, especially when they're a little outside your comfort zone.  For Windows Mobile 5 (i.e. PocketPC 2005) I added the GPS Intermediate Driver (GPSID) and corresponding GPSAPI.  I usually do networking servers (web, telnet, services.exe, ...) or clients (LDAP, COM, name resolution, MSXML, ...).  I'm still not quite sure how a networking dev like me ended up working on GPS, but I'm not complaining because it was a fun project :).


GPSID makes it a lot easier to write applications that use GPS devices.  In the past you'd have to figure out the underlying COM port the GPS device was on, call CreateFile() on it, and then parse out the NMEA strings as it sent them to you.  GPSID makes all this a lot easier by giving an easy to use API that gives you lat/long directly.  GPSID also can expose itself as a virtual COM port, streaming NMEA directly to legacy applications, so we don't break backward compat.


I'm not going to say any more about technical issues since GPSID is documented here.


As a random side-note, it's interesting that everyone else I talk to calls this feature GPSAPI yet I call it GPSID.  The reason is that app developers deal with the API layer - they #include <gpsapi.h> and link to gpsapi.lib.  It turns out that GPSAPI.lib is a very tiny layer (about 100 lines) whereas the GPSID.dll is a device driver and is about 6000 lines.  Guess which one took longer to write 🙂  Since I spent so much more time on GPSID I can't help but think of it in those terms.  I promise to do my best to accomodate the rest of the world but please be sympathetic 🙂

Comments (26)
  1. John says:

    Are there any plans to make this available from managed code?

  2. cenet says:

    Yes, there are plans to make this managed accessible. In fact someplace in the SDK samples (I don’t know if they’ve shipped yet) there’s is (or will be) a managed wrapper that Microsoft has written. I didn’t do the managed work so I’m not sure where exactly it lives in the sample source tree, but it should be easy to find.

  3. Tommy says:

    Will GPSID be implemented for Windows XP or is there already something similiar? I think this API is very useful for laptop and tabletpc computers too.

    /Tommy

  4. Jay says:

    Is there a way for us to back port GPSID to wince4.2? In other words, can you share the source code for GPSID for OEM like us?

    If so what do we need to do to make it happen?

    Thanks

  5. cenet says:

    Jay & Tommy – apologies for seeming to ignore your questions. For some silly reason I never get notified on new comments and there’s not a good way to automate it. I’m afraid I don’t have good news for either of you :(.

    Tommy – there are no plans to implement GPSID for WinXP/Longhorn/etc… I agree it makes sense but apparently there’s not enough people pushing for this.

    Jay – The source code to GPSID is shared in the Magneto OEM kit (not sure about the exact name), but due to legal/marketing/etc gunk it’s not something you’ll be able to backport.

    John Spaith

  6. Hank Lynch says:

    Is there a way to fake out a gps device for WM5 development? I’m doing an app for the HW6515 and I don’t have one yet. Hooking a file to a com port maybe?

  7. Christopher Piggott says:

    Hank, your question was posted a few months ago already so maybe you already know the answer, but you certainly can fake it out … there are two ways.  First, you can create a virtual COM driver that feeds the GPS intermediate driver, as you suggested.  This is a little bit of work, though, and there’s a much easier way.  The GPS Intermediate Driver can be fed from text files.  To see how to do this, look in MSDN under GPS Intermediate Driver.  In a nutshell, you have to create a handful of registry keys and that’s it.

  8. Christoph says:

    I would like to use GPSID with my QTEK 8130 Smartphone but there is no Control Panel to set up comunication between smartphone and Bluetooth GPS Slim (device).

    I added some registry settings by information founded here:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/wce51congpsintermediatedriverinputsourceregistrysettings.asp

    but it still not work.

    Could someone give me more information?

    Thanks

    Christoph@langewisch.de

  9. Ken Adam says:

    I have used the API successfully with a MIO A201 (GPS/PDA), but when I use the same software with the MIO A701 (GPS/PDA/Phone) I get lat/long values that have the degrees AND minutes in the whole number part (e.g. 210 – 55.93, -3.16, 701 – 5555.17,318.0.

    Only difference I can spot is that on the 701 the GPRMC message has the NMEA v3 "A" field at the end.

    Is there some config option to resolve this?

    Ken

  10. Mike says:

    you need to read up on the issues with the intermediate driver.

    The A701 needs the Angular conversion done. Some others (such as my XDA Mini) do not.

    Apparently some GPSID.DLL’s have a bug in (or the C# interface does).

    I use a config "switch" to turn off and on the conversion.

  11. Gordon says:

    You guys seem to know a lot about this subject, so I’ll post a question here if that’s ok?

    I’ve got a Treo700w and noticed an option in the ‘Location Privacy’ screen that says:

    ‘Location On – Your location can be broadcast.’

    I was wondering if you’re able to get crude coordinates from the phone this way without using an actual GPS device.

    TIA 🙂

  12. Michael Snyder says:

    It would be very useful if this was available on XP/Longhorn in addition to the Windows Mobile platform.

    It doesn’t make sense for everyone under the sun to be constantly redeveloping the same code, even if it is a simple parsing task.

    Who do we need to encourage to speed up the migration of this into the desktop side of things?

  13. cenet says:

    Michael – I’ve spoken with various people on XP/Longhorn about GPSID & Location Framework.  I gave them the list of benefits you called out in trying to get them to do this work.  So they’re aware of it, but I can’t really discuss their future product plans.  Ultimately it’s their call whatever they do, they do know about the problems there are today.

    John

  14. Alex Egg says:

    Do you know a list of PDAs with GPS hardware that is accessible via the GPSID framework? For example, can I access the GPS stuff on a fujitsu Pocket LOOX PDA?

    Thanks,

    Alex

  15. cenet says:

    I don’t have such a list unfortunately.  The only one I know of is the HP nav device(http://laptopmag.com/Review/HP-iPAQ-rx5900-Travel-Companion.htm), and this I picked up 2nd hand and haven’t verified myself.

    I do know that there are carriers & OEMs looking to integrate closely with GPSID, but I can’t talk about future stuff quite yet.  We’re getting there.  Sorry I can’t help out more than this.

    John

  16. Kamal Aanand R says:

    Hi!

    I was facinated to find that there is something like the GPS intermediate driver and quickly pounced on the API. It immediately threw some location info and was quite happy.

    But on close examination on the location info, I see some problem.

    I have a Compaq HP Ipaq 6965 phone and am based at Bangalore, India. If I try to locate my position using the GPS Interemediate driver (_gpsDevicePosition.LatitudeInDegreesMinutesSeconds), I get the result as 0d 12′ 57.19555390000001". There is something seriously wrong as I get a 0 degree as the result. I also noticed that the degree has been offset to the minutes and the miutes has been offset to the seconds.

    To counter check, I directly read the content from COM7. The location that I parsed from my $GPRMC (NMEA Sentence) was 12°57.186299"N. This gives me the correct degree as 12 and not 0. I am in a fix!

    Has anybody come across such a situation or do you have any answers for me to try out?? Thanks.

    Kamal Aanand R

  17. Kamal Aanand R says:

    Fixed. It was to do with some erroneous location conversion to Degree,Minute,Seconds format. Thumbs up to GPS Intermediate Driver!

  18. Danzel says:

    Kamal —

    Can you tell me what your fix was? I’m having the same problem, just running the sample project provided.

    I tried just adding val *= 100; at the start of the ParseDegreesMinutesSeconds function but it still seems a little off.

    I’ve read other places that it has to do with a difference between the GPSAPI.dll driver for the emulator and for the hardware, but I’m just running it on hardware and getting these results.  I’m not sure where it specifies the source for the .dll file, I don’t see one on my Axim hardware though…

    If anyone can help out, hit me at weber dot daniel at gmail dot com please, thanks!

  19. Danzel says:

    I managed to come up with my own fix, and got the exact coordinates (within a few meters) of what I should be getting.

    In case anyone else is experiencing something similar here is my new ParseDegreesMinutesSeconds method.

    private DegreesMinutesSeconds ParseDegreesMinutesSeconds(double val)

           {

               /* This "val" string is incorrect at this point — for SOME reason.

                * Can’t reach the point at which it is parsed from the NMEA string,

                * so attempted to modify it back to how it should be at this method.

                * Orignal code:

                * double degrees = (val / 100.0);

                * double minutes = (Math.Abs(degrees) – Math.Abs((double)(int)(degrees))) * 100;

                * double seconds = (Math.Abs(val) – Math.Abs((double)(int)val)) * 60;

                * — Daniel Weber */

               double degrees = val;

               double minutes = (Math.Abs(degrees) – Math.Abs((double)(int)(degrees))) * 60;

               double seconds = (Math.Abs(minutes) – Math.Abs((double)(int)minutes)) * 60;

               return new DegreesMinutesSeconds((int)degrees, (int)minutes, seconds);

           }

       }

  20. Pradeep says:

    I am using Symbol MC 70 device for GPS application. GPS device used is bluetooth  GPS device BT-74R. I am using GPSID for application development I did all GPS settings and paired the bluetooth device with hand held device.Still I am not getting GPS data form GPS device. Can anybody help me out to solve this issue?

    Thanks in advance :)!!!

  21. f2k says:

    ok guys i am new to windows mobile development and looking for some help. if any one got any example of gpsid and do i need to download gps api from somewhere .

  22. HGO says:

    I wonder about all these exciting GPSID evaluations. I have following problem with it:

    The GPS device is connected via a virtual com port which is created by an USB adapter. The device is placed in a vehicle dock. The vehicle dock is connected to the Serial GPS device with an USB2Serial  adapter. The communication between the GPS device and the WM5 handheld is done over USB.

    Everything works fine as long as the device is docked and the navigation sw is started after the device has been docked. If the device will then be taken off the dock and again placed in the dock, the NAV sw still works. The GPSID driver knows the ports and keeps them alive.

    If the device is outside the dock and the NAV sw is started, the sw does not work. The virtual ports dont exist or the GPSID does not offer the communication to the NAV sw.

    Conclusion:

    The GPSID does only work for always connected GPS devices?

  23. crash says:

    After reviewing loads of comments and such on the internet as well as MSDN, I’m wondering if I’m sentenced to purchasing a GPS module for my Smartphone.

    I have a Moto Q with WM5.  The symptoms are that the GPS device seems to be stuck in a "starting up" mode. Therefore, any attempts to fetch coordinates results in zeros.  Anyone know of registry settings, etc that I can employ to use the internal GPS hardware?

    TIA

  24. cenet says:

    I don’t know — I don’t think the MotoQ had the GPS enabled in it but I’m not positive.  You may have better luck on a newsgroup (http://blogs.msdn.com/cenet/archive/2005/12/05/500181.aspx).  Apologies for delayed response here.

  25. crash says:

    cenet,

    thanks for the response.  i’ve moved on from the original post.  i’ve resigned to the fact that the Moto Q, whether it has/has not a GPS chip (i thought it was equiped with the Instant GPS chip MG42xx), I’m now more interested in accessing other devices on the phone (e.g. microphone, speaker, etc).  Can you recommend a suitable/appropriate forum for this?

    thanks.

  26. cenet says:

    For detailed tech questions, I’d recommend a newsgroup at http://blogs.msdn.com/cenet/archive/2005/12/05/500181.aspx.

Comments are closed.

Skip to main content