You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing an example to read and deserialize a node value of Extension Object, but it didn't work at all for me. I reviewed similar threads and examples, and still have no idea how to make it working. Any advice or information are greatly appreciated.
From the UaExpert, the node to be read is ns=4;s=|var|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.PVL.System (System), and its data type is |tprop|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.System_UDT (System_UDT). So I created the example code below:
// System_UDT is the data type of the extension object to be readtypeSystem_UDTstruct {
// there are tons of other attributes that are omitted here// and I'll need this one only.MAC_IDstring
}
varnode=ua.MustParseNodeID("ns=4;s=|var|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.PVL.System")
funcinit() {
ua.RegisterExtensionObject(node, new(System_UDT)) // register before use
}
func (o*OPCUA) readSystem() {
v, e:=o.readNode(node)
ife!=nil {
fmt.Println(e)
return
}
fmt.Printf(">>> system: %#v\n", v)
}
Finally, I got the error: The extension object cannot be (de)serialized because the data type id is not recognized. StatusBadDataTypeIDUnknown (0x80110000), and I also found the data type read by the program is ns=4;s=|enc|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.System_UDT - you may find that it starts with |enc|, but it should be starting with |tprop| (shown in UaExpert and mentioned above)
I'm thinking is it because:
Should I register the data type of the Extension Object as well? - From the error message, yes, but how?
Should I fill up the System_UDT structure? - likely not
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing an example to read and deserialize a node value of Extension Object, but it didn't work at all for me. I reviewed similar threads and examples, and still have no idea how to make it working. Any advice or information are greatly appreciated.
From the UaExpert, the node to be read is
ns=4;s=|var|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.PVL.System
(System), and its data type is|tprop|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.System_UDT
(System_UDT). So I created the example code below:Finally, I got the error:
The extension object cannot be (de)serialized because the data type id is not recognized. StatusBadDataTypeIDUnknown (0x80110000)
, and I also found the data type read by the program isns=4;s=|enc|WAGO 750-8212 PFC200 G2 2ETH RS.UV3P22.System_UDT
- you may find that it starts with|enc|
, but it should be starting with|tprop|
(shown in UaExpert and mentioned above)I'm thinking is it because:
System_UDT
structure? - likely notI really have no other ideas. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions