Socket
Socket
Sign inDemoInstall

ace-msg-parser

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ace-msg-parser

A node native add-on for Aceinna device message parser


Version published
Weekly downloads
5
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Node Aceinna Message Parser

This is a native addon to parse Aceinna device message. It helps you to split the binary data to payload by packet type. Do some decode work based on the user manual if you want to know the actual value from Aceinna device.

You need to have Node 10.5.0 or later installed.

Usage

const parsers = require("ace-msg-parser");

const allowedNMEATypes = [
    "$GPGGA", "$GNGGA", "$GPRMC", "$GNRMC", "$GPGSV",
    "$GLGSV", "$GAGSV", "$BDGSV", "$GPGSA", "$GLGSA",
    "$GAGSA", "$BDGSA", "$GPZDA", "$GNZDA", "$GPVTG",
    "$PASHR", "$GNINS",
];

const uartParser = new parsers.MessageParser({
    key: 'uart-parser-key',
    user: {
        allows: [
            0x7331, //s1, 
            0x7332, //s2, 
            0x674e, //gN,
            0x694e, //iN,
            0x6431, //d1,
            0x6432, //d2,
            0x7354, //sT,
            0x6f31, //o1,
            0x664d, //fM,
            0x7274, //rt,
            0x7350, //sP
        ],
        packetLengthType: 'uint8',
    },
    nmea: {
        allows: allowedNMEATypes
    }
});

API

MessageParser

constructor(options:Options)

Accept a options to initialize the parser.

receive(data: Buffer): ResultList

Receive some buffer data, and parse the result

Options

NameData TypeOptionalDescription
keystringNoA unique key
userUserOptionsYesThe options to parse user packet
nmeaNMEAOptionsYesThe options to parse NMEA packet

UserOptions

NameData TypeOptionalDescription
allowsnumber[]NoOnly data with packet type in the list could be pared
packetLengthTypestringNoThe packet length type of user packet, uint8 or uint32

NMEAOptions

NameData TypeOptionalDescription
allowsstring[]NoOnly data with NMEA type in the list could be pared

ResultList

A list of parsed result

NameData TypeOptionalDescription
packetTypenumberNoThe packet type. 0x6e4d is for NMEA packet
payloadstring or BufferNoThe content of parsed packet. User packet is Buffer, and NMEA is string

FAQs

Last updated on 04 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc