Developing mobile tools – Echelon LNS User Manual

Page 331

Advertising
background image

LNS Programmer's Guide

317

application should provide feedback and the ability to cancel operations. For example,

when displaying a list box of devices in the system, you could provide a Cancel button
and display an hourglass while creating the list.

When operating remotely, your application should also disable operations that are not

supported remotely to prevent the user from selecting them. For example, if your

application provides a network recovery command, this command should be disabled
when running remotely. The LNS Object Server Reference help file contains a help page

for every LNS object, property, method and event. Each help page indicates whether or

not the object, property, method or event it describes is available on remote clients.

To improve remote performance, your application should cache frequently accessed

objects such as the current system and subsystem objects, and be careful not to
unnecessarily repeat object references. For example, the following statement within a

loop will require repeated references to the LNS Server from a remote PC:
Dim MyNVs As LcaNetworkVariables

Dim MySubsystem As LcaSubsystem

Dim MyDevices As LcaAppDevices

Dim MyDevice As LcaAppDevice

Set MyDevices = MySubsystem.AppDevices

Set MyDevice = MyDevices.Item(“Sunblind”)

Set MyNVs = MyDevice.NetworkVariables

Set MyNV = MyNVs.Item(i)
Each iteration through the loop will call constructors and destructors on the LNS Server
PC for the AppDevices collection, the AppDevice object, the NetworkVariables

collection, and the NetworkVariable object. To significantly increase performance,

fetch the AppDevices collection, AppDevice object, and NetworkVariables collection

once outside the loop with the following statements:
Dim MyNVs As LcaNetworkVariables

Dim MySubsystem As LcaSubsystem

Dim MyDevices As LcaAppDevices

Dim MyDevice As LcaAppDevice

Set MyDevices = MySubsystem.AppDevices

Set MyDevice = MyDevices.Item(“Sunblind”)

Set MyNVs = MyDevice.NetworkVariables

The statement within the loop can be changed to the following, eliminating most of the

constructor and destructor calls:
Set MyNV = MyNVs.Item(i)
You can subscribe to the OnChangeEvent event to keep your application informed of

changes to the database that may affect your cached objects.

Developing Mobile Tools

If your network tool is designed to be mobile and it is used in a multi-channel network, it
needs to provide special support. This is required to inform the LNS Server that your

application may move, and to tell the LNS Server when your tool has moved. If your

application is running on the same PC as the LNS Server, then it must inform the
system that the LNS Server has moved, so that the LNS Server can update the Network

Service Device’s network address to be consistent with the channel it has been moved to.

These issues only arise on multi-channel networks.

Advertising