Binary Get

The Binary Get action copies a value from a BINARY data type variable into another variable of any data type.


Parameter descriptions

The action provides these parameters:

Parameter Description
Action Input Type Can be:
  • Static - The specified Starting Offset cannot be changed unless you edit the trigger.
  • Dynamic - The Starting Offset parameter becomes available from the Input tab.
Starting Offset The first byte of the data that the get begins with. The offset is calculated by the number of bytes counted from the beginning of the variable.
If you select Dynamic as the Action Input Type, Starting Offset becomes available from the Input tab where you can set a variable whose value can vary at runtime.
Output Item Type The data type of the output variable. The list of the available data types for the node. For example, BYTE, WORD, DWORD, or INT1, INT2, INT4 and so forth.
Output Item Count A value that specifies a single integer or an array. For an array, the value specifies the number of elements in the array.
Output Item Count defaults to one, a single value.
When you change the value of Output Item Count, the value under the Count column on the Value row of the Output tab also changes.
Byte Order There are two types:
  • Little Endian - Stores the value of the least significant byte(the "little end") into the destination variable at the highest address.
  • Big Endian - Stores the value of the most significant byte (the "big end") into the destination variable at the lowest address.

Input tab (Static)

If you select Static as the action input type, the Input tab appears as follows:

The following describes the Input tab for Binary Get when Static is selected for the Action Input Type:

Parameter Description
Binary Buffer Specifies the source BINARY buffer.

Input tab (Dynamic)

If you select Dynamic as the value for 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 destination of the result variable for the action. The Output tab remains the same regardless of whether you select Static or Dynamic for the Action Input Type.

Parameter Description
Value Specifies the destination of the Binary Get.
The results of taking the source Binary buffer, starting at the specified offset and getting values for the specified item count.

Binary Fill and Binary Get example 4

This example describes a trigger that incorporates actions that insert a Carriage Return Line Feed sequence x0D0A into the middle of a string.

The example trigger contains these actions:

  • Binary Fill (action 1) puts 0x0D into the first byte of the local variable CRLF.
  • Binary Fill (action 2) puts 0x0A into the second byte of the local variable CRLF.
  • Binary Get (action 3) moves the binary variable CRLF to the string variable CRLF_STRING.
  • String Builder (action 4) inserts the variable CRLF_STRING into the middle of the variable OUTPUT_STRING.
    The process follows:
Binary Fill action 1
  1. A new trigger is named and an event specified.

    Local variables are available for the trigger to use.
  2. Using the Canvas Editor, the first BinaryFill action is added to the trigger and the parameter values filled in.

    This Binary Fill action will put 0x0D into the first byte of the local variable CRLF.
  3. The input and output variables are assigned the same local variable CRLF.
Binary Fill action 2

The second Binary Fill action is added to the trigger and the parameter values filled in.

This action will put 0x0A into the second byte of the local variable CRLF.

The input and output variables are assigned the same local variable CRLF.

Binary Get action 3

Binary Get is added as the third action to the trigger and its parameter values filled in.

This action moves the binary variable CRLF to the string variable CRLF_STRING, and the content of this string variable is now 0x0D0A

Notice that the output variable is assigned CRLF_STRING.

String Builder action 4

The String Builder action is added to the trigger and its parameter values filled in.

When the trigger executes, String Builder will insert the variable CRLF_STRING into the middle of the local  variable OUTPUT_STRING. In the format string, $(control) is placed between HELLO and WORLD. This will be replaced by the variable CRLF_STRING.

After the trigger is saved, started and executed, a report is generated.

Notice in the trigger report, the value of the local variable OUTPUT_STRING has the value 0x0D0A embedded between the words HELLO and WORLD.