eclipse / tahu

Eclipse Tahu addresses the existence of legacy SCADA/DCS/ICS protocols and infrastructures and provides a much-needed definition of how best to apply MQTT into these existing industrial operational environments.

Home Page:https://eclipse.org/tahu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Javascript: sparkplug-payload -> Possible to specify converion options when decoding payload?

bj00rn opened this issue · comments

Hi,
Is it possible to specify conversion options for longs etc, when decoding payload?

We coming from using protobufjs with sparkplug protocol and using toObject by specified conversion options:

import * as protobuf from 'protobufjs'
import protocol from './sparkplugb.proto'
const root = protobuf.parse(protocol).root
let SparkplugPayload = root.lookupType('com.cirruslink.sparkplug.protobuf.Payload')
let decodedObj = SparkplugPayload.toObject(SparkplugPayload.decode(new Uint8Array(input)), {longs: Number})

I would like to use sparkplug-payload instead for decoding, but now my long timestamps are no longer converted.

import { get } from 'sparkplug-payload'
let sparkplug = get("spBv1.0")
let decodedObj = sparkplug.decodePayload(new Uint8Array(input)))

image

Cheers!