FB_SparkplugB_SimpleEncoder
This function block acts as a Helper to reduce work for FB_EoN.
The FB contains a protobuf blob encoder and various methods to quickly create (compose and/or encode) various messages. Since this FB is of the 'simple' variant, it can can only deal with the SimpleObjects type.
Messages which are mandatory for this FB are:
Pass a list of every All Metrics Which Will Ever Reported on during this "Lifetime". (1)
Note 1 This Method can be used to pass the entire list of metrics which will ever be reported on and send this list ONLY on node / device (re)birth. We can only send values which have been 'announced at birth' of the Node or Device. Since the Device or Node can die and be reborn, elements could be added or removed from the list which will be announced only at the next Birth. Warning! Never send values that have not been announced this Birth! Idea Add a way to let a Node/Device die and be reborn in order to anounce the latest list so we can update 'on-the-fly'
Pass a single instance of SimpleObject to the Encoder. (2)
Note 2 This method accepts a single SimpleObject deliberatly, to keep burnerplate code low and added flexibility as it is not mandatory for a SimpleObject to be part of an array or a list. The SimpleObject must have been announced at this Birth.
Pass a prepared list of SimpleObjects to the Encoder. (3)
Note 3 This method accepts a List of SimpleObject, this way you can send multiple values in one list. This list can not contain other metrics metrics than those announced on birth. The list is thus at most the same list as "ListOfMetricsWhichWillEverReportedOn".
Apart from these Methods the FB contains various methods for interaction and diagnosis
Last but not least it should provide the end user with a way to obtain the protobuf encoded (serialized) blob in order to publish it under the correct SparkPlugB Topic
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
Diff:
GetEoNNBirthCertificate Line 4:
Here you give the FB_Payload a seq of zero, but you should either:
* reset the
_seqNum
to zero, then call GetSeqNum()* reset the
_seqNum
to one, and leave the call as is.Diff:
Good Catch!
I plugged this hole.
Diff:
Diff:
Diff:
Diff:
Diff: