$GPGGA,013810.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69
$GPRMC,013810.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A
$GPGGA,013811.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69
$GPRMC,013811.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A
$GPGGA,013812.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69
$GPRMC,013812.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A
每秒钟我连接NMEA字符串到字符串变量。所有我想要的是得到最后的$GPGGA和GPRMC,因为我需要它的时间和日期。有办法做到吗?提前感谢各位。
如果您有以下内容:
String a = "$GPGGA,013812.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69";
String b = "$GPRMC,013812.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A";
然后在","符号处分开:
String[] aAry = a.split(",");
String[] bAry = b.split(",");
我认为每个数组的第二个元素(索引1)包含时间,因此它可以作为包含字符串013812.000的aAry[1]
访问(bAry[1]
也是如此)。我不确定日期存储在这些字符串中的位置。