嗯~~可以使用TStringList來將GPS的資料分開讀出,不用特意去找元件使用
再看一下NMEA的文件就可以快速的解讀了,下面是GPGGA和GPRMC的格式說明,因為之前我只需要定位資料所以只使用這兩種格式
先引用一下dllee 版主 的範例
使用 TStringList 的 CommaText 就可以輕鬆分開 , 的資料,例如: TStringList *txt=new TStringList;
txt->CommaText="改成所接收到的GPS訊號"
for(int i=0;iCount;i )
{
ShowMessage(txt->Strings[i]); // 第 i 個 , 分段的字串
} /*
***************************************************************************
* *
* OutputRMC *
* *
* Input: *
* *
* Output: *
* *
* Description: *
* RMC-Recommended minimum specific GPS/Transit data *
* and fix related data for a GPS receiver. *
* The format is as following: *
* *
* $GPRMC,HHMMSS.sss,a,DDMM.mmm,d,DDMM.mmm,d,z.z,y.y,ddmmyy,d.d,v *
* *hh *
* *
* $ Beginning of NMEA sentence *
* GPRMC Message Header *
* *
* HHMMSS.sss UTC of position fix *
* HH : hours (00.24) *
* MM : minutes (00..59) *
* SS.sss: seconds (00.000 .. 59.999) *
* *
* a a : status (A=valid, V=invalid) *
* invalid if over current DOP mask *
* *
* DDMM.mmm,d Latitude - N( )/S(-) *
* DD : degrees (00..90) *
* MM.mmm: minutes (00.000 .. 59.999) *
* d : direction, N - north, S-south *
* *
* DDDMM.mmm,d Longitude - E(-)/W( ) *
* DDD : degrees (00..180) *
* MM.mmm: minutes (00.000 .. 59.999) *
* d : direction, E - east, W-west *
* *
* z.z speed over ground(knots) *
* 0 if over current DOP mask *
* *
* y.y track made good(reference to true north) *
* 0 if over current DOP mask *
* *
* ddmmyy UTC date of position fix *
* dd : day (1...31) *
* mm : month (01..12) *
* yy : year (00..99) *
* *
* d.d Magnetic variation(degrees) (0.0 .. 180.0) *
* *
* v Variation sense (E=east,W=west) *
* *
* *hh Check Sum and sentence termination delimiter *
* *
****************************************************************************/ /***************************************************************************
*
* OutputGGA
*
* Input: none
*
* Output: SUCCESS/FAILURE
*
* The GGA-Global Positioning System Fix Data describes Time, position
* and fix related data for a GPS receiver.
*
* The format is as following:
*
* $GPGGA,HHMMSS.sss,DDMM.mmm,d,DDDMM.mmm,d,q,ss,h.h,a.a,z,,,,*CC
*
* $ Beginning of NMEA sentence
* GPGGA Message Header
*
* HHMMSS.sss UTC of position fix
* HH : hours (00.24)
* MM : minutes (00..59)
* SS.sss: seconds (00.000 .. 59.999)
*
* DDMM.mmmm,d Latitude - N( )/S(-)
* DD : degrees (00..90)
* MM.mmm: minutes (00.000 .. 59.999)
* d : direction, N - north, S-south
*
* DDDMM.mmmm,d Longitude - E(-)/W( )
* DDD : degrees (00..180)
* MM.mmm: minutes (00.000 .. 59.999)
* d : direction, E - east, W-west
*
* q GPS Quality indicator
* q : 0 - Fix not available, or invalid
* 1 - GPS SPS Mode, fix valid
* 2 - Differential, GPS SPS Mode, fix valid
* 3 - GPS PPS Mode, fix valid
*
* ss Number of satellites in use (in tracking)
* ss : 0 .. 12
*
* h.h Horizontal dilution of precision
* h.h : HDOP
*
* a.a Antenna altitude re: mean-sea-level (geoid)
* M Units of antenna altitude, meters
* NULL Geoidal separation (Not supported)
* NULL Units of geoidal separation (Not yet supported)
* x.x Age of Differential GPS data
* xxxx Differential reference station ID
*
* *CC Check Sum and sentence termination delimiter
*
***************************************************************************/
學習中請大家多多指導呦~~
☆星霧☆(Mineg Chien WU)