-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom structs and enum server side. missing doc or example #10
Comments
ok maybe the DataTypeTree struct can be used... but that seem very very low level. Even I who wrote an ua stack at some point do not remember everything that must be done to create a custom struct.. |
There are a few separate things here. First, you need to add nodes to the actual node hierarchy somehow to represent the data type in the node hierarchy. That'll depend on your node manager, but it's the same as adding any other node. You'll need to manually define the No nice feature to do this easily, though we could create one for the address space I suppose. Typically if you're implementing a companion standard this will all be generated based on XML files like in the As for the data type itself, you need to create the data type as you've already done, but you also need to inform the server about it. This is done by creating a type implementing You can see a (generated) example for how to create a simple type loader here. If this seems needlessly complex, recall that OPC-UA does not have any form of reflection, so we need to cleverly dynamically map from node IDs to functions. To make things even more complicated, namespace indexes may be different on different servers for the same namespace... There may be ways to make doing this manually a bit less annoying. |
As for enums, they are just numbers in OPC-UA. There's no derive macro for implementing You still need to create the data type node. |
I wrote a MR to document how to do such things. still WIP https://github.com/FreeOpcUa/rust-opcua/pull/11/files |
and client code here: #15 so we are done |
I want to define a custom struct. With the rust opcua API I am very unsure how to do that.
I can define the struct like that
the enum like
But then I need to register the struct so it appears under BaseDataType
/Structure and Opc binary. Is there an API to do that?
DynamicStructure seems to be made to read data client side and DynamicTypeLoader to load the structs. I want to register it....
The text was updated successfully, but these errors were encountered: