Echelon LNS User Manual

Page 149

Advertising
background image

LNS Programmer's Guide

135

1. Call

the

System object's StartTransaction() method. You should always call the

Upgrade() method within a transaction. This allows for easy reversal of the

upgrade. For more information on transactions, see Using Transactions and Sessions

on page 65.

2. If the device upgrade includes new hardware, make sure the new physical device is

attached to the network, and that the AppDevice object's NeuronId property is set

to the proper Neuron ID.

3. Call

the

Upgrade() method on the AppDevice object. This method optionally takes

a DeviceTemplate object as a parameter. If a DeviceTemplate is not supplied, the

new external interface will be read directly from the device. If your application is not
attached to the network, you must supply a DeviceTemplate, or an exception will

be generated.

NOTE: In some cases, you may need to upgrade your Network Service Device,

usually because its network interface has changed. Generally, LNS will upgrade the
Network Service Device automatically. However, in some cases, you may need to

perform the upgrade manually. In this case, you should not supply a
DeviceTemplate object. For more information, see Network Interfaces and Network

Service Devices on page 273.

4. The

Upgrade() method returns an UpgradeStatus object. This object contains the

Result property, which will bet set to lcaUgResSuccess if the upgrade was
successful. If the upgrade was not successful, call the CancelTransaction()

method on the System object to back out of the upgrade.

5. The

UpgradeStatus object also contains an UpgradeInfos collection. This

collection contains one UpgradeInfo object for each LonMark Functional Block,

network variable, message tag, monitor set, monitor point, and configuration
property in the original external interface. Each UpgradeInfo object contains a

summary of how the old LonMark Functional Block, network variable, message tag,
configuration property, monitor set, or monitor point is represented in the new

interface. This includes the following properties:

Class

This property indicates whether the UpgradeInfo

object represents a LonMark Functional Block,
network variable, message tag, configuration

property, network variable configuration property,

monitor set, or monitor point.

FromIndex

This property returns the device index value assigned
to the external interface component represented by
this UpgradeInfo object in the external interface

before the upgrade.

FromOwnerIndex For

UpgradeInfo objects that represent

configuration properties that are contained within
LonMarkObjects or network variables, this property

returns the device index value assigned to the owner
LonMarkObject or network variable in the external

interface before the upgrade. Otherwise, this property

returns –1.

ToIndex

This property contains the device index value

Advertising