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: | Object |
---|
Properties¶
browseNodeId¶
This property holds the node ID of the OPC/UA node whose children to discover.
› Type: | OpcUaNodeId |
---|---|
› 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. Depending on the respective node class, each instance is either of type OpcUaClientValueNode for value nodes, OpcUaClientMethodNode for method nodes or OpcUaClientNode in all other cases.
› Type: | List<OpcUaNode> |
---|---|
› Signal: | nodesChanged() |
› Attributes: | Readonly |
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) })
}
}
}
}
}
}