Professional OPC
Development Tools

logos

2017.1 Browse doesn t works anymore in delphi

More
07 Sep 2017 09:04 #5500 by alr1976
WORKS!!!

THANK YOU!!!

Please Log in or Create an account to join the conversation.

More
06 Sep 2017 14:54 #5497 by support
I do not currently have Delphi easily available to test this out. But I have written "...creating a UANodeId object, assigning "References" string to its StandardName property, and then calling Add on the UABrowseParameters.ReferenceTypeIds, with that node as an argument." and you are not doing anything alike. It should be something similar to do the following:
var ReferencesNodeId: _UANodeId;
...
ReferencesNodeId := CoUANodeId.Create;
ReferencesNodeId.StandardName := 'References';
BrowseParameters.ReferenceTypeIds.Add(ReferencesNodeId);
Regards
The following user(s) said Thank You: alr1976

Please Log in or Create an account to join the conversation.

More
06 Sep 2017 13:17 - 06 Sep 2017 14:50 #5491 by alr1976
ok I have changed my code but I have same result:
var
  BrowseParameters: _UABrowseParameters;
  BrowsePathParser: _UABrowsePathParser;
  Client: TEasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: _UAEndpointDescriptor;
  NodeDescriptor: _UANodeDescriptor;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
      EndpointDescriptor := CoUAEndpointDescriptor.Create;
   EndpointDescriptor.UrlString := 'opc.tcp://127.0.0.1:49320/'
   NodeDescriptor := CoUANodeDescriptor.Create;
   NodeDescriptor.NodeId.StandardName := 'Objects';
   BrowseParameters := CoUABrowseParameters.Create;
   BrowseParameters.NodeClasses := UANodeClass_Object;
   BrowseParameters.ReferenceTypeIds.Add(NodeDescriptor.NodeId);
   NodeElements := Client.BrowseNodes(
     EndpointDescriptor,
     NodeDescriptor,
     BrowseParameters);
     NodeElementEnumerator := NodeElements.GetEnumerator;
    while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
   begin
    NodeElement := IUnknown(Element) as _UANodeElement;
     if Assigned(NodeElement) then
     Showmessage(NodeElement.BrowseName.ToString);
   end;
Last edit: 06 Sep 2017 14:50 by support.

Please Log in or Create an account to join the conversation.

More
06 Sep 2017 06:11 #5487 by alr1976
Hi!

I don t understand how to do it.
I have add:
BrowseParameters.ReferenceTypeIds.Add(nodedescriptor);
In my example(above) but doesn t work
Thanks,Alessandro

Please Log in or Create an account to join the conversation.

More
05 Sep 2017 14:28 - 06 Sep 2017 14:55 #5485 by support
The default content of UABrowseParameters.ReferenceTypeIds have changed in version 2017.1.
Earlier, it used to contain a collection with a single element, UAReferenceTypeIds.References. Now it is empty, and the developer needs to specify the desired reference types explicitly.

This should be doable e.g. by creating a UANodeId object, assigning "References" string to its StandardName property, and then calling Add on the UABrowseParameters.ReferenceTypeIds, with that node as an argument.

Best regards
Last edit: 06 Sep 2017 14:55 by support.

Please Log in or Create an account to join the conversation.

More
05 Sep 2017 12:08 #5483 by support
I will reply. Please be a bit patient.

Please Log in or Create an account to join the conversation.

More
05 Sep 2017 07:55 #5482 by alr1976

Please Log in or Create an account to join the conversation.

More
04 Sep 2017 13:26 - 05 Sep 2017 14:21 #5480 by alr1976
Hi!

I have used in 2016.2 to retrieve root node and work well but after update last version doesn t work anymore in Delphi.

My function is:
var
  BrowseParameters: _UABrowseParameters;
  BrowsePathParser: _UABrowsePathParser;
  Client: TEasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: _UAEndpointDescriptor;
  NodeDescriptor: _UANodeDescriptor;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
      EndpointDescriptor := CoUAEndpointDescriptor.Create;
   EndpointDescriptor.UrlString := 'opc.tcp://127.0.0.1:49320/'
   NodeDescriptor := CoUANodeDescriptor.Create;
   NodeDescriptor.NodeId.StandardName := 'Objects';
   BrowseParameters := CoUABrowseParameters.Create;
   BrowseParameters.NodeClasses := UANodeClass_Object;
   NodeElements := Client.BrowseNodes(
     EndpointDescriptor,
     NodeDescriptor,
     BrowseParameters);
     NodeElementEnumerator := NodeElements.GetEnumerator;
    while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
   begin
    NodeElement := IUnknown(Element) as _UANodeElement;
     if Assigned(NodeElement) then
     Showmessage(NodeElement.BrowseName.ToString);
   end;
I have now always empty nodes
Last edit: 05 Sep 2017 14:21 by support.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.184 seconds

      

 Recommend this on Google