How to use @canboat/canboatjs - 7 common examples

To help you get started, we’ve selected a few @canboat/canboatjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SignalK / signalk-server-node / packages / streams / canboatjs.js View on Github external
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)
github SignalK / signalk-server-node / packages / streams / nmea0183-signalk.js View on Github external
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)
    }
  }
}
github SignalK / signalk-server-node / packages / streams / simple.js View on Github external
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 => {
github SignalK / signalk-server-node / src / discovery.js View on Github external
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' &&
github SignalK / signalk-server-node / packages / streams / simple.js View on Github external
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)]
github SignalK / signalk-server-node / packages / streams / canbus.js View on Github external
* 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

@canboat/canboatjs

Native javascript version of canboat

Apache-2.0
Latest version published 4 months ago

Package Health Score

65 / 100
Full package analysis