dOPC Client Toolkit

Checks a given status code.

procedure CheckStatusCode(StatusCode: uaStatusCode);
__fastcall CheckStatusCode(uaStatusCode StatusCode);

Checks the status code e.g. from a OPC UA service call, and raise an exception with a error message.

this function is more for internal use.

function uaReadAttribute(uaClient: TdOPCUAClient; NodeId: string; Attribute: integer ): variant; var S: uaRead; ReadNode: uaReadValueId; DataValue: uaDataValue; begin S := uaRead.Create(uaClient); try S.Request.NodesToRead_Setlength(1); ReadNode := uaReadValueId.Create; ReadNode.NodeId := uaStrToNodeId(NodeId); ReadNode.AttributeId := Attribute; // we want to read a special attribute S.Request.NodesToRead[0] := ReadNode; S.Run; DataValue := S.Response.Results[0]; uaClient.CheckStatusCode(DataValue.StatusCode); // if status code is not ok raise an exception result := DataValue.Value.ToVariant; finally S.Free; end; end;
Kassl GmbH Copyright © 2024. All rights reserved.