Discovering and installing devices – Echelon LNS User Manual

Page 105

Advertising
background image

LNS Programmer's Guide

91

Discovering and Installing Devices

There are several main phases involved in the automatic installation scenario depicted in

Figure 5.5. These phases are listed below:

1. The first step is to discover the devices that have been added to the network. There

are several ways to discover new devices. For more information, see Discovering
When New Devices are Attached to the Network
on page 91.

2. Once you have discovered a new device, you need to define and configure the device

in the LNS database, and connect it to other devices on your network. For more

information on these tasks, see Installing Devices on page 93.

3. You will also need to program your application to determine when devices are

removed or replaced on the network, and update the LNS database accordingly. For
more information on this, see Discovering When Devices are Detached or Replaced on

page 96.

Discovering When New Devices are Attached to the Network

The first major step in the automatic installation scenario is for the application to

discover the devices that are attached to the network. There are three ways your LNS
application can do so:

• Allow the LNS Object Server to discover the devices using the

background discovery process. Devices discovered by this process will be
represented as AppDevice objects in the

Discovered.Uninstalled

subsystem. The

Discovered.Uninstalled

subsystem is managed by

LNS. The background discovery interval determines the time it will take

for the LNS Object Server to find a device. The default for this interval is

180 seconds, and you can change this value by writing to the

System

object’s DiscoveryInterval property. If a device is configured, the

background discovery process will ignore it. Therefore, the background
discovery process will not discover configured devices that you move from

one network to another. For this reason, device designers usually provide

a mechanism within an application that will deconfigure a device when it
is moved. For example, if the application detects an asserted service pin

for 10 seconds following a power cycle, it could call the Neuron C
go_unconfigured() function.
When using this approach, you should use the System object’s
BeginChangeEvent() method to subscribe your application to the
OnChangeEvent events. Once you do so, LNS will generate an
OnChangeEvent event each time it discovers a new device or router on

the system. See the LNS Object Server Reference help file for more
information on the OnChangeEvent event.
Note that the OnChangeEvent event reports changes to the LNS network
database. Thus, by the time the OnChangeEvent reports the detection of
a new physical device, the AppDevice object associated with that device

exists in the network database and is ready for use by your application.
Subscribing to the related OnAttachment event provides similar
information, but relates to network operations. Thus, an AppDevice

object associated with a physical device may not have been added to the

Advertising