Description
Develop OPC UA Client with QML. Test with UA Demo server.
After first endpoint discovery, QtOpcUa.Connection.connectToEndpoint works fine, ValueNodes are updating.
But after disconnectFromEndpoint, and connectToEndpoint again, connection status is connected, but ValueNodes are not updating anymore.
See the example code. After first start everything fine: status connected and value is updating. After click Disconnect button and Connect again - ValueNode doesn't update value from server anymore.
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.3 import QtOpcUa 5.15 as QtOpcUa Window { visible: true width: 640 height: 480 title: qsTr("Hello World") QtOpcUa.Connection { id: connection backend: "open62541" defaultConnection: true } QtOpcUa.ServerDiscovery { id: serverDiscovery discoveryUrl: "opc.tcp://127.0.0.1:48020" onServersChanged: { if (!count) return; endpointDiscovery.serverUrl = at(0).discoveryUrls[0]; } } QtOpcUa.EndpointDiscovery { id: endpointDiscovery onEndpointsChanged: { if (!count) return; connection.connectToEndpoint(at(0)); } } QtOpcUa.ValueNode { nodeId: QtOpcUa.NodeId { identifier: "s=Demo.Dynamic.Scalar.String" ns: "4" } id: demoString } Button { x: 14 y: 13 width: 112 height: 40 text: connection.connected ? "Disconnect" : "Connect" visible: true onClicked: { if (connection.connected) connection.disconnectFromEndpoint() else connection.connectToEndpoint(endpointDiscovery.at(0)); } } Text { x: 14 y: 68 width: 346 height: 28 text: demoString.value } }