Solutionator
3rd July 2008, 09:14 AM
Hi all,
Windows mobile SDK 6 has a FAKEGPS program wich provides fake NMEA data to the GPS. This FAKEGPS reads NMEA data from a txt file. This is perfect for testing on a emulator. But now i want to provide FAKEGPS my own txt file with a recorded trail.
For this reason i want to write a little program for my diamond which records NMEA strings into a textfile. Is this possible using the intermediate driver, or should this be done communicating to the device directly? Can anyone provide some sample code?
Thank you in advance!
walshieau
3rd July 2008, 09:39 AM
Hi all,
Windows mobile SDK 6 has a FAKEGPS program wich provides fake NMEA data to the GPS. This FAKEGPS reads NMEA data from a txt file. This is perfect for testing on a emulator. But now i want to provide FAKEGPS my own txt file with a recorded trail.
For this reason i want to write a little program for my diamond which records NMEA strings into a textfile. Is this possible using the intermediate driver, or should this be done communicating to the device directly? Can anyone provide some sample code?
Thank you in advance!
[DllImport("gpsapi.dll")]
static extern IntPtr GPSOpenDevice(IntPtr hNewLocationData, IntPtr hDeviceStateChange, string szDeviceName, int dwFlags);
[DllImport("gpsapi.dll")]
static extern int GPSCloseDevice(IntPtr hGPSDevice);
[DllImport("gpsapi.dll")]
static extern int GPSGetPosition(IntPtr hGPSDevice, IntPtr pGPSPosition, int dwMaximumAge, int dwFlags);
[DllImport("gpsapi.dll")]
static extern int GPSGetDeviceState(IntPtr pGPSDevice);
Solutionator
4th July 2008, 12:58 AM
Thank you. I found this code also in the GPS example of the SDK.
But the GET_POSITION function on the driver does not return raw NMEA strings, it returns a struct wich is already formatted. What i would like is these raw strings:
$GPGGA,191938.767,4738.0173,N,12211.1873,W,1,06,1. 4,33.4,M,-17.2,M,0.0,0000*72
$GPGLL,4738.0173,N,12211.1873,W,191938.767,A*2A
$GPGSA,A,3,08,27,10,28,13,19,,,,,,,2.6,1.4,2.3*3E
$GPRMC,191938.767,A,4738.0173,N,12211.1873,W,0.103 296,21.60,291004,,*29
$GPGGA,191939.767,4738.0173,N,12211.1871,W,1,06,1. 4,33.4,M,-17.2,M,0.0,0000*71
$GPGLL,4738.0173,N,12211.1871,W,191939.767,A*29
$GPGSA,A,3,08,27,10,28,13,19,,,,,,,2.6,1.4,2.3*3E
$GPGSV,3,1,9,8,71,307,43,27,78,59,41,3,21,47,0,10, 26,283,32*72
$GPGSV,3,2,9,29,13,317,0,28,37,226,38,13,32,155,31 ,19,37,79,40*48
$GPGSV,3,3,9,134,0,0,0*46
$GPRMC,191939.767,A,4738.0173,N,12211.1871,W,0.097 420,25.48,291004,,*23
The MSDN site on this topic tells me there are two ways for retriving data from the intermediate driver:
1) Accessing Parsed GPS Data - I believe this is part of the example you provided. See http://msdn.microsoft.com/en-us/library/bb202033.aspx
2) Accessing Raw GPS Data - I hope this makes it possible to read all strings in NMEA. See http://msdn.microsoft.com/en-us/library/bb202097.aspx and http://msdn.microsoft.com/en-us/library/bb202019.aspx
The problem is that i don't understand what they are doing in the second example. "Open a connection to the GPS Intermediate Driver multiplexer, by calling CreateFile" Like.... how, where,what?
I found an example which listens to the GPS directly, but i prefer the intermediate driver if possible.
Solutionator
4th July 2008, 10:25 PM
Wauw. Great stuff. But RemoteTracker is still using intermediate driver option 1 (Accessing Parsed GPS Data).
Until I find out how I could manage to get option 2 to work (Accessing Raw GPS Data from the intermediate driver), I will extract some from the following code to get the full Raw NMEA string.
http://www.codeproject.com/KB/mobile/GpsTracerAppWMCE5.aspx
Sadly it is bypassing the intermediate driver, but hey, it works. For all other GPS actions i will use option 1 from the intermediate driver.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.