Have you ever wanted to run a GPS-aware application inside the DeviceEmulator, without using a hardware GPS receiver? This would make both demos and test automation of GPS-aware applications much easier!
It turns out that the support is built right into Windows Mobile 5.0, both for the DeviceEmulator and for hardware PocketPCs. The GPS Intermediate Driver can use a file as its data feed instead of a serial port.
Here is how:
- Launch the Windows Mobile 5.0 PocketPC emulator
- Use the Remote Registry Editor (in your PC's "Start\All Programs\Microsoft Studio 2005\Visual Studio Remote Tools") and connect to the Windows Mobile 5.0 PocketPC emulator
- Navigate down into "HKEY_LOCAL_MACHINE\System\CurrentControlSet\GPS Intermediate Driver\Drivers"
- Create a new value under "Drivers", with type REG_SZ, named "CurrentDriver", with value "FileDriver"
- Add a new key under "Drivers", called "FileDriver". Inside that key, add three values:
- "InterfaceType" REG_SZ "File"
- "FriendlyName" REG_SZ "File Driver"
- "File1" REG_SZ "\gpsdata.txt"
- Close the Remote Registry Editor. The Windows Mobile 5.0 GPS Intermediate Driver is now configured to retrieve GPS NMEA data strings from a file named "\gpsdata.txt" instead of from a hardware GPS receiver.
- Create \gpsdata.txt and populate it with NMEA data strings. I used notepad on my PC to create a file containing the following data:
- Use the Remote File Viewer to copy that file into the emulator as "\gpsdata.txt"
Now, if you use a GPS-aware application, such as the sample in " C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket\PC SDK\Samples\Cs\Gps\Gps.sln", the application will report updated location information about once per second.
Here are links to relevant documentation:
- GPS Intermediate Driver GPS Hardware Registry Settings (note that the registry keys may be protected on some devices)
- GPS Intermediate Driver File Registry Settings
- NMEA data (my sample GPS data was cut and pasted from this site)
- Windows Mobile 5.0 PocketPC GPS Sample