Echelon LNS User Manual

Page 132

Advertising
background image

LNS Programmer's Guide

118

2. Get

the

AppDevices collection from this subsystem and iterate through

the devices by index, using the Item property. To find the target,
examine the properties of each AppDevice in the collection. For example,

the program ID, channel ID, and location can be used to find the
appropriate devices.

The location field is a 6-byte field in the Neuron Chip used for storing

installation-related information. This property is intended for use in

situations where the device’s physical location may be read from its I/O

pins or programmed into the device prior to installation. For example, if a
device is installed in a slot in a card cage, it can read the slot number

from the edge connector.

Set MyAppDevices = MySubsystem.AppDevices
Counter = 1
MySystem.BeginTransaction()
MaxDevices = MyAppDevices.Count
While not DeviceFound and Counter <= MaxDevices

Set MyAppDevice = MyAppDevices.Item(Counter)

DeviceFound = AppDevice.Location = DesiredLocation

Counter = Counter + 1

End While

MySystem.CommitTransaction()

3. To confirm that you have found the correct device, wink the device by

invoking the Wink() method. The device should be programmed to

respond in a way that can be easily detected by the person installing the

device. For example, lights can blink, alarms can ring, and displays can
flash. The person performing the installation can then identify the

physical application device responding to a particular wink message as

the one currently being installed.
MyAppDevice.Wink()

4. Continue performing steps 2 and 3 until the correct device has been

found. Then, commission the device, and add it to connections as your

network design requires.

5. Note that in a fashion similar to the confirmed service pin protocol

described earlier, a local technician could confirm the correct device

performed the wink action by activating the device’s service pin. Your

application could obtain that service pin message via the
OnServicePinEvent event, and then compare the originator device’s

Neuron ID with the value stored in the NeuronId property of the
CurrentDevice returned by the event. If both match, your application

could assume that the detected device is the desired one.

In a fully automated approach, your application could use other methods

to confirm the device’s identity. For example, the application could

compare the device’s program ID with the expected value, it could query
the device’s Location property, or inspect the channel it is attached to

by reading the AppDevice object’s Channel property.

The LNS Object Server can also find configured devices. An LNS application may invoke
DiscoverDevices() method on a system to discover configured devices that have not
been added to the LNS database. When you call DiscoverDevices(), you must specify

the DomainId and backgroundReg parameters. These specify the domain on which

devices will be discovered, and whether registration will take place as a background or

Advertising