How read and write array of struture? #1219
sergeishugaev
started this conversation in
General
Replies: 2 comments 16 replies
-
Can you also provide some screenshots of what these nodes look like in UaExpert? Have you written any code yet? |
Beta Was this translation helpful? Give feedback.
10 replies
-
I'm able to read the array by modifying client.addSessionInitializer(new BinaryDataTypeDictionarySessionInitializer(StructCodec::new));
client.connect();
var nodeId = NodeId.parse("ns=4;s=|var|SPK107 (M01).Application.GVL.astShipmentAuto");
DataValue value = client.readValues(0.0, TimestampsToReturn.Both, List.of(nodeId)).get(0);
ExtensionObject[] xos = (ExtensionObject[]) value.getValue().getValue();
logger.info("astShipmentAuto:");
for (int i = 0; i < xos.length; i++) {
ExtensionObject xo = xos[i];
Object obj = xo.decode(client.getDynamicEncodingContext());
logger.info(" astShipmentAuto[{}]: {}", i, obj);
} Result:
It seems this server does indeed support the legacy DataType dictionary mechanism. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I need an OPC UI client to read and write arrays of structures, there can also be arrays of variables inside structures. An example of the structure from Codesys 3.5 is shown in the figure.
Structure:
Substructure:
Array of structure:
I can see this array through UA expert, but I don't understand how I can get this data using your library. Individually, I can read or write any variable in the array, but this is inconvenient, since there is quite a lot of data.
Tell me how to work with such arrays, how to read and write variables located in arrays of structures?
Beta Was this translation helpful? Give feedback.
All reactions