Discovering when devices are detached or replaced – Echelon LNS User Manual

Page 110

Advertising
background image

LNS Programmer's Guide

96

each method. For more information on this, see System Management Mode

Considerations on page 97.

Discovering When Devices are Detached or Replaced

Your LNS application can check if devices are still present in the network by periodically
attempting to communicate with them. One way to do so is to invoke the Test() method

on each AppDevice you need to check on. The Test() method verifies that the device is

present on the network, that it is properly configured, and that no other devices on the

network are using the network address assigned to the device.

If the Test() method returns lcaTestResultComm as the test status, it may indicate

that the device has been detached from the network. A device might be detected as

detached for several reasons, some of which will indicate the need for repair rather than
a removal or replacement. For example, the device might be detected as missing because

it has been detached from the network for physical maintenance, or because it has been

powered off. In this case, the best response from the application would be to prompt the
user to inspect the physical hardware. If the device has been physically removed from the

system, and does not need to be replaced, the application should perform a logical device
removal to keep the LNS database synchronized with the physical removal, or it can

simply decommission the device if a replacement is expected in the future. For more

information on this, see Removing Devices on page 137.

The Test() method can return many possible values (e.g. lcaTestResultCommSnode,
lcaTestResultMismatchDomain, etc.) as the test status if the device being tested is

not properly configured. This could happen because of faulty device hardware design.

You can try to correct these errors by re-commissioning the device with the
Commission() or CommissionEx() methods. Consult the LNS Object Server Reference

help file for more information on the Test() method.

The Test() method is not the only way to determine when devices have been detached

from the network. You can use the BeginAttachmentEvent() method to subscribe your
application to the OnAttachment event. Once you register for this event, the LNS Object

Server will periodically ping the devices on your network, and fire the event if any are
missing. This is much more efficient than the Test() method, but not as

comprehensive. You can determine the interval at which each device is pinged by writing
to the AppDevice object’s PingClass property. You can set this property to any of the

following values:

lcaPingClassMobile

Check detachment frequently (1 minute by
default).

lcaPingClassTemporary

Check detachment less frequently (2 minutes
by default).

lcaPingClassStationary Check detachment occasionally (15 minutes by

default).

lcaPingClassPermanent

Never check.

You can set the ping frequency for each of these ping classes by writing to the System

object's PingInterval property. The default ping rate is once every 15 minutes, unless
the System object’s InstallOptions property is set to lcaSharedMedia, in which case

pinging will be disabled.

Advertising