diff options
Diffstat (limited to 'src/OpcUaMonitoredNode.cpp')
| -rw-r--r-- | src/OpcUaMonitoredNode.cpp | 24 |
1 files changed, 22 insertions, 2 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; |
