GPRMC语句包括些什么,GPRMC解析C语言

$GPRMC更重要,所以重点说明:

$GPRMC(Recommended Minimum Specific GPS/TRANSIT Data)

框架头

UTC时间

状态

纬度

北纬/jzdyd

经度

东经/西经

速度

$GPRMC

hhmmss.sss

A/V

ddmm.mmmm

N/S

dddmm.mmmm

E/W

方位角

UTC日期

磁偏角

磁偏角方向

模式

检查

换行

ddmmyy

000 – 180

E/W

A/D/E/N

*hh

CR LF

格式: $GPRMC,1,2,3,4,5,6,7,8,9,10,12 * hh crlf

$GPRMC,024813.640,a,3158.4608,n,11848.3737,e,10.05,324.27,A*50

说明:

字段0:$GPRMC,语句ID,指示语句是recommendedminimumspecificgps/transit data (RMC )的推荐最小位置信息

字段1:UTC时间,hhmmss.sss格式

字段2 :状态,A=定位,V=无定位

字段3 :纬度ddmm.mmmm,度分格式(如果前位数不够则补0 ) ) ) ) )。

字段4 :纬度n (北纬)或S(jzdyd )

字段5 :经度dddmm.mmmm,度分格式(如果前位数不够则补0 ) ) ) )。

字段6 :经度e (东经)或w (西经) )。

字段7 :速度、区段、Knots (区段也为1.852公里/小时) )。

字段8 :方位角、度(二维方向指向,相当于二维指南针) )。

字段9:UTC日期,DDMMYY格式

字段10 :偏磁角,(000 – 180 )度(如果前位数不够,则补0 ) ) ) ) ) ) ) ) ) ) ) ) ) ) )。

字段11 :磁偏角方向,E=东,W=西

字段12 :模式,A=自动,D=差分,E=报价,N=数据无效(3.0协议内容) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )

字段13 :检查值

对应的程序代码如下所示。

3358 www.Sina.com/viewplaincopyprint? //运输定位数据privateboolgprmc _ parse (string data ) ) ) ) ) ) ) )。

 {             string[] source = Split(data, “$GPRMC”);             if (source != null && source.Length >= 12)             {                 //状态                 this.AnchorState = source[2];                 //纬度                 if (source[4].Length > 0 && source[3].Length > 2)                 {                     this.Latitude = string.Format(“{0}{1},{2}”, source[4], source[3].Substring(0, 2), source[3].Substring(2));                 }                 else                 {                     this.Latitude = “”;                 }                 //经度                 if (source[6].Length > 0 && source[5].Length > 3)                 {                     this.Longitude = string.Format(“{0}{1},{2}”, source[6], source[5].Substring(0, 3), source[5].Substring(3));                 }                 else                 {                     this.Longitude = “”;                 }                 //速度                 if (source[7].Length > 0)                 {                     this.NSpeed = double.Parse(source[7]);                 }                else                 {                     this.NSpeed = 0;                 }                 //方位                 if (source[8].Length > 0)                 {                     this.Track = double.Parse(source[8]);                 }                 else                 {                      this.Track = 0;                 }                 //磁偏角和方位                 if (source[10].Length > 0 && source[11].Length > 0)                 {                     this.Magnetic = string.Format(“{0} {1}”, source[11], source[10]);                 }                 else                 {                     this.Magnetic = “”;                 }                 //模式                 if (source.Length >= 13)                 {                     this.WorkMode = source[12];                 }                 //时间                 try                 {                     if (source[9].Length == 6 && source[1].Length >= 6)                     {                         string dtString = string.Format(“{0}-{1}-{2} {3}:{4}:{5}”,                             source[9].Substring(4),                             source[9].Substring(2, 2),                             source[9].Substring(0, 2),                             source[1].Substring(0, 2),                             source[1].Substring(2, 2),                             source[1].Substring(4));                         this.UTCDateTime = DateTime.Parse(dtString);                     }                 }                 catch { return false; }                 return true;             }             return false;         }飞艇稳赚不赔的打法          {                     this.Track = double.Parse(source[8]);                 }                 else                 {                      this.Track = 0;                 }                 //磁偏角和方位                 if (source[10].Length > 0 && source[11].Length > 0)                 {                     this.Magnetic = string.Format(“{0} {1}”, source[11], source[10]);                 }                 else                 {                     this.Magnetic = “”;                 }                 //模式                 if (source.Length >= 13)                 {                     this.WorkMode = source[12];                 }                 //时间                 try                 {                     if (source[9].Length == 6 && source[1].Length >= 6)                     {                         string dtString = string.Format(“{0}-{1}-{2} {3}:{4}:{5}”,                             source[9].Substring(4),                             source[9].Substring(2, 2),                             source[9].Substring(0, 2),                             source[1].Substring(0, 2),                             source[1].Substring(2, 2),                             source[1].Substring(4));                         this.UTCDateTime = DateTime.Parse(dtString);                     }                 }                 catch { return false; }                 return true;             }             return false;         }

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注