Professional OPC
Development Tools

logos

BrowseLeaves or BrowseNodes does not return all leaves

More
15 Oct 2013 13:05 - 15 Oct 2013 13:06 #1481 by support
I can confirm this problem.

What precisely happens is that BrowseLeaves, or it could be BrowseNodes when used without the AccessRights parameter, uses an incorrect default for AccessRights - it uses "Both" (numerical value 3). This value means that ONLY leaves that are readable AS WELL as writeable, are returned. The leaves under the Demo branch in the simulation server are only readable, and are thus not returned.

The proper default for AccessRights is NoAccess (numerical value 0), meaning "don't care about any of the access rights bits".

I have fixed it now in newest build of Version 5.22. It is build 5.22.422.1, and it is the one that is (as of now) posted in the Download area of this Web site.

In older versions, it should be possible to make a workaround by calling BrowseNodes and pass it the proper parameters, and include the AccessRights and give it a zero value.

I hope this helps.
Last edit: 15 Oct 2013 13:06 by support.

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

More
15 Oct 2013 12:15 #1480 by support
From: ...
Sent: Monday, October 14, 2013 11:50 AM
To: Zbynek Zahradnik
Cc: ...
Subject: Re: QuickOPC problems


Hi

This is the code that returns 0 items only for "Demo" leaves.
I have run with only constants
vDictionary := DA.BrowseLeaves('localhost', 'OPCLabs.KitServer.2', 'Demo', EmptyStr, EmptyStr);
with the same result.

I have used Delphi 2010
Hope this is enough for you.
function TBrowseOPC.EnumLeaves(pParent: TTreeNode): integer;
var
  pUnk: IUnknown;
  vDictionary, arNodes: OleVariant;
  nIndex: integer;
  pInfo: DANodeElement;
  crOld: TCursor;
begin
  crOld := Screen.Cursor;
  Screen.Cursor := crHourGlass;
  try
    vDictionary := DA.BrowseLeaves(GetID(pParent, ntMachine), GetID(pParent, ntServer), GetID(pParent, ntBranch), EmptyStr, EmptyStr);
 
    // This is the call thats returns 0 items (count = 0 below).
    // vDictionary := DA.BrowseLeaves('localhost', 'OPCLabs.KitServer.2', 'Demo', EmptyStr, EmptyStr);
 
    arNodes := vDictionary.Items;
    Result := vDictionary.Count;  //Returns 0 only for Demo!!!
    for nIndex := 0 to  Result - 1 do
    begin
      pUnk := arNodes[nIndex];
      pInfo := pUnk as DANodeElement;
      AddNode(pParent, ntLeaf, pInfo.Name, pInfo.ItemID, false);
    end;
  finally
    Screen.Cursor := crOld;
  end;
end;
Med vänliga hälsningar/Best regards
...
...

“Please have them send us their source code. They are probably doing something wrong when calling the Browse methods.”

...


From: ...
Sent: den 11 oktober 2013 14:35
To: ..
Subject: Re: QuickOPC problems

...
Hello,

We are upgrading QuickOPC from 3.03.
We are Delphi 2010 with the QuickOPC COM interface and have some problems.

At first we tried in version 5.12 the "Demo" and "Trends" branches never did returns any leaves when calling BrowseLeaves

In 5.22 the fault is still in "Demo" branch but now it returns correct in "Trend" branch as the picture shows.
All other BrowseLeaves seems to work OK.

Subscribing is working for each leave of the Demo branch.

Note! All this was working correct in the Demo application that was provided with the installation.

I have attached the program written in Delphi 2010 if you want to test. It´s for the version 5.22.
Rename to .exe





--
Med vänliga hälsningar/Best regards
...
Attachments:

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

Moderators: support
Time to create page: 0.205 seconds

      

 Recommend this on Google