diff options
Diffstat (limited to 'src/plugins/opcua/open62541/qopen62541node.cpp')
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541node.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/plugins/opcua/open62541/qopen62541node.cpp b/src/plugins/opcua/open62541/qopen62541node.cpp index 9285eba..868c36a 100644 --- a/src/plugins/opcua/open62541/qopen62541node.cpp +++ b/src/plugins/opcua/open62541/qopen62541node.cpp @@ -64,6 +64,9 @@ QOpen62541Node::~QOpen62541Node() bool QOpen62541Node::readAttributes(QOpcUa::NodeAttributes attr, const QString &indexRange) { + if (!m_client) + return false; + UA_NodeId tempId; UA_NodeId_copy(&m_nodeId, &tempId); return QMetaObject::invokeMethod(m_client->m_backend, "readAttributes", @@ -76,6 +79,9 @@ bool QOpen62541Node::readAttributes(QOpcUa::NodeAttributes attr, const QString & bool QOpen62541Node::enableMonitoring(QOpcUa::NodeAttributes attr, const QOpcUaMonitoringParameters &settings) { + if (!m_client) + return false; + UA_NodeId tempId; UA_NodeId_copy(&m_nodeId, &tempId); return QMetaObject::invokeMethod(m_client->m_backend, "enableMonitoring", @@ -88,6 +94,9 @@ bool QOpen62541Node::enableMonitoring(QOpcUa::NodeAttributes attr, const QOpcUaM bool QOpen62541Node::disableMonitoring(QOpcUa::NodeAttributes attr) { + if (!m_client) + return false; + return QMetaObject::invokeMethod(m_client->m_backend, "disableMonitoring", Qt::QueuedConnection, Q_ARG(uintptr_t, reinterpret_cast<uintptr_t>(this)), @@ -96,6 +105,9 @@ bool QOpen62541Node::disableMonitoring(QOpcUa::NodeAttributes attr) bool QOpen62541Node::modifyMonitoring(QOpcUa::NodeAttribute attr, QOpcUaMonitoringParameters::Parameter item, const QVariant &value) { + if (!m_client) + return false; + return QMetaObject::invokeMethod(m_client->m_backend, "modifyMonitoring", Qt::QueuedConnection, Q_ARG(uintptr_t, reinterpret_cast<uintptr_t>(this)), @@ -111,6 +123,9 @@ QString QOpen62541Node::nodeId() const bool QOpen62541Node::browseChildren(QOpcUa::ReferenceTypeId referenceType, QOpcUa::NodeClasses nodeClassMask) { + if (!m_client) + return false; + UA_NodeId tempId; UA_NodeId_copy(&m_nodeId, &tempId); return QMetaObject::invokeMethod(m_client->m_backend, "browseChildren", @@ -123,6 +138,9 @@ bool QOpen62541Node::browseChildren(QOpcUa::ReferenceTypeId referenceType, QOpcU bool QOpen62541Node::writeAttribute(QOpcUa::NodeAttribute attribute, const QVariant &value, QOpcUa::Types type, const QString &indexRange) { + if (!m_client) + return false; + UA_NodeId tempId; UA_NodeId_copy(&m_nodeId, &tempId); return QMetaObject::invokeMethod(m_client->m_backend, "writeAttribute", @@ -137,6 +155,9 @@ bool QOpen62541Node::writeAttribute(QOpcUa::NodeAttribute attribute, const QVari bool QOpen62541Node::writeAttributes(const QOpcUaNode::AttributeMap &toWrite, QOpcUa::Types valueAttributeType) { + if (!m_client) + return false; + UA_NodeId tempId; UA_NodeId_copy(&m_nodeId, &tempId); return QMetaObject::invokeMethod(m_client->m_backend, "writeAttributes", @@ -149,6 +170,9 @@ bool QOpen62541Node::writeAttributes(const QOpcUaNode::AttributeMap &toWrite, QO bool QOpen62541Node::callMethod(const QString &methodNodeId, const QVector<QOpcUa::TypedVariant> &args) { + if (!m_client) + return false; + UA_NodeId obj; UA_NodeId_copy(&m_nodeId, &obj); return QMetaObject::invokeMethod(m_client->m_backend, "callMethod", |