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

How to encode bytes values and array data types?

SeppPenner opened this issue · comments

I have checked

metricBuilder.setBytesValue(ByteString.copyFrom((byte[]) metric.getValue()));
where the encoder does metricBuilder.setBytesValue(ByteString.copyFrom((byte[]) metric.getValue())); --> I have checked the Protobuf class and seen the following:

public Builder setBytesValue(com.google.protobuf.ByteString value) {
    if (value == null) {
        throw new NullPointerException();
    }

    valueCase_ = 16;
    value_ = value;
    onChanged();
    return this;
}

but I don't understand how the data is stored in the value. Is this a Hex-String of the byte stored as string value in Protobuf? The same question for the array data types like In8Array or DateTimeArray. It would be nice if someone could give me an example on what to do here as I'm currently really struggeling with these conversions in my project https://github.com/SeppPenner/SparkplugNet...

I found it, seems like I was missing the bytes value in the Protobuf equivalenbt (Or the bytes value wasn't present for some other types).