@jcoreio/sparkplug-payload

3.1.3 • Public • Published

@jcoreio/sparkplug-payload

CircleCI semantic-release Commitizen friendly npm version

A library that provides tools for encoding and decoding payload objects using the Sparkplug Google Protocol Buffer Schema described in the Sparkplug Specification from Cirrus Link Solutions.

https://s3.amazonaws.com/cirrus-link-com/Sparkplug+Topic+Namespace+and+State+ManagementV2.1+Apendix++Payload+B+format.pdf

Not a drop-in replacement for the original sparkplug-payload package; require paths have changed.

Installation

npm install --save @jcoreio/sparkplug-payload

Encoding a payload

Here is a code example of encoding a payload:

var sparkplug = require('@jcoreio/sparkplug-payload/spBv1.0'),
  payload = {
    timestamp: new Date().getTime(),
    metrics: [
      {
        name: 'intMetric',
        value: 1,
        type: 'Int32',
      },
    ],
  },
  encoded = sparkplug.encodePayload(payload)

Decoding a payload

Here is a code example of decoding an encoded payload:

var decoded = sparkplug.decodePayload(encoded)

License

Copyright (c) 2017 Cirrus Link Solutions

All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html

Contributors: Cirrus Link Solutions, JCore Systems

Readme

Keywords

Package Sidebar

Install

npm i @jcoreio/sparkplug-payload

Weekly Downloads

354

Version

3.1.3

License

MIT

Unpacked Size

317 kB

Total Files

9

Last publish

Collaborators

  • gravitate1838
  • manojrsingireddy
  • avramdodson
  • forrest-keller
  • jrmclaurin
  • jedwards1211
  • eladendorf