Binary Set
The Binary Set action copies the value
of a non-binary data type variable to a BINARY data type
variable.
Parameter descriptions
The action provides these parameters:
Parameter | Description |
---|---|
Action Input Type | Can be:
|
Starting Offset | The first byte of the data where the
set begins. The offset is calculated by
counting the number of bytes from the
beginning of the source binary
buffer. The source binary buffer is first copied into an internal replica. Then, starting at the specified offset, the value is copied into the internal replica according to the Item Type, Item Count, and Byte Order parameters. The original source binary buffer is not changed as part of this internal work. If you select Dynamic as the action input type, Starting Offset appears on the Input tab where you can set a variable whose value can vary at runtime. |
Item Type | The data type of the source
variable. The list of the available
data types for the node. For example,
BYTE, WORD, DWORD, or INT1, INT2, INT4
and so forth. When you change the value of Item Type, the value under the Logical column on the Name row of the Input tab also changes. |
Item Count | A value that specifies a single
value or an array. For an array, the
value specifies the number of elements
in the array. Item Count defaults to one, a single value. When you change the value of Item Count, the value under the Count column on the Value row of the Input tab also changes. |
Byte Order | Can be:
|
Input tab (Static)
If you select Static as the action
input type, the Input tab appears as
follows:
The Input tab is used to specify the source value of the initial binary buffer.
The following describes the Input tab
for Binary Set:
Parameter | Description |
---|---|
Value | Specifies the value you want to set into the source binary buffer. |
Binary Buffer | Specifies the source binary buffer. |
Input tab (Dynamic)
If you select Dynamic as the action
input type, the Input tab appears as
follows:
Notice that Starting Offset appears on the Input tab where you can set a variable whose value can vary at runtime.
Output tab
The Output tab is used to specify the
variable to store the result of the action.
The following describes the Output tab
for Binary Set:
Parameter | Description |
---|---|
Binary Buffer | Specifies the destination binary
buffer that stores the result of the
Binary Set action. The result of the Binary Set action is copied from the internal replica of the source binary buffer to the destination binary buffer. If you want to update a source binary buffer directly with the value specified, then the Output tabBinary Buffer parameter should be set to the same device variable as the Input tab Binary Buffer parameter. |
Binary Set example 5
This example describes a trigger that uses the
Binary Set action to move the 4 bytes in
the string variable IN_STRING to the
binary variable BINARY_VAR.
The process follows:
- A new trigger is named and an event
specified.
- Local variables are available for the trigger to
use. Notice the default value for
IN_STRING is ASCII
ABCD.
- Using the Canvas Editor, the Binary
Set action is added to the trigger, and its
parameter values filled in.
- From the Input tab, under
Value, the local variable
IN_STRING and
BINARY_VAR are assigned to the
action.
- From the Input tab, under
Value, the local variable
BINARY_VAR is assigned to the
action.
The destination for the move is BINARY_VAR. - When the trigger is saved and started, a report is
generated.
After trigger execution, BINARY_VAR contains 0x41424344, as is shown in the trigger report