Files
nmea/codecs/RMC.js
hyzl b0a1993169
Some checks failed
Node.js CI / build (10.x) (push) Has been cancelled
Node.js CI / build (12.x) (push) Has been cancelled
Node.js CI / build (14.x) (push) Has been cancelled
Node.js CI / build (15.x) (push) Has been cancelled
feat: 导入 NMEA-0183 GPS 协议解析库(node-nmea)
NMEA-0183 语句解析器,含 21 个语句类型 codec 与配套单元测试。

- codecs/:APB/BWC/DBT/GGA/GLL/GRMT/GSA/GSV/HDG/HDM/HDT/MWV/RDID/
  RMB/RMC/ROT/RSA/TXT/VTG/VWR/ZDA
- test/:各 codec 对应的 mocha 用例
- .github/workflows/:node与 npm-publish 流水线

许可证:MIT(原作者 James Penn)
2026-10-19 09:54:44 +08:00

46 lines
1.2 KiB
JavaScript

/*
=== RMC - Recommended Minimum Navigation Information ===
This is one of the sentences commonly emitted by GPS units.
------------------------------------------------------------------------------
1 2 3 4 5 6 7 8 9 10 11 12
| | | | | | | | | | | |
$--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh
------------------------------------------------------------------------------
Field Number:
1) Time (UTC)
2) Status, V = Navigation receiver warning
3) Latitude
4) N or S
5) Longitude
6) E or W
7) Speed over ground, knots
8) Track made good, degrees true
9) Date, ddmmyy
10) Magnetic Variation, degrees
11) E or W
12) Checksum
*/
exports.TYPE = 'nav-info';
exports.ID = 'RMC';
exports.decode = function(fields) {
return {
sentence: exports.ID,
type: exports.TYPE,
timestamp: fields[1],
status: fields[2] == 'V' ? 'warning' : 'valid',
lat: fields[3],
latPole: fields[4],
lon: fields[5],
lonPole: fields[6],
speedKnots: +fields[7],
trackTrue: +fields[8],
date: fields[9],
variation: +fields[10],
variationPole: fields[11]
};
}