.. _user/protocols/opcua/opcuaObjectType:
*********************
OPC UA Object Types
*********************
OPC UA object types define class like structures in OPC UA namespace that
can be instanciated and added to the server address space. For more details
on OPC UA Object Types please refer to:
It is possible to create an instance of an object type by using the resource
type ``Cybus::Node::OpcuaObject``
Example Commissioning File
==========================
Download: :download:`opcua-objecttype-example.yml`
.. literalinclude:: opcua-objecttype-example.yml
:language: yaml
:linenos:
Output Format
=============
The server provides the structure of the object types and its values as a
JSON structure as the example:
.. code:: json
{
"ObjectTypeSample": {
"_children": {
"OperationMode": {
"_children": {
"ChildExample": {
"_children": {},
"_metadata": {
"nodeClass": "Variable",
"dataType": "Int64"
},
"_value": "1883344340925958233434349340394"
}
}
},
"_metadata": {
"nodeClass": "Variable",
"dataType": "Int32"
},
"_value": 0
}
},
"_metadata": {
"nodeClass": "Object"
}
}
.. list-table:: Details
:widths: 20 80
* - _metadata
- contains all metadata on a node. The nodeclass corresponds to the node-opcua Nodeclass enum documented here:
On nodes of type “Variable” the dataType entry indicates the OPC UA native data type documented here:
* - _children
- contains child objects in the OPC UA object tree
* - _value
- contains the plain serialized value as JSON
Writing Updates
===============
Writing updates to the OPC UA object type can be achieved by publishing
to the /write topic. The same JSON structure can be used
with updated data in the _value items. For data updates on U/INT64 please
review the section on BigInt datatypes in OPC UA Server documentation.
It is not necessary to update the complete structure. You can also only write
a JSON structure that contains the direct value update. To update all
values for the example structure above, only the following structure would
be required:
.. code:: json
{
"ObjectTypeSample": {
"_children": {
"OperationMode": {
"_children": {
"ChildExample": {
"_value": "50000000000000"
}
},
"_value": 10
}
}
}
}