|
|
|
@ -0,0 +1,361 @@
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541.h b/src/plugins/opcua/open62541/qopen62541.h
|
|
|
|
|
index aed1262..a4f63df 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541.h
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541.h
|
|
|
|
|
@@ -11,6 +11,8 @@
|
|
|
|
|
#elif defined(__GNUC__) //includes mingw
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
|
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
|
|
|
|
+#pragma GCC diagnostic ignored "-Wmissing-braces"
|
|
|
|
|
#elif defined(__clang__)
|
|
|
|
|
#pragma clang diagnostic push
|
|
|
|
|
#pragma clang diagnostic ignored "-Wunused-parameter"
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541backend.cpp b/src/plugins/opcua/open62541/qopen62541backend.cpp
|
|
|
|
|
index f62ad6c..8714e7a 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541backend.cpp
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541backend.cpp
|
|
|
|
|
@@ -176,7 +176,7 @@ void Open62541AsyncBackend::writeAttributes(quint64 handle, UA_NodeId id, QOpcUa
|
|
|
|
|
|
|
|
|
|
void Open62541AsyncBackend::enableMonitoring(quint64 handle, UA_NodeId id, QOpcUa::NodeAttributes attr, const QOpcUaMonitoringParameters &settings)
|
|
|
|
|
{
|
|
|
|
|
- UaDeleter<UA_NodeId> nodeIdDeleter(&id, UA_NodeId_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_NodeId> nodeIdDeleter(&id, UA_NodeId_clear);
|
|
|
|
|
|
|
|
|
|
QOpen62541Subscription *usedSubscription = nullptr;
|
|
|
|
|
|
|
|
|
|
@@ -328,7 +328,7 @@ void Open62541AsyncBackend::resolveBrowsePath(quint64 handle, UA_NodeId startNod
|
|
|
|
|
UA_TranslateBrowsePathsToNodeIdsRequest req;
|
|
|
|
|
UA_TranslateBrowsePathsToNodeIdsRequest_init(&req);
|
|
|
|
|
UaDeleter<UA_TranslateBrowsePathsToNodeIdsRequest> requestDeleter(
|
|
|
|
|
- &req,UA_TranslateBrowsePathsToNodeIdsRequest_deleteMembers);
|
|
|
|
|
+ &req,UA_TranslateBrowsePathsToNodeIdsRequest_clear);
|
|
|
|
|
|
|
|
|
|
req.browsePathsSize = 1;
|
|
|
|
|
req.browsePaths = UA_BrowsePath_new();
|
|
|
|
|
@@ -466,7 +466,7 @@ void Open62541AsyncBackend::readNodeAttributes(const QList<QOpcUaReadItem> &node
|
|
|
|
|
|
|
|
|
|
UA_ReadRequest req;
|
|
|
|
|
UA_ReadRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_ReadRequest> requestDeleter(&req, UA_ReadRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_ReadRequest> requestDeleter(&req, UA_ReadRequest_clear);
|
|
|
|
|
|
|
|
|
|
req.nodesToReadSize = nodesToRead.size();
|
|
|
|
|
req.nodesToRead = static_cast<UA_ReadValueId *>(UA_Array_new(nodesToRead.size(), &UA_TYPES[UA_TYPES_READVALUEID]));
|
|
|
|
|
@@ -503,7 +503,7 @@ void Open62541AsyncBackend::writeNodeAttributes(const QList<QOpcUaWriteItem> &no
|
|
|
|
|
|
|
|
|
|
UA_WriteRequest req;
|
|
|
|
|
UA_WriteRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_WriteRequest> requestDeleter(&req, UA_WriteRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_WriteRequest> requestDeleter(&req, UA_WriteRequest_clear);
|
|
|
|
|
|
|
|
|
|
req.nodesToWriteSize = nodesToWrite.size();
|
|
|
|
|
req.nodesToWrite = static_cast<UA_WriteValue *>(UA_Array_new(nodesToWrite.size(), &UA_TYPES[UA_TYPES_WRITEVALUE]));
|
|
|
|
|
@@ -600,7 +600,7 @@ void Open62541AsyncBackend::addNode(const QOpcUaAddNodeItem &nodeToAdd)
|
|
|
|
|
{
|
|
|
|
|
UA_AddNodesRequest req;
|
|
|
|
|
UA_AddNodesRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_AddNodesRequest> requestDeleter(&req, UA_AddNodesRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_AddNodesRequest> requestDeleter(&req, UA_AddNodesRequest_clear);
|
|
|
|
|
req.nodesToAddSize = 1;
|
|
|
|
|
req.nodesToAdd = UA_AddNodesItem_new();
|
|
|
|
|
UA_AddNodesItem_init(req.nodesToAdd);
|
|
|
|
|
@@ -644,7 +644,7 @@ void Open62541AsyncBackend::deleteNode(const QString &nodeId, bool deleteTargetR
|
|
|
|
|
{
|
|
|
|
|
UA_DeleteNodesRequest request;
|
|
|
|
|
UA_DeleteNodesRequest_init(&request);
|
|
|
|
|
- UaDeleter<UA_DeleteNodesRequest> requestDeleter(&request, UA_DeleteNodesRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_DeleteNodesRequest> requestDeleter(&request, UA_DeleteNodesRequest_clear);
|
|
|
|
|
|
|
|
|
|
request.nodesToDeleteSize = 1;
|
|
|
|
|
request.nodesToDelete = UA_DeleteNodesItem_new();
|
|
|
|
|
@@ -673,7 +673,7 @@ void Open62541AsyncBackend::addReference(const QOpcUaAddReferenceItem &reference
|
|
|
|
|
{
|
|
|
|
|
UA_AddReferencesRequest request;
|
|
|
|
|
UA_AddReferencesRequest_init(&request);
|
|
|
|
|
- UaDeleter<UA_AddReferencesRequest> requestDeleter(&request, UA_AddReferencesRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_AddReferencesRequest> requestDeleter(&request, UA_AddReferencesRequest_clear);
|
|
|
|
|
|
|
|
|
|
request.referencesToAddSize = 1;
|
|
|
|
|
request.referencesToAdd = UA_AddReferencesItem_new();
|
|
|
|
|
@@ -712,7 +712,7 @@ void Open62541AsyncBackend::deleteReference(const QOpcUaDeleteReferenceItem &ref
|
|
|
|
|
{
|
|
|
|
|
UA_DeleteReferencesRequest request;
|
|
|
|
|
UA_DeleteReferencesRequest_init(&request);
|
|
|
|
|
- UaDeleter<UA_DeleteReferencesRequest> requestDeleter(&request, UA_DeleteReferencesRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_DeleteReferencesRequest> requestDeleter(&request, UA_DeleteReferencesRequest_clear);
|
|
|
|
|
|
|
|
|
|
request.referencesToDeleteSize = 1;
|
|
|
|
|
request.referencesToDelete = UA_DeleteReferencesItem_new();
|
|
|
|
|
@@ -810,10 +810,6 @@ void Open62541AsyncBackend::clientStateCallback(UA_Client *client,
|
|
|
|
|
|
|
|
|
|
// UA_Client_disconnect() must be called from outside this callback or open62541 will crash
|
|
|
|
|
backend->m_disconnectAfterStateChangeTimer.start();
|
|
|
|
|
-
|
|
|
|
|
- // Use a queued connection to make sure the subscription is not deleted if the callback was triggered
|
|
|
|
|
- // inside of one of its methods.
|
|
|
|
|
- QMetaObject::invokeMethod(backend, "cleanupSubscriptions", Qt::QueuedConnection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Open62541AsyncBackend::inactivityCallback(UA_Client *client)
|
|
|
|
|
@@ -875,7 +871,7 @@ void Open62541AsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &e
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- UaDeleter<UA_ByteString> clientCertDeleter(&localCertificate, &UA_ByteString_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_ByteString> clientCertDeleter(&localCertificate, &UA_ByteString_clear);
|
|
|
|
|
|
|
|
|
|
success = loadFileToByteString(pkiConfig.privateKeyFile(), &privateKey);
|
|
|
|
|
|
|
|
|
|
@@ -887,7 +883,7 @@ void Open62541AsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &e
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- UaDeleter<UA_ByteString> privateKeyDeleter(&privateKey, &UA_ByteString_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_ByteString> privateKeyDeleter(&privateKey, &UA_ByteString_clear);
|
|
|
|
|
|
|
|
|
|
success = loadAllFilesInDirectory(pkiConfig.trustListDirectory(), &trustList, &trustListSize);
|
|
|
|
|
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541client.cpp b/src/plugins/opcua/open62541/qopen62541client.cpp
|
|
|
|
|
index cecd9a4..d3e8863 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541client.cpp
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541client.cpp
|
|
|
|
|
@@ -163,6 +163,7 @@ QStringList QOpen62541Client::supportedSecurityPolicies() const
|
|
|
|
|
, "http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15"
|
|
|
|
|
, "http://opcfoundation.org/UA/SecurityPolicy#Basic256"
|
|
|
|
|
, "http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"
|
|
|
|
|
+ , "http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep"
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541node.cpp b/src/plugins/opcua/open62541/qopen62541node.cpp
|
|
|
|
|
index 9885959..cbfba03 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541node.cpp
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541node.cpp
|
|
|
|
|
@@ -29,7 +29,7 @@ QOpen62541Node::~QOpen62541Node()
|
|
|
|
|
if (m_client)
|
|
|
|
|
m_client->unregisterNode(this);
|
|
|
|
|
|
|
|
|
|
- UA_NodeId_deleteMembers(&m_nodeId);
|
|
|
|
|
+ UA_NodeId_clear(&m_nodeId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QOpen62541Node::readAttributes(QOpcUa::NodeAttributes attr, const QString &indexRange)
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541subscription.cpp b/src/plugins/opcua/open62541/qopen62541subscription.cpp
|
|
|
|
|
index 610596c..15fccb0 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541subscription.cpp
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541subscription.cpp
|
|
|
|
|
@@ -146,13 +146,13 @@ void QOpen62541Subscription::modifyMonitoring(quint64 handle, QOpcUa::NodeAttrib
|
|
|
|
|
|
|
|
|
|
UA_SetPublishingModeRequest req;
|
|
|
|
|
UA_SetPublishingModeRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_SetPublishingModeRequest> requestDeleter(&req, UA_SetPublishingModeRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_SetPublishingModeRequest> requestDeleter(&req, UA_SetPublishingModeRequest_clear);
|
|
|
|
|
req.publishingEnabled = value.toBool();
|
|
|
|
|
req.subscriptionIdsSize = 1;
|
|
|
|
|
req.subscriptionIds = UA_UInt32_new();
|
|
|
|
|
*req.subscriptionIds = m_subscriptionId;
|
|
|
|
|
UA_SetPublishingModeResponse res = UA_Client_Subscriptions_setPublishingMode(m_backend->m_uaclient, req);
|
|
|
|
|
- UaDeleter<UA_SetPublishingModeResponse> responseDeleter(&res, UA_SetPublishingModeResponse_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_SetPublishingModeResponse> responseDeleter(&res, UA_SetPublishingModeResponse_clear);
|
|
|
|
|
|
|
|
|
|
if (res.responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
|
|
|
|
|
qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Failed to set publishing mode:" << res.responseHeader.serviceResult;
|
|
|
|
|
@@ -181,14 +181,14 @@ void QOpen62541Subscription::modifyMonitoring(quint64 handle, QOpcUa::NodeAttrib
|
|
|
|
|
|
|
|
|
|
UA_SetMonitoringModeRequest req;
|
|
|
|
|
UA_SetMonitoringModeRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_SetMonitoringModeRequest> requestDeleter(&req, UA_SetMonitoringModeRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_SetMonitoringModeRequest> requestDeleter(&req, UA_SetMonitoringModeRequest_clear);
|
|
|
|
|
req.monitoringMode = static_cast<UA_MonitoringMode>(value.value<QOpcUaMonitoringParameters::MonitoringMode>());
|
|
|
|
|
req.monitoredItemIdsSize = 1;
|
|
|
|
|
req.monitoredItemIds = UA_UInt32_new();
|
|
|
|
|
*req.monitoredItemIds = monItem->monitoredItemId;
|
|
|
|
|
req.subscriptionId = m_subscriptionId;
|
|
|
|
|
UA_SetMonitoringModeResponse res = UA_Client_MonitoredItems_setMonitoringMode(m_backend->m_uaclient, req);
|
|
|
|
|
- UaDeleter<UA_SetMonitoringModeResponse> responseDeleter(&res, UA_SetMonitoringModeResponse_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_SetMonitoringModeResponse> responseDeleter(&res, UA_SetMonitoringModeResponse_clear);
|
|
|
|
|
|
|
|
|
|
if (res.responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
|
|
|
|
|
qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Failed to set monitoring mode:" << res.responseHeader.serviceResult;
|
|
|
|
|
@@ -219,7 +219,7 @@ bool QOpen62541Subscription::addAttributeMonitoredItem(quint64 handle, QOpcUa::N
|
|
|
|
|
{
|
|
|
|
|
UA_MonitoredItemCreateRequest req;
|
|
|
|
|
UA_MonitoredItemCreateRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_MonitoredItemCreateRequest> requestDeleter(&req, UA_MonitoredItemCreateRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_MonitoredItemCreateRequest> requestDeleter(&req, UA_MonitoredItemCreateRequest_clear);
|
|
|
|
|
req.itemToMonitor.attributeId = QOpen62541ValueConverter::toUaAttributeId(attr);
|
|
|
|
|
UA_NodeId_copy(&id, &(req.itemToMonitor.nodeId));
|
|
|
|
|
if (settings.indexRange().size())
|
|
|
|
|
@@ -244,7 +244,7 @@ bool QOpen62541Subscription::addAttributeMonitoredItem(quint64 handle, QOpcUa::N
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UA_MonitoredItemCreateResult res;
|
|
|
|
|
- UaDeleter<UA_MonitoredItemCreateResult> resultDeleter(&res, UA_MonitoredItemCreateResult_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_MonitoredItemCreateResult> resultDeleter(&res, UA_MonitoredItemCreateResult_clear);
|
|
|
|
|
|
|
|
|
|
if (attr == QOpcUa::NodeAttribute::EventNotifier && settings.filter().canConvert<QOpcUaMonitoringParameters::EventFilter>())
|
|
|
|
|
res = UA_Client_MonitoredItems_createEvent(m_backend->m_uaclient, m_subscriptionId,
|
|
|
|
|
@@ -436,7 +436,7 @@ void QOpen62541Subscription::createEventFilter(const QOpcUaMonitoringParameters:
|
|
|
|
|
|
|
|
|
|
convertSelectClause(filter, &uaFilter->selectClauses, &uaFilter->selectClausesSize);
|
|
|
|
|
if (!convertWhereClause(filter, &uaFilter->whereClause))
|
|
|
|
|
- UA_ExtensionObject_deleteMembers(out);
|
|
|
|
|
+ UA_ExtensionObject_clear(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QOpen62541Subscription::convertSelectClause(const QOpcUaMonitoringParameters::EventFilter &filter,
|
|
|
|
|
@@ -458,8 +458,9 @@ bool QOpen62541Subscription::convertSelectClause(const QOpcUaMonitoringParameter
|
|
|
|
|
QOpen62541ValueConverter::scalarFromQt<UA_QualifiedName, QOpcUaQualifiedName>(
|
|
|
|
|
filter.selectClauses().at(i).browsePath().at(j), &select[i].browsePath[j]);
|
|
|
|
|
}
|
|
|
|
|
- QOpen62541ValueConverter::scalarFromQt<UA_String, QString>(filter.selectClauses().at(i).indexRange(),
|
|
|
|
|
- &select[i].indexRange);
|
|
|
|
|
+ if (!filter.selectClauses().at(i).indexRange().isEmpty())
|
|
|
|
|
+ QOpen62541ValueConverter::scalarFromQt<UA_String, QString>(filter.selectClauses().at(i).indexRange(),
|
|
|
|
|
+ &select[i].indexRange);
|
|
|
|
|
select[i].attributeId = QOpen62541ValueConverter::toUaAttributeId(filter.selectClauses().at(i).attributeId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -548,7 +549,7 @@ bool QOpen62541Subscription::convertWhereClause(const QOpcUaMonitoringParameters
|
|
|
|
|
} else {
|
|
|
|
|
qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Unknown filter operand type for event filter" <<
|
|
|
|
|
filter.whereClause().at(i).filterOperands().at(j).typeName();
|
|
|
|
|
- UA_ContentFilter_deleteMembers(result);
|
|
|
|
|
+ UA_ContentFilter_clear(result);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -703,7 +704,7 @@ bool QOpen62541Subscription::modifyMonitoredItemParameters(quint64 nodeHandle, Q
|
|
|
|
|
|
|
|
|
|
UA_ModifyMonitoredItemsRequest req;
|
|
|
|
|
UA_ModifyMonitoredItemsRequest_init(&req);
|
|
|
|
|
- UaDeleter<UA_ModifyMonitoredItemsRequest> requestDeleter(&req, UA_ModifyMonitoredItemsRequest_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_ModifyMonitoredItemsRequest> requestDeleter(&req, UA_ModifyMonitoredItemsRequest_clear);
|
|
|
|
|
req.subscriptionId = m_subscriptionId;
|
|
|
|
|
req.itemsToModifySize = 1;
|
|
|
|
|
req.itemsToModify = UA_MonitoredItemModifyRequest_new();
|
|
|
|
|
@@ -780,7 +781,7 @@ bool QOpen62541Subscription::modifyMonitoredItemParameters(quint64 nodeHandle, Q
|
|
|
|
|
|
|
|
|
|
UA_ModifyMonitoredItemsResponse res = UA_Client_MonitoredItems_modify(m_backend->m_uaclient, req);
|
|
|
|
|
UaDeleter<UA_ModifyMonitoredItemsResponse> responseDeleter(
|
|
|
|
|
- &res, UA_ModifyMonitoredItemsResponse_deleteMembers);
|
|
|
|
|
+ &res, UA_ModifyMonitoredItemsResponse_clear);
|
|
|
|
|
|
|
|
|
|
if (res.responseHeader.serviceResult != UA_STATUSCODE_GOOD || res.results[0].statusCode != UA_STATUSCODE_GOOD) {
|
|
|
|
|
p.setStatusCode(static_cast<QOpcUa::UaStatusCode>(res.responseHeader.serviceResult == UA_STATUSCODE_GOOD ? res.results[0].statusCode : res.responseHeader.serviceResult));
|
|
|
|
|
diff --git a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp
|
|
|
|
|
index 5a8562c..61a504a 100644
|
|
|
|
|
--- a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp
|
|
|
|
|
+++ b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp
|
|
|
|
|
@@ -124,69 +124,67 @@ QVariant toQVariant(const UA_Variant &value)
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- switch (value.type->typeIndex) {
|
|
|
|
|
- case UA_TYPES_BOOLEAN:
|
|
|
|
|
+ if (value.type == &UA_TYPES[UA_TYPES_BOOLEAN])
|
|
|
|
|
return arrayToQVariant<bool, UA_Boolean>(value, QMetaType::Bool);
|
|
|
|
|
- case UA_TYPES_SBYTE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_SBYTE])
|
|
|
|
|
return arrayToQVariant<signed char, UA_SByte>(value, QMetaType::SChar);
|
|
|
|
|
- case UA_TYPES_BYTE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_BYTE])
|
|
|
|
|
return arrayToQVariant<uchar, UA_Byte>(value, QMetaType::UChar);
|
|
|
|
|
- case UA_TYPES_INT16:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_INT16])
|
|
|
|
|
return arrayToQVariant<qint16, UA_Int16>(value, QMetaType::Short);
|
|
|
|
|
- case UA_TYPES_UINT16:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_UINT16])
|
|
|
|
|
return arrayToQVariant<quint16, UA_UInt16>(value, QMetaType::UShort);
|
|
|
|
|
- case UA_TYPES_INT32:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_INT32])
|
|
|
|
|
return arrayToQVariant<qint32, UA_Int32>(value, QMetaType::Int);
|
|
|
|
|
- case UA_TYPES_UINT32:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_UINT32])
|
|
|
|
|
return arrayToQVariant<quint32, UA_UInt32>(value, QMetaType::UInt);
|
|
|
|
|
- case UA_TYPES_INT64:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_INT64])
|
|
|
|
|
return arrayToQVariant<int64_t, UA_Int64>(value, QMetaType::LongLong);
|
|
|
|
|
- case UA_TYPES_UINT64:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_UINT64])
|
|
|
|
|
return arrayToQVariant<uint64_t, UA_UInt64>(value, QMetaType::ULongLong);
|
|
|
|
|
- case UA_TYPES_FLOAT:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_FLOAT])
|
|
|
|
|
return arrayToQVariant<float, UA_Float>(value, QMetaType::Float);
|
|
|
|
|
- case UA_TYPES_DOUBLE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_DOUBLE])
|
|
|
|
|
return arrayToQVariant<double, UA_Double>(value, QMetaType::Double);
|
|
|
|
|
- case UA_TYPES_STRING:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_STRING])
|
|
|
|
|
return arrayToQVariant<QString, UA_String>(value, QMetaType::QString);
|
|
|
|
|
- case UA_TYPES_BYTESTRING:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_BYTESTRING])
|
|
|
|
|
return arrayToQVariant<QByteArray, UA_ByteString>(value, QMetaType::QByteArray);
|
|
|
|
|
- case UA_TYPES_LOCALIZEDTEXT:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_LOCALIZEDTEXT])
|
|
|
|
|
return arrayToQVariant<QOpcUaLocalizedText, UA_LocalizedText>(value);
|
|
|
|
|
- case UA_TYPES_NODEID:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_NODEID])
|
|
|
|
|
return arrayToQVariant<QString, UA_NodeId>(value, QMetaType::QString);
|
|
|
|
|
- case UA_TYPES_DATETIME:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_DATETIME])
|
|
|
|
|
return arrayToQVariant<QDateTime, UA_DateTime>(value, QMetaType::QDateTime);
|
|
|
|
|
- case UA_TYPES_GUID:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_GUID])
|
|
|
|
|
return arrayToQVariant<QUuid, UA_Guid>(value, QMetaType::QUuid);
|
|
|
|
|
- case UA_TYPES_XMLELEMENT:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_XMLELEMENT])
|
|
|
|
|
return arrayToQVariant<QString, UA_XmlElement>(value, QMetaType::QString);
|
|
|
|
|
- case UA_TYPES_QUALIFIEDNAME:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_QUALIFIEDNAME])
|
|
|
|
|
return arrayToQVariant<QOpcUaQualifiedName, UA_QualifiedName>(value);
|
|
|
|
|
- case UA_TYPES_STATUSCODE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_STATUSCODE])
|
|
|
|
|
return arrayToQVariant<QOpcUa::UaStatusCode, UA_StatusCode>(value, QMetaType::UInt);
|
|
|
|
|
- case UA_TYPES_EXTENSIONOBJECT:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_EXTENSIONOBJECT])
|
|
|
|
|
return arrayToQVariant<QVariant, UA_ExtensionObject>(value);
|
|
|
|
|
- case UA_TYPES_EXPANDEDNODEID:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_EXPANDEDNODEID])
|
|
|
|
|
return arrayToQVariant<QOpcUaExpandedNodeId, UA_ExpandedNodeId>(value);
|
|
|
|
|
- case UA_TYPES_ARGUMENT:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_ARGUMENT])
|
|
|
|
|
return arrayToQVariant<QOpcUaArgument, UA_Argument>(value);
|
|
|
|
|
- case UA_TYPES_RANGE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_RANGE])
|
|
|
|
|
return arrayToQVariant<QOpcUaRange, UA_Range>(value);
|
|
|
|
|
- case UA_TYPES_EUINFORMATION:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_EUINFORMATION])
|
|
|
|
|
return arrayToQVariant<QOpcUaEUInformation, UA_EUInformation>(value);
|
|
|
|
|
- case UA_TYPES_AXISINFORMATION:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_AXISINFORMATION])
|
|
|
|
|
return arrayToQVariant<QOpcUaAxisInformation, UA_AxisInformation>(value);
|
|
|
|
|
- case UA_TYPES_COMPLEXNUMBERTYPE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_COMPLEXNUMBERTYPE])
|
|
|
|
|
return arrayToQVariant<QOpcUaComplexNumber, UA_ComplexNumberType>(value);
|
|
|
|
|
- case UA_TYPES_DOUBLECOMPLEXNUMBERTYPE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_DOUBLECOMPLEXNUMBERTYPE])
|
|
|
|
|
return arrayToQVariant<QOpcUaDoubleComplexNumber, UA_DoubleComplexNumberType>(value);
|
|
|
|
|
- case UA_TYPES_XVTYPE:
|
|
|
|
|
+ else if (value.type == &UA_TYPES[UA_TYPES_XVTYPE])
|
|
|
|
|
return arrayToQVariant<QOpcUaXValue, UA_XVType>(value);
|
|
|
|
|
- default:
|
|
|
|
|
- qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Variant conversion from Open62541 for typeName" << value.type->typeName << " not implemented";
|
|
|
|
|
- return QVariant();
|
|
|
|
|
- }
|
|
|
|
|
+
|
|
|
|
|
+ qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Variant conversion from Open62541 for typeName" << value.type->typeName << " not implemented";
|
|
|
|
|
+ return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UA_DataType *toDataType(QOpcUa::Types valueType)
|
|
|
|
|
@@ -672,7 +670,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUaExtensionObject>(const QOpcUaExtensi
|
|
|
|
|
{
|
|
|
|
|
QByteArray temp = obj.encodedBody();
|
|
|
|
|
UA_NodeId encodingId = Open62541Utils::nodeIdFromQString(obj.encodingTypeId());
|
|
|
|
|
- UaDeleter<UA_NodeId> nodeIdDeleter(&encodingId, UA_NodeId_deleteMembers);
|
|
|
|
|
+ UaDeleter<UA_NodeId> nodeIdDeleter(&encodingId, UA_NodeId_clear);
|
|
|
|
|
createExtensionObject(temp, encodingId, ptr, obj.encoding());
|
|
|
|
|
}
|
|
|
|
|
|