How to generate Array of Byte instead of Matrix of Byte?

14 views
Skip to first unread message

grant.b...@gmail.com

unread,
Apr 21, 2022, 10:05:30 AMApr 21
to open62541
I've got some client code that is attempting to write a byte array value that should look like this in Wireshark:

     Value: DataValue
         EncodingMask: 0x03, has value
         Value: Variant
             Variant Type: Array of Byte (0x83)
             Byte: Array of Byte
                ArraySize: 1
                [0]: Byte: 55

But  what I get is a variant type of matrix instead of array:

     Value: DataValue
         EncodingMask: 0x01, has value
         Value: Variant
              Variant Type: Matrix of Byte (0xc3)
              Byte: Array of Byte
                  ArraySize: 1
                 [0]: Byte: 7
              ArrayDimensions
                  ArraySize: 1
                  Int32: 1


Here's the code that creates the "matrix". How do I get it to create an array instead?

      UA_Variant_setArray(&node.value.value, &v2, 1, &UA_TYPES[UA_TYPES_BYTE]);
      UA_UInt32 matrix_dims[1] = {1};
      node.value.value.arrayDimensions = matrix_dims;
      node.value.value.arrayDimensionsSize = 1;
      node.value.value.storageType = UA_VARIANT_DATA_NODELETE; /* do not free the integer on deletion */
      node.value.value.data = &v;

grant.b...@gmail.com

unread,
Apr 21, 2022, 11:28:29 AMApr 21
to open62541
On Thursday, April 21, 2022 at 9:05:30 AM UTC-5 grant.b...@gmail.com wrote:

[...]
But  what I get is a variant type of matrix instead of array:
[...]

Here's the code that creates the "matrix". How do I get it to create an array instead?

      UA_Variant_setArray(&node.value.value, &v2, 1, &UA_TYPES[UA_TYPES_BYTE]);
      UA_UInt32 matrix_dims[1] = {1};
      node.value.value.arrayDimensions = matrix_dims;
      node.value.value.arrayDimensionsSize = 1;

It looks like all I need to do is not set the arrayDimensions and arrayDimensionsSize, and then I get the variant type I want (Array instead of Matrix). Is that correct?


Reply all
Reply to author
Forward
0 new messages