dOPC Client Toolkit
Close
ua.client.TdOPCUAClient.WriteNodeAttribute

Writes one Attribute of one Node.

function WriteNodeAttribute(NodeId: string; Attribute: integer; Value: uaVariant): uaStatuscode; overload;
__fastcall uaStatuscode WriteNodeAttribute(AnsiString NodeId, int Attribute, uaVariant Value);

This method can be used to write one Attribute of one Node. It returns a uaStatuscode.

Parameter
Description
NodeId
The Node Id as string you want to write.
Attribute
Defines which attribute you want to write. For further information look also at: TuaAttributes
Value
Defines the value you want to write, see also example below.
Result
returns a uaStatuscode (look also at: uaStatusCodeToString)
program Project11; {$APPTYPE CONSOLE} {$R *.res} uses ua.client, ua.buildintypes, ua.statuscodes; var OPCClient: TdOPCUAClient; WriteVal : uaVariant; Ret : uaStatuscode; SetVal : uaInt32; begin OPCClient := TdOPCUAClient.Create(nil); OPCClient.Url := 'opc.tcp://opcuaserver.com:48010'; OPCClient.Active := true; SetVal := 36; WriteVal := uaVariant.Create(SetVal); Ret := OPCClient.WriteNodeAttribute('ns=2;s=Demo.Static.Scalar.Int32', TuaAttributes.Value, WriteVal); if not Ret.IsGood then writeln('Error write node:', Statuscodes.ToString(Ret)) else writeln('Succesfully written :-)'); WriteVal.Free; Writeln('Press Enter to exit'); Readln; OPCClient.Free; end.
Kassl GmbH Copyright © 2024. All rights reserved.