feat: 导入 NMEA-0183 GPS 协议解析库(node-nmea)
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

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)
This commit is contained in:
hyzl
2026-10-19 09:54:44 +08:00
commit b0a1993169
50 changed files with 1951 additions and 0 deletions

23
codecs/GSV.js Normal file
View File

@@ -0,0 +1,23 @@
exports.ID = 'GSV';
exports.TYPE = 'satellite-list-partial';
exports.decode = function(fields) {
// $GPGSV,3,1,12, 05,58,322,36, 02,55,032,, 26,50,173,, 04,31,085,
var numRecords = (fields.length - 4) / 4,
sats = [];
for (var i=0; i < numRecords; i++) {
var offset = i * 4 + 4;
sats.push({id: fields[offset],
elevationDeg: +fields[offset+1],
azimuthTrue: +fields[offset+2],
SNRdB: +fields[offset+3]});
};
return {
sentence: exports.ID,
type: exports.TYPE,
numMsgs: +fields[1],
msgNum: +fields[2],
satsInView: +fields[3],
satellites: sats
};
}