Open astrowalker opened 7 years ago
From a specification perspective you would:
Create a DataType (PersonDataType). It is a subtype of Structure. Use that DataType as the DataType for a Variable. When reading the Value attribute you would get an ExtensionObject (a.k.a. Structure). The ExtensionObject would contain a serialized version of PersonDataType. For writing you would create an ExtensionObject with a PersonDataType and write to the Value attribute.
The UA Sample Library project has numerous examples of the above in TestData folder.
@SparhawkSoftware , thank you!
For clarification, "Create a DataType (PersonDataType)" -- as a node in ObjectTypes, correct?
"The UA Sample Library project has numerous examples of the above in TestData folder." Do you know any straightforward example? Because all I found is "TestData.DataTypes" file which creates randomly single field structure (at least this is my understanding) -- still reading this one example. I didn't find any other.
Update: I found DataType creator in workshop files (ReferenceNodeManager
), so I created a type, yet without any fields. I.e. I create fields but they are not visibile (for example in UA Expert). Maybe it is related to fact I create my type with Objects
folder (because so far I am unable to create subfolder inside Types/DataTypes
).
Is their any possibility to rebuild the custom server data types at client side? Now i have to rebuild all custom types in the client application, it would be nice to have a generic function to create a data type with the definition of an encodable ExtensionObject. Or even with a TypeDefinition of a Object Type.
For clients written in .NET, QuickOPC has support for custom types (OPC UA "Complex data"). It can decode and encode the extension objects for you, automatically. See QuickOPC 2018.1 release announcement and OPC UA Complex Data Extensions documentation.
Say I would like to define type
Person
with "fields"Name
andAge
in terms of OPC-UA. Also I would like to define variable nodeperson
of typePerson
and write to that node in one step. How to do it?Please note: when I update
person
with such data(Kevin, 47)
,(Jane, 22)
client should get in subscription, or when reading the variable directly only those 2 pairs, not something like(Kevin,22)
.