Specifications
125
Positioning Data Using the GPS Intermediate Driver API
The Windows Mobile GPS intermediate driver provides an API to analyze NMEA character
strings and obtain positioning data.
The GPS intermediate driver API can be used in the following procedure.
1. Create an event with CreateEvent() in order to detect GPS module status changes and output.
2. Connect to the GPS module with GPSOpenDevice(). GPS module status and positional
changes can be registered for each event with GPSOpenDevice(). “Positional change” events
actually indicate that NMEA output from the GPS module has been received. The GPS module
generally outputs several lines of NMEA character strings each second.
3. Use WaitForMultipleObjects() or WaitForSingleObject() to wait for events.
4. When notification of a “positional change” is received, use GPSGetPosition() to retrieve the
data. Positioning data can be retrieved from each member inside the GPS_POSITION structure.
Some of the structural members are listed in the table below.
Table 2.90
Member Format Contents
DwValidFields DWORD The validity or invalidity of retrieved data is shown in Bits for
each GPS_POSITION structural field.
stUTCTime SYSTEMTIME UTC time retrieved from the satellites is shown in
SYSTEMTIME format.
dblLatitude Double Latitude is expressed in degrees.
A positive value indicates northern latitude.
dblLongitude Double Longitude is expressed in degrees.
A positive value indicates an eastern longitude.
flSpeed Float Traveling speed is shown in knots (nautical miles/hour)
flHeading Float Traveling direction is expressed in degrees. 0° represents true
north.
FixType GPS_FIX_TYPE GPS measurement is shown in either 2D or 3D.
5. Repeat steps 3 and 4 as required by the application.
6. When positioning data is no longer required, the connection can be terminated with
GPSCloseDevice().
Figure 2.13 shows the flowchart of the procedure.
Note:
D
epending on the design of application, it may also be possible to retrieve regular positioning data
with GPSGetPosition() and status with GPSGetDeviceState() after opening the device with
GPSOpenDevice() without having to register events.