var
i:Integer;
retval: UA_StatusCode;
Request: UA_ReadRequest;
Response: UA_ReadResponse;
ids: Array[0..2] of UA_ReadValueId;
res: UA_DataValue;
outValue: String;
begin
Result:=UA_STATUSCODE_GOOD;
try
UA_ReadRequest_init(Request);
try
ids[0].attributeId := ord(UA_ATTRIBUTEID_VALUE); // 13
ids[0].nodeId := UA_NODEID_NUMERIC(5, 6024); // Custom node on the server
ids[1].attributeId := ord(UA_ATTRIBUTEID_VALUE); // 13
ids[1].nodeId := UA_NODEID_NUMERIC(5, 6025); // Custom node on the server
ids[2].attributeId := ord(UA_ATTRIBUTEID_VALUE); // 13
ids[2].nodeId := UA_NODEID_NUMERIC(5, 6026); // Custom node on the server
UA_ReadValueId_init(ids[0]);
Request.nodesToRead[0].nodeId:= ids[0].nodeId;
Request.nodesToRead[0].attributeId:=ids[0].attributeId;
UA_ReadValueId_init(ids[1]);
Request.nodesToRead[1].nodeId:= ids[1].nodeId;
Request.nodesToRead[1].attributeId:=ids[1].attributeId;
UA_ReadValueId_init(ids[2]);
Request.nodesToRead[2].nodeId:= ids[2].nodeId;
Request.nodesToRead[2].attributeId:=ids[2].attributeId;
Request.nodesToRead:=@ids[0];
Request.nodesToReadSize:=3;
Response:=UA_Client_Service_read(client, Request);
retval:=Response.responseHeader.serviceResult;
if retval=UA_STATUSCODE_GOOD then
if Response.resultsSize<>3 then
begin
UA_clear(@Response, @UA_TYPES[UA_TYPES_READRESPONSE]);
Result:=UA_STATUSCODE_BADUNEXPECTEDERROR;
Exit;
end;
for i:=0 to 2 do
begin
outValue:='';
if Response.results[i].status<>UA_STATUSCODE_GOOD
then continue;
res := Response.results[i];
(* if Not res.hasvalue then
begin
valueItems.Append('');
break;
end; *)
if res.value._type=@UA_TYPES[UA_TYPES_INT32] then
outValue:=IntToStr(UA_Variant_getInteger(res.value))
else
if res.value._type=@UA_TYPES[UA_TYPES_INT16] then
outValue:=IntToStr(UA_Variant_getSmallint(res.value))
else
if res.value._type=@UA_TYPES[UA_TYPES_DOUBLE] then
outValue:=UA_Variant_getDouble(res.value).ToString;
valueItems.Append(outValue);
end;
except
//
end;
finally
UA_clear(@Response, @UA_TYPES[UA_TYPES_READRESPONSE]);
end;
end;