aboutsummaryrefslogtreecommitdiffstats
path: root/src/OpcUaMonitoredNode.cpp
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-23 14:55:32 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-23 14:55:32 +0100
commit5ff9705937ffc1647587e1b228effd30c8a0e309 (patch)
treee1c5d9397ebbd68dd593788d6b09688a1d6ee8bd /src/OpcUaMonitoredNode.cpp
parent47096b375797c38b5b1e79f1366f1152cc292875 (diff)
downloadBobinkQtOpcUa-5ff9705937ffc1647587e1b228effd30c8a0e309.tar.gz
BobinkQtOpcUa-5ff9705937ffc1647587e1b228effd30c8a0e309.zip
Refactor Main.qml into separate components and add comments
Extract ConnectionPage, CertTrustDialog, and DebugConsole from Main.qml into their own QML files. Add inline comments to OpcUaMonitoredNode::handleValueUpdated explaining the range write guard, value store, and timestamp update.
Diffstat (limited to 'src/OpcUaMonitoredNode.cpp')
-rw-r--r--src/OpcUaMonitoredNode.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/OpcUaMonitoredNode.cpp b/src/OpcUaMonitoredNode.cpp
index 9155838..290a1c2 100644
--- a/src/OpcUaMonitoredNode.cpp
+++ b/src/OpcUaMonitoredNode.cpp
@@ -264,8 +264,8 @@ OpcUaMonitoredNode::handleAttributeUpdated (QOpcUa::NodeAttribute attr,
m_info.valueRank = QStringLiteral ("TwoDimensions");
break;
default:
- m_info.valueRank = QString::number (vr)
- + QStringLiteral ("Dimensions");
+ m_info.valueRank
+ = QString::number (vr) + QStringLiteral ("Dimensions");
break;
}
}
@@ -312,12 +312,18 @@ OpcUaMonitoredNode::handleAttributeUpdated (QOpcUa::NodeAttribute attr,
void
OpcUaMonitoredNode::handleValueUpdated (const QVariant &value)
{
+ // After a range write, Qt emits valueAttributeUpdated with only the
+ // partial written value instead of the full array. Ignore this
+ // update and let the monitored item deliver the correct full array
+ // on the next data change notification.
if (m_pendingRangeWrite)
return;
+ // Store the new value pushed by the OPC UA monitored item.
m_value = value;
emit valueChanged ();
+ // Update status and timestamps from the node's cached attributes.
m_info.status = QOpcUa::statusToString (m_node->valueAttributeError ());
m_info.sourceTimestamp
= m_node->sourceTimestamp (QOpcUa::NodeAttribute::Value);