Hi,

I'm trying to make OPC UA client to write a value in an array in OPC UA server, with no success. Below the test code I'm using. For non-array values it works fine

Qt Code:
  1. QString nodeType = "double";
  2. QString nodeValue = "1";
  3. QString nodename = "ns=6;s=::ExValues:sensors.speed.sensorArray[0]";
  4. //QString nodename = "ns=6;s=::ExValues:sensors.speed.sensorAverage"; //for non-array values it works fine
  5.  
  6.  
  7. const auto type = QVariant::nameToType(nodeType.toLatin1().constData());
  8.  
  9. if(type == QVariant::Type::Invalid) {
  10. qCritical() << "Invalid node type";
  11. return;
  12. }
  13. QVariant value(nodeValue);
  14.  
  15. qDebug() << value << " with nodeValue: " << nodeValue;
  16. if(!value.convert(type)) {
  17. qCritical() << "Value cannot be presented as given type " << nodeType;
  18. return;
  19. }
  20. const auto node = std::unique_ptr<QOpcUaNode>(mClient->node(nodename));
  21. if(!node) {
  22. qCritical() << "No such node";
  23. return;
  24. }
  25. QEventLoop loop;
  26. QObject::connect(node.get(), &QOpcUaNode::attributeWritten, [&loop](QOpcUa::NodeAttributes) {
  27. loop.quit();
  28. });
  29.  
  30. node->writeValueAttribute(value);
  31. loop.exec();
To copy to clipboard, switch view to plain text mode 


I have also tried to make nodeValue as a QStringList or QOpcUaMultiDimensionalArray, and used different combinations of QVariant and OPC UA node types, but the values just won't change.

Could anyone help me?

I'm using Qt5.15 MSVC2019 64bit
with Qt OPC UA Open62541 Plugin
OS: Windows 10