2013-02-17 30 views

回答

2

看到這裏http://www.hjgode.de/wp/2010/06/11/enhanced-gps-sample-update/

我GPSsample的線索,獲取原始的NMEA數據是使用GPSID直接端口。它在regitrsy中編碼:

 private string GetGPSPort() 
    { 
     string szStr=""; 
     if (Registry.GetStringValue(Registry.HKLM, 
         "System\\CurrentControlSet\\GPS Intermediate Driver\\Multiplexer", 
         "DriverInterface", 
         ref szStr) 
      == 0) 
     { 
      return szStr; 
     } 
     else 
     { 
      if (Registry.GetStringValue(Registry.HKLM, 
       "System\\CurrentControlSet\\GPS Intermediate Driver\\Drivers", 
       "CurrentDriver", 
       ref szStr) == 0) 
      { 
       string szPath = "System\\CurrentControlSet\\GPS Intermediate Driver\\Drivers\\" + szStr; 
       if (Registry.GetStringValue(Registry.HKLM, szPath, "CommPort", ref szStr) == 0) 
       { 
        return szStr; 
       } 
      } 
     } 
     return ""; 
    } 

以上給出了可用於打開和讀取RAW NMEA數據的端口名稱。

上面假定設備支持MS GPSID。

此外,還有兩種可能性使用原始端口:a)使用串行通信或b)使用流。訪問和讀取方法都可用於通過網站提供的完整源代碼。

+0

尋求答案。我不能嘗試代碼,爲什麼我只找到我的集成GPS的COM端口。對於檢索數據我使用SerialPort組件...在DataReceived事件我解析NMEA字符串!謝謝.... – Antonio 2013-02-19 08:22:50

+0

爲書面,如果GPS驅動程序只支持流媒體,SerialPort組件可能不適合! – josef 2013-02-19 19:07:37