Open juangburgos opened 4 years ago
As a general rule, it might make sense to always allow subtypes of the required DataType. And not only subtypes for the builtin types.
Is the value decoded correctly in the server? Or do you get an ExtensionObject?
We might change the rules to also allow un-decoded ExtensionObjects if the type is correct.
Actually I already hacked it externally, by creating a custom UA_DataType
for every new OptionSet type I create, that custom UA_DataType
has the new OptionSet's nodeId, this way I can bypass the type mismatch error given by open62541.
So now I can read custom OptionSets on UaExpert, but I cannot write them. I still get a type mismatch error on write. I haven't looked deeper into why this error happens as for now I only need OptionSet read access, but is in my TODO list for QUaServer.
Did you add your custom UA_Datatype to the server?
Also, each UA_Datatype has two identifiers. One for the information model. And the other just for the binary encoding. Make sure that the binary encoding id is set correctly.
What is the status of the issue?
Haven't been able to make it work yet.
Description
I am trying to add custom OptionSet data types (not variables) to QUaServer. But I keep getting type mismatch errors when setting the type or the value to a variable that uses those custom OptionSet data types.
I have made small adjustments to the open62541 source to ignore the errors, and now UaExpert can read the OptionSet value. But when I try to write the value from UaExpert, the server always return type mismatch error.
Background Information / Reproduction Steps
To create the custom OptionSet type, I did the following:
OptionSetValues
property (as the specification mandates)UA_OptionSet
value and set it to the variableThis is where I get a type mismatch error, specifically in
compatibleDataType
:Here I commented out the
/*dataType->identifier.numeric <= 25 &&*/
part, because in my case,constraintDataType
is a subtype ofdataType
and taking out thenumeric <= 25
, then I succeed in setting the value.Now UaExpert can see it:
But when I write thevalue from UaExpert, then the server fails to receive it with a type mismatch error, as it can be seen in the attached Wireshark capture:
option_set.zip
The open62541 code involved is again the
compatibleDataType
function.I don't know what else to try. Any help is appreciated.
Used CMake options:
I try to describe the steps below in detail, but I cannot easily provide self-contained C code because it is mostly C++, although it is possible to reproduce it with the latest master branch of QUaServer building with:
And running a server project with the code:
Checklist
Please provide the following information: