Echelon LNS User Manual

Page 196

Advertising
background image

LNS Programmer's Guide

182

and message tags to the new

Interface

as you desire, provided that the

device supports them. For more information on these tasks, see the
following sections.

Adding LonMark Functional Blocks To a Custom Interface

A LonMark Functional Block represents a collection of network variables and

configuration properties on a device that perform a related function. For example, a

digital input device with four switches could contain one LonMark Functional Block for
each switch. For general information on LonMark Functional Blocks, and how you can

use them to configure and manage a device, consult the LonMark Interoperability

Guidelines, which can be downloaded from the web at

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

.

In LNS, LonMark Functional Blocks are represented by LonMarkObject objects. Some

custom device interfaces support dynamic LonMark Functional Blocks, which means that

you can add them to the interface manually. You can determine if an interface supports
dynamic LonMark Functional Blocks by reading the interface’s
DynamicLonMarkObjectCapacity property. If the device interface supports dynamic

LonMark Functional Blocks, the DynamicLonMarkObjectCapacity property will be set
to a value greater than 0. Note that you cannot add LonMarkObjects to a device’s main

interface, although the DynamicLonMarkObjectCapacity property of that Interface

may be set to a non-zero value.

To add a dynamic LonMarkObject to a device, follow these steps:

1. Access the custom interface that you want to add the LonMarkObject to.

If necessary, create a new custom interface, as described in Adding a

Custom Interface to a Device on page 181.

Dim Interfaces as LcaInterfaces
Dim MyNewInt as LcaInterface
Set MyInterfaces = MyAppDevice.Interfaces
Set MyNewInt = MyInterfaces.Item(“NewInt”)

2. Make sure that the interface supports the addition of dynamic

LonMarkObject objects by reading the Interface object’s
DynamicLonMarkObjectCapacity property. If it does, acquire the
Interface object’s LonMarkObjects collection.

Dim LonMarkFunctionalBlocks as LcaLonMarkObjects

Set LonMarkFunctionalBlocks =

MyNewInt

.LonMarkObjects

3. Call

the

Add() method on the LonMarkObjects collection to create a

new LonMarkObject object. The Name and ProgammaticName
properties of the new LonMarkObject object will be set to match the

name you specify as the fbName element. You should note that the name
assigned to the LonMarkObject objects on each device must be unique. If

you attempt to use a name that is already used on the device, the
operation will fail, and the LCA#3 lcaErrDuplicateKey exception will

be thrown.

Dim MyLMFB as LcaLonMarkObject

Set MyLMFB = LonMarkFunctionalBlocks.Add(“new LMFB”,500)

Advertising