2015-02-05 64 views

回答

2

您需要從您的nmea字符串中讀取GGA字段。它爲您提供正在追蹤的衛星數量

GGA - 必不可少的修復數據,提供3D位置和精確度數據,

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 

其中:

 GGA   Global Positioning System Fix Data 
    123519  Fix taken at 12:35:19 UTC 
    4807.038,N Latitude 48 deg 07.038' N 
    01131.000,E Longitude 11 deg 31.000' E 
    1   Fix quality: 0 = invalid 
           1 = GPS fix (SPS) 
           2 = DGPS fix 
           3 = PPS fix 
        4 = Real Time Kinematic 
        5 = Float RTK 
           6 = estimated (dead reckoning) (2.3 feature) 
        7 = Manual input mode 
        8 = Simulation mode 
    08   Number of satellites being tracked <-- this is what you want 
    0.9   Horizontal dilution of position 
    545.4,M  Altitude, Meters, above mean sea level 
    46.9,M  Height of geoid (mean sea level) above WGS84 
         ellipsoid 
    (empty field) time in seconds since last DGPS update 
    (empty field) DGPS station ID number 
    *47   the checksum data, always begins with * 

那麼你可以使用String::split()方法來讀取被跟蹤的衛星數量。

+0

我認爲Android的GPS並不使用所有GGA的衛星數量......我認爲這個數字是手機看到它們的所有衛星的數量(也許並不是全部使用它們)。我怎麼能給出電話使用它們來獲得我的座標的衛星數量? – jion 2015-02-10 11:12:58

+0

@jion,你可能需要閱讀這個,http://aprs.gids.nl/nmea,這就是它說的「7 =正在使用的衛星的數量[不是那些在視圖中]」 – 2015-02-10 15:38:50

+0

我在其他文檔中讀到GPGGA的第七位是GPS看到的所有衛星...它返回10或11 ...我不認爲這是使用中的衛星數量! :| – jion 2015-02-10 20:59:04

相關問題