Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalk/nmea0183-signalk

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalk/nmea0183-signalk

A node.js/javascript parser for NMEA0183 sentences. Sentences are parsed to Signal K format.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
465
decreased by-36.48%
Maintainers
4
Weekly downloads
 
Created
Source

signalk-parser-nmea0183

Build Status

A node.js/javascript parser of NMEA0183 sentences. Sentences are parsed to Signal K delta format.

Supported sentences

Todo

  • Sentence support (parity with old parser)
  • Tests for every sentence
  • Update readme
  • Include parsing to full Signal K format
  • Extend sentence support beyond current set (continuing)

Usage

const Parser = require('@signalk/nmea0183-signalk')
const parser = new Parser()

parser.on('error', error => {
  console.error(`[error] ${error.message}`)
})

parser.on('warning', warning => {
  console.warn(`[warning] ${warning.message}`)
})

parser.on('signalk:delta', delta => {
  console.log(`[delta] ${JSON.stringify(delta, null, 2)}`)
})

// Parse sentence
parser.parse('$SDDBT,17.0,f,5.1,M,2.8,F*3E')

In addition to usage in your code, the parser can be used on the command-line if installed globally (npm install --global). This allows you to pipe data from one program into the parser directly, without using a Signal K server. The parser holds no Signal K tree in memory (a big change vs. 1.x), so the output will be stringified Signal K delta messages.

$ echo '$SDDBT,17.0,f,5.1,M,2.8,F*3E' | nmea0183-signalk

NMEA0183v4 tag blocks

This parser has (limited) support of NMEA0183v4 tag blocks (e.g. \s:airmar dst800,c:1438489697*13\$SDDBT,17.0,f,5.1,M,2.8,F*3E). Keep in mind that, since NMEA uses the backslash \ as the start and end character of the tag block, you need to escape these characters before parsing them. This is necessary because javascript treats the backslash as the escape character causing it not to be included in the resulting string (unless escaped).

Example:

const Parser = require('@signalk/nmea0183-signalk')
const parser = new Parser()

parser.on('error', error => {
  console.error(`[error] ${error.message}`)
})

parser.on('warning', warning => {
  console.warn(`[warning] ${warning.message}`)
})

parser.on('signalk:delta', delta => {
  console.log(`[delta] ${JSON.stringify(delta, null, 2)}`)
})

parser.parse('\\s:airmar dst800,c:1438489697*13\\$SDDBT,17.0,f,5.1,M,2.8,F*3E')

Note: at this time, the checksum of the tag block (c:1438489697*13) is not validated.

License

Copyright 2016/2017 Signal K and Fabian Tollenaar <fabian@signalk.org>.

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.

Keywords

FAQs

Package last updated on 03 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc