Go to last post Go to first unread
Offline laoguai  
#1 Posted : Friday, June 18, 2021 1:45:48 AM(UTC)

Rank: Newbie

Joined: 6/17/2021(UTC)
Posts: 1

Was thanked: 1 time(s) in 1 post(s)
Excuse me, I want to write part value to an array node, for example, after write 1,1,1 to a int32_t[10] node, the node value changed to [1,1,1,0,0,0,0,0,0,0]

I change the ClientExample code as bleow , the question is i can write the first element for the array node, when count > 1, receive error "[Error: Read] The

operation timed out Status Code:0x800a000". Who can tell me what's the problem? Thank you!!
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< code start <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Status_t ClientConsole_t::WriteNumber(IntrusivePtr_t<IClientSession_t> &session,
IntrusivePtr_t<NodeId_t> &write_node,
uint32_t dataTypeId,
uint16_t &write_value)
IntrusivePtr_t<WriteRequest_t> writeRequest = new SafeRefCount_t<WriteRequest_t>();
IntrusivePtr_t<WriteResponse_t> writeResponse;

status = writeRequest->NodesToWrite().Initialise(1);

ArrayUA_t<WriteValue_t> &nodesToWrite = writeRequest->NodesToWrite();

nodesToWrite[0] = new SafeRefCount_t<WriteValue_t>();
nodesToWrite[0]->AttributeId() = AttributeId_t::ATTRIBUTE_ID_VALUE;
nodesToWrite[0]->NodeId() = write_node;
nodesToWrite[0]->DataValue() = new SafeRefCount_t<DataValue_t>();

IntrusivePtr_t<ArrayUA_t<Int32_t>> valueArray = new SafeRefCount_t<ArrayUA_t<Int32_t>>();
//***** count =1 can write the first elment of the array node, when count > 1 receive error and can't write any element..******
int count = 2;
for (int i = 0; i < count; i++)
IntrusivePtr_t<Int32_t> num = new SafeRefCount_t<Int32_t>();
//for test every element is the same value
*num = (int32_t)write_value;
(*valueArray)[i++] = num;

nodesToWrite[0]->DataValue()->Value() = valueArray;

status = session->Write(writeRequest, writeResponse);



//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> code end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Edited by user Friday, June 18, 2021 2:01:50 AM(UTC)  | Reason: Not specified

thanks 1 user thanked laoguai for this useful post.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Matrikon Subscribe  |   Matrikon Unsubscribe  |   Global Unsubscribe  |   Privacy Statement  |   Do Not Sell My Personal Information   |   Cookie Notice