Application-level recovery – Echelon LNS User Manual

Page 276

Advertising
background image

LNS Programmer's Guide

262

During the recovery process, the LNS global database will be locked to prevent accidental

modification while recovery is in progress. Other LNS applications should not make
changes to the LNS network database while the network is being recovered.

The recovery of a large network may take a long time. You can examine the System

object’s RecoveryStatus property to see how a network recovery is progressing. You

need to use a separate process to read the RecoveryStatus property. For more
information on the OnSystemNssIdle event, see Using the OnSystemNssIdleEvent on

page 316.

If the recovery process is interrupted, for example if the service is canceled or the LNS
Server PC loses power, you can restart the recovery by invoking the System object’s
RecoverFromNetwork() method with the resumeRecovery flag set to True.

Application-Level Recovery

An LNS application can provide enhanced functionality to the recovery process by

uploading additional information from the devices on the network, if the network was
designed with this goal in mind. For example, a device may store its subsystem path and

device name in a SCPT_location configuration property. You can acquire this path by
reading the Path property of any Subsystem object stored in the AppDevice object’s
Subsystems collection. Note that the SCPT_location configuration property may not be

implemented in all of your devices.

The syntax of the string should be the subsystem path name :
subsystem[.subsystem]
For example, the following string specifies an device’s logical location as “Building 2”,

“Room 312”:

”Building 2.Room 312”

To provide an enhanced application-level recovery function, follow these steps:

1. Perform the network recovery, as described in the previous section.

2. Loop through each AppDevice object in the Discovered.Installed

subsystem of the recovered network. Start with the last device and end
with the first device in the subsystem’s AppDevices collection, since the

following steps will remove the devices from this subsystem.

For each device, perform these steps:

A) Obtain the LonMarkObjects collection of the AppDevice object’s

main interface (accessed through the Interface property). Search
for a LonMarkObject object with the TypeIndex property set to 0

(SFPTnodeObject). If found, obtain the ConfigProperties collection

object from this LonMarkObject, and try to locate a
ConfigProperty object with the TypeIndex property set to 17

(SCPT_location).

B) If unsuccessful in the previous step, repeat the previous step, but

search all LonMarkObject objects on the device, not just the node
object.

C) If unsuccessful in both previous steps, search the

Advertising