Vitty'S Blog

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  43 随笔 :: 221 文章 :: 215 评论 :: 0 Trackbacks

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:

$GPRMC,183729,A,3907.356,N,12102.482,W,000.0,360.0,080301,015.5,E*6F
$GPRMB,A,,,,,,,,,,,,V*71
$GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,,*75
$GPGSA,A,3,02,,,07,,09,24,26,,,,,1.6,1.6,1.0*3D
$GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,35*71
$GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43*77
$PGRME,22.0,M,52.9,M,51.0,M*14
$GPGLL,3907.360,N,12102.481,W,183730,A*33
$PGRMZ,2062,f,3*2D
$PGRMM,WGS 84*06
$GPBOD,,T,,M,,*47
$GPRTE,1,1,c,0*07
$GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E*67
$GPRMB,A,,,,,,,,,,,,V*71

  • 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:

 

posted on 2007-04-30 09:19 Vitty 阅读(386) 评论(0)  编辑 收藏 引用 所属分类: 4.他山之石
只有注册用户登录后才能发表评论。