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)
}
}
}
NMEA2000IK: options => {
const result = [new CanboatJs(options.subOptions)]
if (options.type === 'FileStream') {
result.push(
new TimestampThrottle({
getMilliseconds: msg => {
return msg.timer * 1000
}
})
)
} // else
{
result.unshift(new iKonvert(options.subOptions))
}
return result.concat([new N2kToSignalK(options.subOptions)])
},
NMEA2000YD: options => {
module.exports.runDiscovery = function(app) {
if (canboatjs.discover) {
try {
canboatjs.discover(app)
} catch (ex) {
console.log(ex)
}
}
discoverWLN10()
discoverGoFree()
function findUDPProvider(port) {
return app.config.settings.pipedProviders.find(provider => {
return (
provider.pipeElements &&
provider.pipeElements.length === 1 &&
provider.pipeElements[0].type === 'providers/simple' &&
provider.pipeElements[0].options &&
provider.pipeElements[0].options.type === 'NMEA0183' &&
NMEA2000YD: options => {
const result = [new Ydwg02(options.subOptions)]
if (options.type === 'FileStream') {
result.push(new TimestampThrottle())
}
return result.concat([new N2kToSignalK(options.subOptions)])
},
Multiplexed: options => [new MultiplexedLog(options.subOptions)]
* Copyright 2018 Signal K & Scott Bender
*
* 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.
*/
module.exports = require('@canboat/canboatjs').canbus
module.exports = require('@canboat/canboatjs').serial