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

@coremarine/septentrio-sbf

v1.0.1

Published

It is a library to parse SBF data. SBF is a private binary protocol of Septentrio trademark which uses in its GNSS devices

Downloads

16

Readme

SBF Parser

SBF Parser is a library to read SBF data from Septentrio devices.

SBF is private binary protocol of Septentrio trademark which uses in its own GNSS devices.

Firmwares and frames implemented:

  • [x] GNSS Attitude

    • [x] AttCovEuler
    • [x] AttEuler
    • [x] AuxAntPositions
    • [x] EndOfAtt
  • [ ] GNSS Position Velocity Time

    • [ ] PVTCartesian
    • [x] PVTGeodetic - Revision 2
    • [ ] PosCovCartesian
    • [ ] PosCovGeodetic
    • [ ] VelCovCartesian
    • [ ] VelCovGeodetic
    • [x] DOP
    • [ ] PosCart
    • [ ] PosLocal
    • [ ] PosProjected
    • [ ] BaseVectorCart
    • [ ] BaseVectorGeod
    • [x] PVTSupport
    • [x] PVTSupportA
    • [x] EndOfPVT
  • [x] Receiver Time

    • [x] Receiver Time
    • [x] xPPPSOffset

API

This library has two access points:

  1. availableFirmwares() -> string[] firmwares
  2. SBFParser([firmware: Firmware = '4.10.1', memory: boolean = false]) -> Parser Object

First function is to get available firmwares supported by the library.

Second is the Parser class to work with. It has three public attributes, and two methods.

Attributes:

  • firmware -> firmware setted
  • memory -> memory setted
  • bufferLimit -> maximum internal buffer data in bytes supported
  • bufferSize (read only) -> internal buffer data storage

Methods:

  • addData(data: Buffer) -> To add data
  • getFrames(): SBFResponse[] -> To get parsed frames. It returns an array of SBFResponse objects

How to use it

This is important

1. Importing parser

First of all, import the parser

import { SBFParser } from '@coremarine/septentrio-sbf'

2. Creating an instance

Then you should instance a new parser object with one of this three ways

The constructor is this

SBFParser([firmware: Firmware = '4.10.1', memory: boolean = false])
  1. firmware ('4.10.1' by default) is an string parameter with one of the supported firmwares To know supported firmwares just consult with

    import { availableFirmwares } from '@coremarine/septentrio-sbf'
    const firmwares = availableFirmwares()
  2. memory (disabled by default) is a boolean parameter to enable or disable memory

    • memory = false -> each time data is added, it clear internal buffer and add new one data
    • memory = true -> each time data is added, it is attached to the internal buffer

So the constructor could be of this three options:

  • const parser = new SBFParser() -> firmware = '4.10.1', memory = false
  • const parser = new SBFParser(fw) -> firmware = fw, memory = false
  • const parser = new SBFParser(fw, mem) -> firmware = fw, memory = mem

3. Adding data

You can enable or disable memory whatever you want. If you enable it, you can add many times and then parsed when you need it. If you have memory disabled, each time you add data it will overwrite the previous data.

parser.memory = true
parser.memory = false

Data added have to be a Buffer instance or you get an exception.

const data1 = Buffer.from([...])
const data2 = Buffer.from([...])
// ...
parser.addData(data1)
parser.addData(data2)
// ...

4. Parsing data

Each time data is added, internally it is parsed. So parser.bufferLength is the remained data that cannot be parsed, maybe because is incompleted.

To get parsed frames is just

const frames = parser.getFrames()

Parsed frames are an array of objects, SBFResponse[], where each object, SBFResponse is like this

type SBFResponse = {
  name: string,
  number: number,
  version: number,
  frame: SBFFrame,
  buffer: Buffer,
}

type SBFFrame = {
  header: SBFHeader,
  time: SBFTime,
  body: SBFBody,
} 

export type SBFHeader = {
  sync: string,
  crc: number,
  id: SBFID,
  length: number
}

export type SBFID = {
  blockNumber: number,
  blockRevision: number
}

export interface SBFTime {
  tow: number | null,
  wnc: number | null,
  timestamp?: number | null,
  date?: string | null
}

export type SBFBody = object | null

When you get the parsed frames from the data, they are removed from parser objects.

parser.addData(data)
parser.getFrames().length // return x
parser.getFrames().length // return 0

Notes

bufferLimit it is used to stored an incompleted frame if memory is enabled. So you can add the needed it data later.

bufferLimit is set to 65535 bytes which is more than enough to store an incompleted frame.

It is not recommended you change its value if you don't understand well the protocol SBF or how it works.