Accessing Raw GPS Data
The raw interface is one of two interfaces provided by the GPS Intermediate Driver for accessing GPS information. The raw interface, which makes GPS information available through a virtual COM port, mimics the design of many existing GPS scenarios. In both the existing scenarios and with the raw interface, applications call CreateFile to open a connection, call ReadFile some number of times to retrieve raw data, and call CloseHandle to close the connection.
For information about how to use the raw interface, see Overall Raw Data Code Structure, which explains how to use CreateFile, ReadFile, and CloseHandle with the GPS Intermediate Driver raw interface.
While it is not recommended in most scenarios, privileged applications can also call WriteFile and DeviceIoControl using the handle returned by CreateFile. In this case, the GPS Intermediate Driver forwards these calls to the hardware-specific device driver that interacts with the underlying GPS hardware. On platforms where trust is enabled, normal applications cannot successfully call WriteFile or DeviceIoControl. In this case, the last error, accessible through GetLastError, will be set to ERROR_ACCESS_DENIED.
In most cases, applications should avoid calling WriteFile or DeviceIoControl. Without the GPS Intermediate Driver, applications often interact directly with GPS hardware. In addition, in most cases only a single application uses the GPS hardware at a time. In this situation, it often doesn't matter if an application uses DeviceIoControl to put the GPS hardware into a non-standard mode (for example, one where the hardware returns GPS data in a proprietary format). Because the application makes the change, it knows how to interpret data in the new format. In contrast, with the GPS Intermediate Driver, changing this type of setting affects all clients, some of which may not know how to interpret data in the proprietary format, or to even know that a change has been made.
Note Calling DeviceIoControl with the same handle used to access data is different from calling DeviceIoControl with a handle to the GPS Intermediate Driver. In the former case - the case that uses the handle discussed in this topic - the IOCTL is handled by the device driver that controls the underlying hardware. In the latter case - when you call CreateFile with "GPD0:" - the IOCTL is handled by the GPS Intermediate Driver itself. For more information about controlling the GPS Intermediate Driver using DeviceIoControl, see Controlling GPS Intermediate Driver Execution.
Send Feedback on this topic to the authors