diff options
author | Jannis Voelker <jannis.voelker@basyskom.com> | 2018-08-09 10:25:11 +0200 |
---|---|---|
committer | Jannis Völker <jannis.voelker@basyskom.com> | 2018-08-14 05:08:17 +0000 |
commit | 3df139b6b9a76c74ff345fcfbcea1e9ef0793a9f (patch) | |
tree | 2062dda099a412999310984b7ae540a6d6818d11 /src | |
parent | bf08d00adf20ceb606214d89b0e0883092a44bc2 (diff) |
Unify the status code for attributes that are not in the cache
QOpcUaNode::attributeError() and QOpcUa::valueAttributeError() now
return the BadNoEntryExists status code if the attribute is not in the
cache. The same status code is set in the default constructed
QOpcUaMonitoringParameters returned by QOpcUaNode::monitoringStatus().
Change-Id: I4677bb270ea987d68d9a8f7fbd7171f16e24eb1d
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/opcua/client/qopcuamonitoringparameters_p.h | 2 | ||||
-rw-r--r-- | src/opcua/client/qopcuanode.cpp | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/opcua/client/qopcuamonitoringparameters_p.h b/src/opcua/client/qopcuamonitoringparameters_p.h index 941b536..cb05e4e 100644 --- a/src/opcua/client/qopcuamonitoringparameters_p.h +++ b/src/opcua/client/qopcuamonitoringparameters_p.h @@ -71,7 +71,7 @@ public: , maxNotificationsPerPublish(0) , priority(0) , publishingEnabled(true) - , statusCode(QOpcUa::UaStatusCode::BadAttributeIdInvalid) + , statusCode(QOpcUa::UaStatusCode::BadNoEntryExists) , shared(QOpcUaMonitoringParameters::SubscriptionType::Shared) {} diff --git a/src/opcua/client/qopcuanode.cpp b/src/opcua/client/qopcuanode.cpp index afe00f7..0fe14c2 100644 --- a/src/opcua/client/qopcuanode.cpp +++ b/src/opcua/client/qopcuanode.cpp @@ -346,6 +346,8 @@ QVariant QOpcUaNode::value() const The error code is only valid after the \l attributeRead or \l attributeWritten signal has been emitted. + If there is no entry in the attribute cache, \l {QOpcUa::UaStatusCode} {BadNoEntryExists} is returned. + \sa QOpcUa::errorCategory */ QOpcUa::UaStatusCode QOpcUaNode::attributeError(QOpcUa::NodeAttribute attribute) const @@ -353,7 +355,7 @@ QOpcUa::UaStatusCode QOpcUaNode::attributeError(QOpcUa::NodeAttribute attribute) Q_D(const QOpcUaNode); auto it = d->m_nodeAttributes.constFind(attribute); if (it == d->m_nodeAttributes.constEnd()) - return QOpcUa::UaStatusCode::BadNotFound; + return QOpcUa::UaStatusCode::BadNoEntryExists; return it->statusCode(); } @@ -361,7 +363,7 @@ QOpcUa::UaStatusCode QOpcUaNode::attributeError(QOpcUa::NodeAttribute attribute) /*! Returns the error code for the node's Value attribute. The status code \l {QOpcUa::UaStatusCode} {Good} indicates a valid return value for \l value(). - If there is no value in the attribute cache, \l {QOpcUa::UaStatusCode} {BadNotFound} is returned. + If there is no entry in the attribute cache, \l {QOpcUa::UaStatusCode} {BadNoEntryExists} is returned. */ QOpcUa::UaStatusCode QOpcUaNode::valueAttributeError() const { @@ -449,7 +451,9 @@ bool QOpcUaNode::modifyMonitoring(QOpcUa::NodeAttribute attr, QOpcUaMonitoringPa /*! Returns the monitoring parameters associated with the attribute \a attr. This can be used to check the success of \l enableMonitoring() or if parameters have been revised. - The returned values are only valid after \l enableMonitoringFinished or \l monitoringStatusChanged have been emitted for \a attr. + The returned values are only valid after \l enableMonitoringFinished or \l monitoringStatusChanged have been emitted + for \a attr. If the status is queried before a signal has been emitted, \l QOpcUaMonitoringParameters::statusCode() + returns \l {QOpcUa::UaStatusCode} {BadNoEntryExists}. */ QOpcUaMonitoringParameters QOpcUaNode::monitoringStatus(QOpcUa::NodeAttribute attr) { @@ -457,7 +461,7 @@ QOpcUaMonitoringParameters QOpcUaNode::monitoringStatus(QOpcUa::NodeAttribute at auto it = d->m_monitoringStatus.constFind(attr); if (it == d->m_monitoringStatus.constEnd()) { QOpcUaMonitoringParameters p; - p.setStatusCode(QOpcUa::UaStatusCode::BadAttributeIdInvalid); + p.setStatusCode(QOpcUa::UaStatusCode::BadNoEntryExists); return p; } |