npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@signalk/nmea0183-signalk

v3.15.2

Published

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

Downloads

2,069

Readme

@signalk/nmea0183-signalk

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

Supported sentences

Note: at this time, unknown sentences will be silently discarded.

Custom Sentences

You can add custom sentence parsers via the Signal K Server plugin mechanism. A plugin can register custom parsers by emitting nmea0183sentenceParser PropertyValues with a value that has the properties

  • sentence: the three letter id of the sentence
  • parser: a function with the signature ({ id, sentence, parts, tags }, session) => delta

See custom-sentence-plugin for an example.

Usage

JavaScript API

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

try {
  const delta = parser.parse('$SDDBT,17.0,f,5.1,M,2.8,F*3E')
  if (delta !== null) {
    console.log(`[delta] ${JSON.stringify(delta, null, 2)}`)
  }
}
catch (e) {
  console.error(`[error] ${e.message}`)
}

Command line

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

Example:

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

try {
  // backslash starts an escape sequence in JavaScript code, so they need to be double in string literals
  const delta = parser.parse('\\s:airmar dst800,c:1438489697*13\\$SDDBT,17.0,f,5.1,M,2.8,F*3E')
  if (delta !== null) {
    console.log(`[delta] ${JSON.stringify(delta, null, 2)}`)
  }
}
catch (e) {
  console.error(`[error] ${e.message}`)
}

Output:

[delta] {
  "updates": [
    {
      "source": {
        "sentence": "DBT",
        "talker": "airmar dst800",
        "type": "NMEA0183"
      },
      "timestamp": "2015-08-02T04:28:17.000Z",
      "values": [
        {
          "path": "environment.depth.belowTransducer",
          "value": 5.1
        }
      ]
    }
  ]
}

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 <[email protected]>.

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.