Sunday, July 6, 2008

Getting GPS location from bluetooth GPS device in Windows Mobile 5

Microsoft provides an interface for Windows Mobile devices to interact with built-in GPS receiver via GPS Intermediate Driver Interface. I faced with a problem when tried to connect GPS receiver connected via bluetooth. I could not start GPS device properly using GPSOpenDevice function, despite it returns an valid handler.

if (gps_handle == NULL) {
gps_handle = GPSOpenDevice(NULL, NULL, NULL, 0);

if (gps_handle == NULL)
return E_FAIL;

return S_OK;

A little bit history. Windows Mobile 5 introduced a GPS Intermediate Driver to allows multiple applications to share one GPS device. Before, if one app had the GPS COM port open, no other app could use it. But the Intermediate Driver creates a virtual COM port that multiplexes the real GPS port, and can handle multiple client apps simultaneously.

Windows Mobile 5 allows to configure the Intermediate Driver via Control Panel.

The control panel lets you set the Hardware Port, which is the real port the GPS device is actually on, and the Program Port, which is the virtual COM port the Intermediate Driver exposes. It is called the Program Port because it is the COM port that GPS programs talk to.

GPSOpenDevice will work properly if GPS device hardware port configured properly in control panel settings. On some Windows Mobile devices it is hidden from control panel. Fortunately it can be unhidden by going into the registry and changing "Hide" key value from "1" to "0" under HKEY_LOCAL_MACHINE\ControlPanel\GPS Settings.

GPS Intermediate Driver Functions

1 comment:

Anonymous said...

Your mode of explaining all in this piece of writing is genuinely fastidious, all be
able to effortlessly understand it, Thanks a lot.

my webpage :: Blogger: Become - Post a Comment