Reputation: 61
Can anyone tell me the syntax for multiple node read in single request to server in open62541.
i have been doing a single read request by
UA_Client_readValueAttribute(client, UA_NODEID_STRING(1, "variable"), &value)
from the open62541 client to server.
Upvotes: 5
Views: 3009
Reputation: 6856
You can use the standard read service:
UA_Client_Service_read(UA_Client *client, const UA_ReadRequest request)
E.g.:
UA_ReadRequest request;
UA_ReadRequest_init(&request);
UA_ReadValueId ids[2];
UA_ReadValueId_init(&ids[0]);
ids[0].attributeId = UA_ATTRIBUTEID_VALUE;
ids[0].nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY);
UA_ReadValueId_init(&ids[1]);
ids[1].attributeId = UA_ATTRIBUTEID_VALUE;
ids[1].nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_STATUS);
// set here the nodes you want to read
request.nodesToRead = ids;
request.nodesToReadSize = 2;
UA_ReadResponse response = UA_Client_Service_read(client, request);
// do something with the response
Crosspost: https://github.com/open62541/open62541/issues/1426
Upvotes: 4