-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Hello,
I have been experimenting with custom dynamic structures via the example code in the samples: https://github.com/FreeOpcUa/async-opcua/blob/master/samples/custom-structures-client/src/bin/dynamic_client.rs
In my example I have the following code to load in the dynamic structs:
let type_tree = DataTypeTreeBuilder::new(|f| f.namespace <= 4)
.values_per_read(100)
.build(&session)
.await?;
println!("{:?}", type_tree);
let loader = Arc::new(DynamicTypeLoader::new(Arc::new(type_tree)));
session.add_type_loader(loader);
From my limited testing and debugging I see that it can load the types and encoders for dynamic types registered by the OPCUA server when the NodeId of the types (and perhaps the variables) are Numeric.
However in our CODESYS generated OPCUA Server, the custom types are created with NodeId Identifier: String.
The above code example prints the type_tree, and I can see that for the dynamic_client.rs example, it can populate the struct_types, enum_types and encoding_to_data_type fields correctly.
When I repeat the same code against the CODESYS server, it iterates through the data type nodes such as:
NodeId { namespace: 4, identifier: String(UAString { value: Some("|type|CODESYS Control for Linux SL.Application.extractionAPI") }) }
But the type_tree contains empty struct_types, enum_types and encoding_to_data_type fields.
I wonder if this is a known limitation of dynamic type loader, or is expected behaviour according to OPCUA spec, and whether CODESYS is doing something unique with their server.
At the minimum, it would be great if types that do not have a registered encoder can still return the raw binary, rather than panicking.