Example for creating a device class file, Examine source files – Echelon LonBridg Server User Manual

Page 50

Advertising
background image

44

LonBridge Device Class File

2. Define an <attribute> element for each abstract attribute that the

application requires.

3. Decide which network variables or fields within network variables the

LonBridge application needs to access. The application can include a

subset of the network variables or network variable fields that are
defined for the L

ON

W

ORKS

device. Recommendation: If you define a

subset, include any mandatory network variables.

4. Define an <nv> element for each set of network variables or network

variable fields that correspond to each <attribute> element. The network

variables are defined within the L

ON

W

ORKS

device’s source files.

5. Use the NodeBuilder Resource Editor to determine the definitional

attributes of each network variable or field, such as its number of bytes,

type values, or enumeration values. You can also use the LONMARK
Resource Files Web page,

types.lonmark.org

, to determine this

information.

6. Optional: Define <enum> elements for the attributes within an <nv>

element (inside the <nvs> element) to define logical names for network

variable or field values.

7. Browse the L

ON

W

ORKS

device’s external device interface (XIF) file to

determine the index value for each network variable. These index values

are required for each <nv> element.

Example for Creating a Device Class File

The following sections describe how to create a device class file for a simplified
Lamp Module, based on the Echelon Lamp Module. The example LonBridge

application for this simplified Lamp Module requires attributes for lamp state (on
or off) and for lamp power use.

Examine Source Files

For the Echelon Lamp Module, all network variable declarations are included in

a common header file that defines network variables, configuration properties,
functional blocks, and other Neuron C constructs (such as global variables,

functions, ISI callback functions, and so on).
The header file defines the following network variables. Note that the file defines
more network variables than the simplified Lamp Module will need.

///// Network Variables /////

network input SNVT_switch_2 nviValue;

network input SCPTenergyCntInit cp cpMinSendTime = 5;
// Set default throttle to 500ms

network output polled SNVT_switch_2 nvoValueFb
nv_properties {
cpMinSendTime
};

network output SNVT_occupancy nvoOccupancyFb;

network input far SCPTpwrSendOnDelta cp cpPwrSendOnDelta = 5;

Advertising