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)
This commit is contained in:
29
test/GLLtest.js
Normal file
29
test/GLLtest.js
Normal file
@@ -0,0 +1,29 @@
|
||||
var should = require('should');
|
||||
|
||||
describe('GLL ', function () {
|
||||
it('parses', function () {
|
||||
var msg = require("../nmea.js").parse("$GPGLL,6005.068,N,02332.341,E,095601,A,D*42");
|
||||
msg.should.have.property('type', 'geo-position');
|
||||
msg.should.have.property('sentence', 'GLL');
|
||||
msg.should.have.property('lat', '6005.068');
|
||||
msg.should.have.property('latPole', 'N');
|
||||
msg.should.have.property('lon', '02332.341');
|
||||
msg.should.have.property('lonPole', 'E');
|
||||
msg.should.have.property('status', 'valid');
|
||||
});
|
||||
});
|
||||
|
||||
describe('GLL', function () {
|
||||
it('encodes ok', function () {
|
||||
var nmeaMsg = require("../nmea.js").encode('II', {
|
||||
type: 'geo-position',
|
||||
lat: 6005.06,
|
||||
latPole: 'N',
|
||||
lon: 2332.34,
|
||||
lonPole: 'E',
|
||||
timestamp: new Date(2013, 4, 1, 21,17 - new Date().getTimezoneOffset(),22),
|
||||
status: 'valid'
|
||||
});
|
||||
nmeaMsg.should.equal("$IIGLL,6005.06,N,2332.34,E,211722,A,D*62");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user