UNPKG

@canboat/canboatjs

Version:

Native javascript version of canboat

44 lines 1.67 kB
"use strict"; /** * Copyright 2025 Scott Bender (scott@scottbender.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.YdDevice = void 0; const n2kDevice_1 = require("./n2kDevice"); const toPgn_1 = require("./toPgn"); class YdDevice extends n2kDevice_1.N2kDevice { app; n2kOutEvent; constructor(options) { super(options, 'canboatjs:yddevice'); this.app = options.app; this.n2kOutEvent = options.jsonOutEvent || 'nmea2000JsonOut'; const analyzerOutEvent = options.analyzerOutEvent || 'N2KAnalyzerOut'; this.app.on(analyzerOutEvent, this.n2kMessage.bind(this)); } sendPGN(pgn, src = undefined) { pgn.src = src || this.address; const ppgn = pgn; //FIXME?? ppgn.ydFullFormat = true; ppgn.forceSend = true; this.debug('Sending PGN %j', pgn); this.app.emit(this.n2kOutEvent, pgn); } sendActisenseFormat(msg) { this.app.emit('ydFullRawOut', (0, toPgn_1.actisenseToYdgwFullRawFormat)(msg)); } } exports.YdDevice = YdDevice; //# sourceMappingURL=yddevice.js.map