dOPC Client Toolkit
Close
ua.client.uaCopyExtensionObject

Copies a extension object to a TuaObj object.

procedure uaCopyExtensionObject(Destination: TuaObj; Source: uaExtensionObject);
uaCopyExtensionObject(TuaObj Destination, uaExtensionObject Source);

In OPC UA structures are stored in extension objects. With uaCopyExtensionObject you can copy such extension objects to a "well-formed" TuaObj object. You will find the most UA structures (e.g. uaServerStatusDataType) in unit ua.datatypes.

program dOPUACTest; uses sysutils, ua.client, ua.datatypes, ua.buildintypes; var OPCClient: TdOPCUAClient; DataValue : uaDataValue; ServerStatus : uaServerStatusDataType; begin OPCClient := TdOPCUAClient.Create(nil); OPCClient.Url := 'opc.tcp://opcuaserver.com:48010'; OPCClient.Active := true; DataValue := OPCClient.ReadNodeAttribute('ns=0;i=2256',TuaAttributes.Value); if DataValue.Value.IsExtensionObject then begin ServerStatus := uaServerStatusDataType.Create; uaCopyExtensionObject(ServerStatus,DataValue); Writeln('State : '+ ServerStatus.State.ToString); Writeln('Start time : '+ ServerStatus.StartTime.ToString); Writeln('Server Uri : '+ ServerStatus.BuildInfo.ProductUri); Writeln('Manufacturer name: '+ ServerStatus.BuildInfo.ManufacturerName); Writeln('Product name : '+ ServerStatus.BuildInfo.ProductName); Writeln('Software version : '+ ServerStatus.BuildInfo.SoftwareVersion); ServerStatus.Free; end else Writeln('node is not a extension Object'); Writeln(''); Writeln('Press Enter to exit'); Readln; DataValue.Free; OPCClient.Free; end.
Kassl GmbH Copyright © 2024. All rights reserved.