谁能告诉我在 open62541 中对服务器的单个请求中多节点读取 的语法。
我一直在做一个读取请求
UA_Client_readValueAttribute(client, UA_NODEID_STRING(1, "variable"), &value)
从 open62541 客户端到服务器。
最佳答案
您可以使用标准读取服务:
UA_Client_Service_read(UA_Client *client, const UA_ReadRequest request)
例如:
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
关于c - 多个节点在 open62541 中读取来自客户端的单个请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47591339/