extended-nmea
Version:
A TypeScript library for parsing NMEA0183-like sentences with support for custom and proprietary sentences.
59 lines • 1.79 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RMB = void 0;
const TalkerSentence_1 = require("../../types/sentences/TalkerSentence");
const helpers_1 = require("../../helpers");
var parseGeoCoordinate = helpers_1.Helpers.parseGeoCoordinate;
class RMB extends TalkerSentence_1.TalkerSentence {
constructor(data) {
super(data);
}
get warning() {
return this.dataFields[0] === 'V';
}
get crossTrackError() {
return parseFloat(this.dataFields[1]);
}
get directionToSteer() {
return this.dataFields[2];
}
get destinationWaypointId() {
return this.dataFields[3];
}
get lastWaypointId() {
return this.dataFields[4];
}
get destinationLatitude() {
return parseGeoCoordinate(this.dataFields[5], this.dataFields[6]);
}
get destinationLongitude() {
return parseGeoCoordinate(this.dataFields[7], this.dataFields[8]);
}
get destinationDistance() {
return parseFloat(this.dataFields[9]);
}
get destinationBearing() {
return parseFloat(this.dataFields[10]);
}
get destinationClosingVelocity() {
return parseFloat(this.dataFields[11]);
}
get arrivalCircleEntered() {
return this.dataFields[12] === 'A';
}
get valid() {
return super.valid && this.dataFields.length === 13;
}
get invalidReason() {
if (!super.valid) {
return super.invalidReason;
}
if (this.dataFields.length !== 13) {
return `Expected 13 fields, got ${this.dataFields.length}`;
}
return null;
}
}
exports.RMB = RMB;
RMB.ID = "RMB";
//# sourceMappingURL=RMB.js.map