![]() |
||||||||||||||||||||
|
|
||||||||||||||||||||
|
Tutorial - Using the OPC Browsers What is an "OPC Browser"? Sometimes the OPC Server may not be on the local computer, but on a remote computer. For this reason there is also a built in PC/Computer browser too. There are two ways to browse: Browsing Computers Displaying a dialog allowing the end-user to roam the network looking for a computer is as easy as one line of code. You can store the name of the selected computer into a variable for later use within your program. Click here to go to the source code section of the website for more information on how to actually use this feature. The screen below shows an example of the dialog that an end-user might use to locate a computer.
Browsing OPC Servers Displaying the OPC Server browser and obtaining the selected browser is very simple and takes just one line of code. You can store the name of the OPC Server into a variable for later use within your program. Click here to go to the Source code section of the website for information on how to actually use this feature. The screen below shows an example of the dialog that an end-user might use to specify an OPC Server:
Browsing OPC Tags within an OPC Server Once you know the name of an OPC Server you may have a need to easily locate Tags that are unknown during development, or your application is one-such that is definable by the end-user. Browsing the Tags available within an OPC Server is as easy as one line of code. Click here to go to the Source code section of the website for more information on how to actually use this feature.
The screen below shows an example of the dialog that an end-user might use to browse and select a Tag:
Creating your own Browsers The OPC Web Client gives you the tools to be able to create your own OPC Server and Group/Tag browsers.
This can be useful if you wanted to create a web-based browser, or if you wanted to detect via code the availability of OPC Server(s) and/or Tag(s) etc. The source-code section has examples of detecting the available OPC Servers and Tags etc. programmatically. The key to writing a good browser is in the coding. Remembering that Tags can be structured into groups
means that your application cannot assume anything. The structure of Tags in an OPC Server can be several levels deep and your application needs to be prepared for that. Recursion: recursion is a method/function that will call-itself over and over. The use of recursive functions is the best means of implementing a browsing strategy. Unless you have a need to create your own browser, we recommend using the dialogs supplied with the OPC Web Client for simplicity and speed of development. |
||||||||||||||||||||
|
Copyright Software Toolbox, Inc., 1996-2004, All Rights Reserved Worldwide. |
||||||||||||||||||||