hi ,
I use open62541 as ua client.It's good to read/write to one dimension array with specified indexrange. As to multi-dimensions array. reading one element with specified index range is ok , but write is failed. I want to write one element instead of complete array to multi-dimension array . My test code is the following:
UA_WriteRequest wReq;
UA_WriteRequest_init(&wReq);
QString strAddr,strindexRange;
wReq.nodesToWrite = new UA_WriteValue[1];// write one element of multi-dimension array
wReq.nodesToWriteSize =1;
strindexRange = "2,3";// definition of array is arrVar[13,4], write element "2,3"
UA_NodeId writeArrIndexTag = UA_NODEID_STRING_ALLOC(m_namesapce, "arrVar");//node id
wReq.nodesToWrite[0].indexRange = UA_String_fromChars(strindexRange.toUtf8());
wReq.nodesToWrite[0].nodeId = writeArrIndexTag;
wReq.nodesToWrite[0].attributeId = UA_ATTRIBUTEID_VALUE;
wReq.nodesToWrite[0].value.hasValue = true;
wReq.nodesToWrite[0].value.value.storageType = UA_VARIANT_DATA;
//value
UA_Int16 data = 100;
UA_Variant_setArray(&wReq.nodesToWrite[0].value.value, &data, 1, &UA_TYPES[UA_TYPES_INT16]);
//write service
UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
Please help me if having another way to write one element of multi-dimension array. Appreciate it. Thanks a lot. Wish your reply.