diff options
author | Jannis Voelker <jannis.voelker@basyskom.com> | 2018-03-23 14:17:11 +0100 |
---|---|---|
committer | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2018-04-05 18:12:28 +0000 |
commit | c3f21597ede19ae2b105a114773698052b83e46c (patch) | |
tree | 08c9c068eea29221705f719fd18692a0b32c29b3 | |
parent | 39657dc15542f292e707869307fb2d86df7bd780 (diff) |
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 <maurice.kalinowski@qt.io>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r-- | src/plugins/opcua/uacpp/quacppbackend.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<QOpcUa::UaStatusCode>(writeResults[0]) : static_cast<QOpcUa::UaStatusCode>(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); } |