Binary Encode / Decode Processors¶
The “Binary Encode” and “Binary Decode” processors are installed with the Dataristix Application. The processors take one or more values as inputs and either encode the input values into a byte array or decode a byte array into individual values for further processing in the task pipeline. Individual values must be of a primitive type (numerical values or boolean).
Add to Task¶
Add the respective processor to a task by dragging it from the “Build” panel onto the task’s “Task Builder” panel.
Binary Encoder Configuration¶
Select the “Binary Encoder Processor” item in the “Task Builder” panel to view its properties.
You can change the following properties.
Name
The title of the processor topic as it appears within the task builder.
Byte Order
Determines whether values are encoded in little endian or big endian format.
Values
For each value within the byte array, enter a name and data type. The value’s offset within the byte array is calculated automatically from the cumulative byte size of the preceding values, in the order listed, and is shown read-only. When values are received by the Binary Encoder processor then these values are encoded into a byte array containing the defined fields.
Each entered name must exactly match the name of an input tag connected to the processor. If a connected input tag’s name does not match any entered value name, the processor is invalid and produces no output at all, not just for that one field; an error is logged.
The output byte array tag has the fixed name “Binary”.
The processor produces no output until it has received at least one value for every configured field. After that initial complete set, it emits a new byte array whenever any one field’s value is received, combining that new value with the most recently received value for every other field - which may have arrived at an earlier point in time.
Binary Decoder Configuration¶
Select the “Binary Decoder Processor” item in the “Task Builder” panel to view its properties.
You can change the following properties.
Name
The title of the processor topic as it appears within the task builder.
Byte Order
Determines whether values are encoded in little endian or big endian format.
Values
For each value within the byte array, enter a name and data type. The value’s offset within the byte array is calculated automatically from the cumulative byte size of the preceding values, in the order listed, and is shown read-only. When a byte array is received by the Binary Decoder processor then these values are read from the byte array and made available as individual output tags.
The input byte array tag has the fixed name “Binary”.
Examples¶
Encode Binary Data¶
In the following example, Sine signal floating point values are processed by the Binary Encoder and each value is forwarded as a binary 4-byte value to the MQTT connector.
Decode Binary Data¶
In the following example, Sine signal floating point values are processed by the Binary Decoder. The incoming byte array is split into individual values and forwarded to the ODBC connector.