OpcUaClientNodeDiscovery
Description
The OpcUaClientNodeDiscovery object can be used to discover children nodes of a certain browseNodeId property is populated automatically but can be refreshed at any time by calling the update() method.
This object was introduced in InCore 2.6.
- › Inherits:
Overview
Properties
Methods
Signals
Properties
browseNodeId
This property holds the node ID of the OPC/UA node whose children to discover.
- › Type:
- › Signal:
browseNodeIdChanged()
- › Attributes:
Writable
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
nodes
This property holds the discovered OPC UA nodes.
- › Type:
- › Signal:
nodesChanged()
- › Attributes:
Readonly
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
update()
This method can be called to discover and update nodes manually.
Signals
nodesDataChanged(SignedInteger index)
This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the nodes list itself emitted the dataChanged() signal.
Example
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) })
}
}
}
}
}
}