dOPC Client Toolkit
Close
ua.client.TdOPCUAClient.ReadNodeAttribute

Reads one Attribute of one Node.

function ReadNodeAttribute(NodeId: string; Attribute: integer; TimestampsToReturn: integer = uaTimestampsToReturn.Neither): uaDataValue;
__fastcall uaDataValue ReadNodeAttribute(AnsiString NodeId, int Attribute, int TimestampsToReturn = uaTimestampsToReturn.Neither);

This method can be used to read one Attribute of one Node. It returns a uaDataValue.

Parameter
Description
NodeId
The Node you want the attribute for.
Attributes
Defines which attributes we want to read. For further information look also at: TuaAttributes
TimestampsToReturn
Defines which timestamps you want to return (look also at: uaTimestampsToReturn) Default is Neither, which means the method returns no timestamps.
Result
uaDataValue (contains Value, Servertimestamp, Sourcetimestamp and Quality)
program dOPUACTest; uses variants, sysutils, ua.client, ua.datatypes, ua.buildintypes; var OPCClient: TdOPCUAClient; DataValue : uaDatavalue; begin OPCClient := TdOPCUAClient.Create(nil); OPCClient.Url := 'opc.tcp://opcuaserver.com:48010'; OPCClient.Active := true; DataValue := OPCClient.ReadNodeAttribute('i=2259', TuaAttributes.Value,uaTimestampsToReturn.Both); Writeln('Value : ' + VarToStr(DataValue.ValueToVariant)); Writeln('Source Time : ' + TimeToStr(DataValue.SourceTimestamp)); Writeln('Server Time : ' + TimeToStr(DataValue.ServerTimestamp)); Writeln('Quality : ' + DataValue.StatusCode.ToQualityString); DataValue.Free; Writeln('Press Enter to exit'); Readln; OPCClient.Free; end.
Kassl GmbH Copyright © 2021. All rights reserved.