.. _object_OpcUaClientNodeDiscovery: :index:`OpcUaClientNodeDiscovery` --------------------------------- Description *********** The OpcUaClientNodeDiscovery object can be used to discover children :ref:`nodes ` of a certain :ref:`browseNodeId `{OPC/UA node} on a OPC/UA server. The :ref:`nodes ` property is populated automatically but can be refreshed at any time by calling the :ref:`update() ` method. This object was introduced in InCore 2.6. :**› Inherits**: :ref:`Object ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 1 * :ref:`browseNodeId ` * :ref:`connection ` * :ref:`nodes ` * :ref:`updating ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`update() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`nodesDataChanged() ` * :ref:`Object.completed() ` Properties ********** .. _property_OpcUaClientNodeDiscovery_browseNodeId: .. _signal_OpcUaClientNodeDiscovery_browseNodeIdChanged: .. index:: single: browseNodeId browseNodeId ++++++++++++ This property holds the node ID of the OPC/UA node whose children to discover. :**› Type**: `OpcUaNodeId `_ :**› Signal**: browseNodeIdChanged() :**› Attributes**: Writable .. _property_OpcUaClientNodeDiscovery_connection: .. _signal_OpcUaClientNodeDiscovery_connectionChanged: .. index:: single: connection connection ++++++++++ This property holds the connection which to use for discovery. If not set, the global default connection will be used. This property was introduced in InCore 2.7. :**› Type**: \enum{OpcUaConnection*} :**› Signal**: connectionChanged() :**› Attributes**: Writable .. _property_OpcUaClientNodeDiscovery_nodes: .. _signal_OpcUaClientNodeDiscovery_nodesChanged: .. index:: single: nodes nodes +++++ This property holds the discovered OPC UA nodes. :**› Type**: :ref:`List `\<:ref:`OpcUaBrowseNode `> :**› Signal**: nodesChanged() :**› Attributes**: Readonly .. _property_OpcUaClientNodeDiscovery_updating: .. _signal_OpcUaClientNodeDiscovery_updatingChanged: .. index:: single: updating updating ++++++++ This property holds whether a discovery process is currently running. This property was introduced in InCore 2.8. :**› Type**: Boolean :**› Default**: ``false`` :**› Signal**: updatingChanged() :**› Attributes**: Readonly Methods ******* .. _method_OpcUaClientNodeDiscovery_update: .. index:: single: update update() ++++++++ This method can be called to discover and update :ref:`nodes ` manually. Signals ******* .. _signal_OpcUaClientNodeDiscovery_nodesDataChanged: .. index:: single: nodesDataChanged nodesDataChanged(SignedInteger index) +++++++++++++++++++++++++++++++++++++ This signal is emitted whenever the :ref:`List.dataChanged() ` signal is emitted, i.e. the item at ``index`` in the :ref:`nodes ` list itself emitted the dataChanged() signal. .. _example_OpcUaClientNodeDiscovery: Example ******* .. code-block:: qml import InCore.Foundation 2.5 import InCore.OpcUa 2.5 Application { OpcUaClient { id: client OpcUaClientConnection { backend: availableBackends[0] defaultConnection: true } OpcUaEndpointDiscovery { id: endpointDiscovery serverUrl: "opc.tcp://localhost:4840" onEndpointsChanged: { if (status.isGood) { if (status.status === OpcUaStatus.GoodCompletesAsynchronusly) return; // wait until finished if (count > 0) { console.log("Using endpoint", at(0).endpointUrl, at(0).securityPolicy); connection.connectToEndpoint(at(0)); } else { console.log("No endpoints retrieved") } } else { console.log("Error fetching endpoints:", status.status); } } } OpcUaClientNodeDiscovery { browseNodeId: OpcUaClientNodeId { ns: "http://inhub.de/opcuaserverexample" identifier: "s=Machine" } onNodesChanged: { for(let i in nodes) { console.log("Discovered node", client.fullNodePath(nodes[i].nodeId)) if (nodes[i] instanceof OpcUaClientValueNode) { console.log("Monitoring value node", client.fullNodePath(nodes[i].nodeId)) nodes[i].valueChanged.connect( () => { console.log(nodes[i].browseName, nodes[i].value) }) } } } } } }