Program ids and devicetemplate objects – Echelon LNS User Manual

Page 120

Advertising
background image

LNS Programmer's Guide

106

4. Call

the

Import() method on the new DeviceTemplate object to import the

device’s external interface file. You will provide the location of the device interface
files in the xifPath parameter you supply to the method.

MyTemplate.Import (“C:\LonWorks\Import\Acme\Cooker.xif”)

Device interface files may reside in any location that can be reached through the file

system on the LNS Server PC. Thus, referencing a device interface file as
C:\LonWorks\Import\Acme\Cooker.xif refers to the cooker.xif interface file in
the LonWorks\Import\Acme folder on the C: drive of the LNS Server PC. Device

interface files may reside outside the LNS Server PC’s local storage, and can be
referred to via mapped network drives or fully qualified filenames. The device plug-in

software that comes with most L

ON

W

ORKS

devices should take care of installing the

device interface files into the correct locations, and may also create and initialize
DeviceTemplate objects as part of the plug-in application’s registration with the

network.

5. Once you have imported the external interface into the DeviceTemplate object,

LNS will automatically associate the DeviceTemplate with all devices that use the

imported external interface. LNS makes this determination by reading the program

ID values assigned to the devices, as described in the next section. You can also
specify the DeviceTemplate an AppDevice object should use when you create the
AppDevice object, as described later in this chapter.

Program IDs and DeviceTemplate Objects

A network can consist of multiple devices, some of which implement the same hardware,

software, and device interface. For example, a network could contain several hundred

light switches of the same make and model. Each of these light switches has a unique

Neuron ID, a unique network address (subnet/node ID, etc), and unique values for their
network variables and configuration properties. However, all the light switches share the
same device interface, and so they use the same DeviceTemplate in the LNS database.

The unique identifier of a device interface, and of the associated DeviceTemplate in the

LNS database, is the program ID. Every LonMark-compliant L

ON

W

ORKS

application

device is assigned a unique, 16 digit, hexadecimal standard program ID that uses the

following format:

FM:MM:MM:CC:CC:UU:TT:NN

Table 6.1 describes each part of the program ID. You can find out more about the

standard program ID fields in the LonMark Application-Layer Interoperability

Guidelines, which can be downloaded from the web at

http://www.lonmark.org/products/guides.htm

.

Advertising