dOPC Client Toolkit

class to browse Items from a OPC Server 


TdOPCBrowser = class(TComponent);
class TdOPCBrowser : public TComponent;

The TdOPCBrowser class allow clients to browse through the address space of the OPC server.

// shows all items and folder of the selected OPC server procedure GetAllItems(Browser: TdOPCBrowser; ItemList: TStrings; Level: integer = 0); var i : integer; Items : TdOPCBrowseItems; BrowseItem : TdOPCBrowseItem; LevelStr : string; begin Browser.Browse; // get all Branches and Items in this level from OPC Server Items := TdOPCBrowseItems.Create; // create a new list Items.Assign(Browser.Items); // save and copy Items in new List for i := 0 to Level do LevelStr := LevelStr +' '; // create empty string to show level ItemList.Add(LevelStr+'Folder: '+ Browser.CurrentPosition.Name); // Show name of folder ItemList.Add(LevelStr+'('); for i := 0 to Items.Count-1 do // for all items in current path begin BrowseItem := Items[i]; if BrowseItem.IsItem then // if browse item is not a folder ItemList.Add(LevelStr+' '+BrowseItem.ItemName) // add Itemid to list else begin // if it is a folder if Browser.MoveDown(BrowseItem) then // one Level down begin GetAllItems(Browser,ItemList,Level+1); // recursive call Browser.MoveUp; // back to old Level end; end; end; ItemList.Add(LevelStr+')'); Items.Free; end;
Kassl GmbH Copyright © 2023. All rights reserved.