Tracking custom interface changes, Changeable network variable types – Echelon LNS User Manual

Page 199

Advertising
background image

LNS Programmer's Guide

185

MoveToInterface() method to move a dynamic network variable from the main

interface to a custom interface. Once you have done so, you could remove the network
variable from the custom interface, and its removal would be propagated to the main

interface.

Tracking Custom Interface Changes

You can use the

OnNodeIntfChangeEvent

event to keep track of when a device’s

interface is modified. The

OnNodeIntfChangeEvent

event is fired whenever a device's

interface is changed. Depending on the type of interface change, the
OnNodeIntfChangeEvent will be generated as the changes are made to the LNS

database, or as they are propagated to the physical device. You can register your
application for this event by calling the

BeginNodeIntfChangeEvent()

method on the

System

object.

For more information on this, see the LNS Object Server Reference help file.

Changeable Network Variable Types

As of LNS Turbo Edition, each NetworkVariable object contains a TypeSpec property.

The TypeSpec property provides access to a TypeSpec object. LNS uses the TypeSpec

object to identify the base type a network variable should use. You can write new values
to the properties of the TypeSpec object to change the network variable’s type, if the

network variable supports changeable types.

To change a network variable’s type, follow these steps:

1. Check that the network variable supports changeable types. You can read

the NetworkVariable object’s ChangeableTypeSupport property to do

so. If the ChangeableTypeSupport property is set to
lcaNvChangeableTypeSdOnly or lcaNvChangeableTypeSCPT, the

network variable supports changeable types.

2. Access the network variable’s TypeSpec object through the TypeSpec

property.

3. Set the program ID, scope, and name of the new type you want to use by

writing to the ProgramId, Scope, and TypeName properties of the
TypeSpec object.

4. Optionally, invoke the Lookup

()

method on the TypeSpec object to

make sure that the program ID, scope and name entered in step 3

reference a valid type.

5. Read

the

IsComplete property to make sure that the TypeSpec object is

complete. This step is generally not necessary when changing a network

variable’s type, unless you are creating a new network variable or

changing a network variable’s type from a type that was received from
another network variable. Consult the LNS Object Server Reference help
file for more information on the IsComplete property.

6. Pass the modified TypeSpec object back to the TypeSpec property of the

network variable. At this point, LNS will use the values entered in step 2
to find the definition of the type in the resource files, and assign values to

Advertising