VI-Based Server - Sample Server Registration
The user can configure server behavior, devices, or server communications channels with the configuration utility. Registering server, device, and item information is part of server configuration. If you develop a VI-based configuration utility, include the server registration as part of it. You might not develop a server configuration utility in other cases, such as a simple device or fixed server configuration or if you are writing a server to simulate tags. In these cases, you must develop a VI similar to the Register Dummy Server VI in the following figure, and register the items for which your server generates or accepts data. The LabVIEW\examples\lvdsc\servers\Sample folder includes this VI and a more complete server configuration utility VI example. Most of the simulation server examples for the LabVIEW Datalogging and Supervisory Control (DSC) Module have a register server VI similar to the one shown in this example.
In the following figure the VI that registers the server first deletes the existing server registration information from the CCDB by calling the SVRG Delete Row VI with the following information:
- Server Name (Dummy Server)
- Delete What input set to 2 (server)

Next, the VI supplies new information to the Server, Device, and Item tables by calling the SVRG Add Server Row VI, SVRG Add Device Row VI, and SVRG Add Item Row VI, respectively. Refer to the LabVIEW Help for detailed descriptions of these VIs.
In the previous figure the front panel controls of the Register Dummy Server VI store the following as default values:
- Server Name (Dummy Server)
- Server VI Name (dmy_srvr.vi)
- Device Name (Dummy Device)
- Item Info (item names and parameters)
Although this example server only registers one device, it registers several items for that device.
The example calls the SVRG Add Server Row VI with the following information:
- The server name (Dummy Server)
- The name of the VI file (dmy_srvr.vi) that implements the server
- The path to dmy_srvr.vi
- The server type set to VI
The path to the configuration utility is left unwired to indicate that no configuration utility exists. Set server type to VI to notify the LabVIEW Datalogging and Supervisory Control Module that the server is a VI-based server. The DSC Module launches the VI corresponding to that server when the server is selected by a given tag configuration. The Register Dummy Server VI computes the path to dmy_srvr.vi by obtaining the current VI path (current VI is Register Dummy Server VI), removing the VI name, and appending dmy_srvr.vi. The VI can compute the path because both the Register Dummy Server VI and dmy_srvr.vi are in the same file folder. This example VI leaves all other inputs at their default values.
The example calls the SVRG Add Device Row VI once with the following information:
- The unique device name (Dummy Device)
- The device address (Dummy Device)
- The device default rate, set at 0.1 seconds
- The server name associated with the device
You must register at least one device for a server if you plan to register any items, because all items are associated with a specific device. If the server does not handle any devices, choose a default device name such as ALL. Leave all other inputs at their default values.
The Register Dummy Server VI also calls the SVRG Add Item Row VI for each item registered for the Dummy Server. These items are saved in an array of clusters on the front panel. For each item, this example VI registers the following information:
- A unique item name
- An item data type
- A direction (input, output, or I/O)
This example VI also registers optional item information, including the following parameters:
- item max range
- item min range
- item unit
- item max length
This example VI leaves all other inputs at their default values.
Related Links:
VI-Based Server Development Toolkit Reference Manual
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
