Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function CanboatJs (options) {
Transform.call(this, {
objectMode: true
})
this.fromPgn = new FromPgn(options)
this.fromPgn.on('warning', (pgn, warning) => {
debug(`[warning] ${pgn.pgn} ${warning}`)
})
// error events need a handler, but are really handled in the callback
this.fromPgn.on('error', () => {})
this.app = options.app
this.handlePgnData = (err, pgnData) => {
if (err) {
console.error(err)
} else {
this.push(pgnData)
this.app.emit('N2KAnalyzerOut', pgnData)
function Nmea0183ToSignalK (options) {
Transform.call(this, {
objectMode: true
})
this.parser = new Parser(options)
this.n2kParser = new FromPgn(options)
this.n2kState = {}
// Object on which to send 'sentence' events
this.sentenceEventEmitter = options.app.signalk
// Prepare a list of events to send for each sentence received
this.sentenceEvents = options.suppress0183event ? [] : ['nmea0183']
if (options.sentenceEvent) {
if (Array.isArray(options.sentenceEvent)) {
this.sentenceEvents = this.sentenceEvents.concat(options.sentenceEvent)
} else {
this.sentenceEvents.push(options.sentenceEvent)
}
}
}