Echelon OpenLNS User Manual

Page 892

Advertising
background image

OpenLNS Programmer's Reference

855

If a host-based device whose application is not running is

installed on the network, OpenLNS may or may not be able

to discover it. Whether OpenLNS can discover and register

the device depends on how much of the device's LonTalk

protocol stack is running at the time of the discovery.
Discovering a device involves first the actual discovery of the

device and then the registration of that device in the

database. The discovery service is always performed in the

foreground and the registration service may be performed

either as a background or foreground task. Select the type of

operation by setting the backgroundReg parameter to True or

False, as desired.
If backgroundReg is set to False, devices are registered in the

foreground as part of the discovery transaction, so the

method will not return until discovery is completed or

terminated. When the method completes, it returns the

number of discovered devices in the numDevicesDiscovered

parameter, and the newly registered devices may be accessed

in the Discovered.Uninstalled subsystem. If an error occurs

while registering a device, the method will return when one

of the following conditions is met: all discovered devices have

been registered, or 50 devices have been registered.
If backgroundReg is set to True, discovered devices are

registered in separate background transactions. In this case,

any error that occurs during the registration of one device

has no effect on the registration of any others. When the

method completes, numDevicesDiscovered again returns the

number devices discovered. Registration of those devices

proceeds asynchronously. As each device completes

registration, it appears in the Discovered.Uninstalled

subsystem. To limit resource usage during background

discovery, the Object Server limits the number of devices that

may be registered to 50. You can use the OnChangeEvent

event to track when the devices have been registered. The

event will be fired once for each device that is registered, so

you can assume the registration process has not completed

until the number of events fired matches the value of the

numDevDiscovered element.
When the DiscoverDevices method is halted by an error or its

background registration limit, and additional devices remain

to be registered, the Object Server's DiscoveryLimitedFlag

property is set to True. To ensure that all discovered devices

have been registered, the DiscoverDevices method must be

reinvoked. In particular, when registering devices in the

background (backgroundReg = True), this method must be

invoked repetitively until no further devices are discovered.

The repeat interval must be sufficiently long to allow the

server time to register all devices discovered during the

previous DiscoverDevices invocation.
When the DiscoverDevices call is made within an explicit

transaction (see StartTransaction) and foreground

Advertising