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:
36
codecs/HDG.js
Normal file
36
codecs/HDG.js
Normal file
@@ -0,0 +1,36 @@
|
||||
var helpers = require("../helpers.js")
|
||||
|
||||
/*
|
||||
=== HDG - Magnetic heading, deviation, variation ===
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1 2 3 4 5 6
|
||||
| | | | | |
|
||||
$--HDG,x.x,x.x,a,x.x,a*hh
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Field Number:
|
||||
|
||||
1) Magnetic Sensor heading in degrees
|
||||
2) Magnetic Deviation, degrees
|
||||
3) Magnetic Deviation direction, E = Easterly, W = Westerly
|
||||
4) Magnetic Variation degrees
|
||||
5) Magnetic Variation direction, E = Easterly, W = Westerly
|
||||
6) Checksum
|
||||
|
||||
*/
|
||||
exports.TYPE = 'heading-deviation-variation';
|
||||
exports.ID = 'HDG';
|
||||
|
||||
exports.decode = function (fields) {
|
||||
console.log(fields);
|
||||
return {
|
||||
sentence: exports.ID,
|
||||
type: 'heading-deviation-variation',
|
||||
heading: +fields[1],
|
||||
deviation: +fields[2],
|
||||
deviationDirection: fields[3],
|
||||
variation: +fields[4],
|
||||
variationDirection: fields[5]
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user