diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-20 12:32:56 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-20 12:32:56 +0100 |
| commit | 263a055f9b9460e4da747c7e56372e963f72fe68 (patch) | |
| tree | 8620dbf4946e765779fa55247bd3cea8b48128fe /src | |
| parent | 690db0fa630ac57d0ec99010862c7b7e4a7ac589 (diff) | |
| download | BobinkQtOpcUa-263a055f9b9460e4da747c7e56372e963f72fe68.tar.gz BobinkQtOpcUa-263a055f9b9460e4da747c7e56372e963f72fe68.zip | |
Display all 30 nodes across 3 pages with human-readable tooltips
NodePage rewritten with Repeater/ItemDelegate showing 10 nodes per page
(RW Scalars, RO Scalars, RW Arrays). DataType resolved via namespace0Id
helpers, AccessLevel decoded from bitmask to readable flags.
Diffstat (limited to 'src')
| -rw-r--r-- | src/OpcUaMonitoredNode.cpp | 24 | ||||
| -rw-r--r-- | src/OpcUaMonitoredNode.h | 4 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/OpcUaMonitoredNode.cpp b/src/OpcUaMonitoredNode.cpp index 0ffe300..b158881 100644 --- a/src/OpcUaMonitoredNode.cpp +++ b/src/OpcUaMonitoredNode.cpp @@ -7,6 +7,7 @@ #include <QMetaEnum> #include <QOpcUaLocalizedText> +#include <QStringList> OpcUaMonitoredNode::OpcUaMonitoredNode (QObject *parent) : QObject (parent) {} @@ -161,10 +162,29 @@ OpcUaMonitoredNode::handleAttributeUpdated (QOpcUa::NodeAttribute attr, } break; case QOpcUa::NodeAttribute::DataType: - m_info.dataType = value.toString (); + { + auto ns0 = QOpcUa::namespace0IdFromNodeId (value.toString ()); + m_info.dataType = QOpcUa::namespace0IdName (ns0); + if (m_info.dataType.isEmpty ()) + m_info.dataType = value.toString (); + } break; case QOpcUa::NodeAttribute::AccessLevel: - m_info.accessLevel = value.toUInt (); + { + quint32 bits = value.toUInt (); + QStringList flags; + if (bits & quint32 (QOpcUa::AccessLevelBit::CurrentRead)) + flags << QStringLiteral ("Read"); + if (bits & quint32 (QOpcUa::AccessLevelBit::CurrentWrite)) + flags << QStringLiteral ("Write"); + if (bits & quint32 (QOpcUa::AccessLevelBit::HistoryRead)) + flags << QStringLiteral ("History Read"); + if (bits & quint32 (QOpcUa::AccessLevelBit::HistoryWrite)) + flags << QStringLiteral ("History Write"); + m_info.accessLevel = flags.isEmpty () + ? QStringLiteral ("None") + : flags.join (QStringLiteral (", ")); + } break; default: return; diff --git a/src/OpcUaMonitoredNode.h b/src/OpcUaMonitoredNode.h index 53e9537..ac5983a 100644 --- a/src/OpcUaMonitoredNode.h +++ b/src/OpcUaMonitoredNode.h @@ -30,7 +30,7 @@ struct OpcUaNodeInfo Q_PROPERTY (QString description MEMBER description) Q_PROPERTY (QString nodeClass MEMBER nodeClass) Q_PROPERTY (QString dataType MEMBER dataType) - Q_PROPERTY (quint32 accessLevel MEMBER accessLevel) + Q_PROPERTY (QString accessLevel MEMBER accessLevel) Q_PROPERTY (QString status MEMBER status) Q_PROPERTY (QDateTime sourceTimestamp MEMBER sourceTimestamp) Q_PROPERTY (QDateTime serverTimestamp MEMBER serverTimestamp) @@ -40,7 +40,7 @@ public: QString description; QString nodeClass; QString dataType; - quint32 accessLevel = 0; + QString accessLevel; QString status; QDateTime sourceTimestamp; QDateTime serverTimestamp; |
