Overall Raw Data Code Structure (Windows Embedded CE 6.0)

1/6/2010

Code that uses the GPS Intermediate Driver raw interface often has a common overall structure, with the following steps:

  1. Open a connection to the GPS Intermediate Driver multiplexer, by calling CreateFile.
    The first parameter to CreateFile contains the name of the object to open. When interacting with a GPS device, without the GPS Intermediate Driver, the first parameter is often something like "COM4:".
    With the GPS Intermediate Driver, this first parameter is the value of the DriverInterface registry entry. For more information about the DriverInterface registry key, see Configuring the GPS Intermediate Driver and GPS Intermediate Driver Multiplexer Registry Settings. For example, this value might be "GPD1:".
    It is important to note that the parameter is not "GPD0." You only use GPD0 to control the execution of the GPS Intermediate Driver, not to retrieve data from the GPS Intermediate Driver. For more information about controlling GPS Intermediate Driver execution using GPD0, see Controlling GPS Intermediate Driver Execution.
    As always, if you use a "COM" prefix and a number greater than nine, you must prepend the string "$device\" to the name passed to CreateFile. For example, to open the GPS Intermediate Driver using COM123, use the string "$device\COM123:".

  2. Read information from the GPS Intermediate Driver multiplexer, by calling ReadFile. This information will generally be in the form of strings that conform to the standards published by the NMEA. For more information, see this NMEA Web site.

  3. Parse the NMEA strings into location information. The GPS Intermediate Driver does not expose its NMEA parsing functionality to external callers, so you need to write this parsing code yourself. Alternatively, you can use the parsed API, which parses NMEA strings into the GPS_POSITION structure, as explained in more detail in Accessing Parsed GPS Data.

  4. Repeat steps 2 and 3 until you don't need additional GPS information.

  5. Close the connection to the GPS Intermediate Driver multiplexer, by calling CloseHandle.

    Note

    GPS hardware consumes relatively large amounts of power. Therefore, it is very important that you call GPSCloseDevice as soon as possible when you no longer need information from the GPS hardware. For more information about the implications of not closing the connection, see GPS Intermediate Driver Power Management.

See Also

Concepts

Accessing Raw GPS Data