dOPC Client Toolkit
Close
ua.client.TdOPCUAClient.GetNamespaceIndex

Gets the Namespace Index for the given Namespace Uri.

function GetNamespaceIndex(NameSpaceUri: string): integer;
__fastcall int GetNamespaceIndex(AnsiString NameSpaceUri);

Gets the NamespaceIndex for the given NamespaceUri. This method reads the NameSpaceArray (2255) variable from the OPC UA server. If the variable not exists or the NamespaceURI not exists in the array the function returns -1 otherwise the NamespaceIndex.

procedure TTestForm.Button1Click(Sender: TObject); var UAClient : TdOPCUAClient; begin UAClient := TdOPCUAClient.Create(nil); UAClient.Url := 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'; UAClient.Active := true; if UAClient.GetNamespaceIndex('http://opcfoundation.org/UA/') <> 0 then Memo1.Lines.Add('ERROR: Namespace must exists on an OPC UA server'); UAClient.Free; Memo1.Lines.Add('ready :-)'); end;
Kassl GmbH Copyright © 2024. All rights reserved.