From c3f21597ede19ae2b105a114773698052b83e46c Mon Sep 17 00:00:00 2001 From: Jannis Voelker Date: Fri, 23 Mar 2018 14:17:11 +0100 Subject: Use valueAttributeType in writeAttributes() in uacpp The uacpp backend does not use the valueAttributeType parameter in the backend which can lead to invalid conversions for some types. Change-Id: I89f8aec534e3f8cc212bf11cac32925fb89321b0 Reviewed-by: Maurice Kalinowski Reviewed-by: Frank Meerkoetter --- src/plugins/opcua/uacpp/quacppbackend.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/opcua/uacpp/quacppbackend.cpp b/src/plugins/opcua/uacpp/quacppbackend.cpp index 4f47c8a..bb5516c 100644 --- a/src/plugins/opcua/uacpp/quacppbackend.cpp +++ b/src/plugins/opcua/uacpp/quacppbackend.cpp @@ -303,7 +303,7 @@ void UACppAsyncBackend::writeAttribute(uintptr_t handle, const UaNodeId &id, QOp static_cast(writeResults[0]) : static_cast(result.statusCode())); } -void UACppAsyncBackend::writeAttributes(uintptr_t handle, const UaNodeId &id, QOpcUaNode::AttributeMap toWrite, QOpcUa::Types /*valueAttributeType*/) +void UACppAsyncBackend::writeAttributes(uintptr_t handle, const UaNodeId &id, QOpcUaNode::AttributeMap toWrite, QOpcUa::Types valueAttributeType) { if (toWrite.size() == 0) { qCWarning(QT_OPCUA_PLUGINS_UACPP, "No values to be written"); @@ -322,6 +322,8 @@ void UACppAsyncBackend::writeAttributes(uintptr_t handle, const UaNodeId &id, QO for (auto it = toWrite.constBegin(); it != toWrite.constEnd(); ++it, ++index) { id.copyTo(&nodesToWrite[index].NodeId); QOpcUa::Types type = attributeIdToTypeId(it.key()); + if (type == QOpcUa::Types::Undefined) + type = valueAttributeType; nodesToWrite[index].AttributeId = QUACppValueConverter::toUaAttributeId(it.key()); nodesToWrite[index].Value.Value = QUACppValueConverter::toUACppVariant(it.value(), type); } -- cgit v1.2.3