How to use the @canboat/canboatjs.FromPgn function in @canboat/canboatjs

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)
    }
  }
}

@canboat/canboatjs

Native javascript version of canboat

Apache-2.0
Latest version published 4 months ago

Package Health Score

65 / 100
Full package analysis