Echelon LNS Plug-in User Manual

Page 28

Advertising
background image

Field Description

ObjectName

The fully specified name of the LNS object on which to
perform the command, as specified by the director.

LcaObject

A reference to the LNS object on which to perform the
command, as decoded by the LNS Plug-in Framework (or null
if unable to decode).

Note: The Actions array will contain only one item unless the plug-in MultiObject feature is
specified as Supported. You can also obtain a reference to the LNS Object Server through the
framework’s LcaClass.Instance method, or to the currently open Network and System objects
through the LcaClass.Network and LcaClass.System properties, respectively.

The following code demonstrates how your plug-in form class should appear (note that MyPlugin
represents the name of your plug-in):

using

System;

using

System.Windows.Forms;

using

System.Runtime.InteropServices;

using

Echelon.LNS.Plugin;

using

Echelon.LNS.Interop;

namespace

YourCompany.DevicePlugin

{

public

partial

class

MyPluginForm

:

PluginFormBase

{

public

MyPluginForm()

{
InitializeComponent();
}

protected

override

void

ActivatePlugin()

{

// carry out each queued command action

foreach

(

PluginAction

action

in

Plugin.Actions)

{

// extract information from command action

EnumCommandIds

commandId = action.CommandId;

EnumClassIds

classId = action.ComponentClassId;

string

objectName = action.ObjectName;

object

lcaObject = action.LcaObject;


// perform the command action

switch

(commandId)

{

case

EnumCommandIds

.Test:

// TODO: add command handler here

break

;


// TODO: add other command handlers here

}
}
}
}
}

Note: Typically, a device plug-in is launched from the director, and it then allows the user to select
various device configuration options from a user interface that is customized to the device
functionality. After creating your basic PluginForm class, you can add most of your plug-in
functionality to this user interface class, adding controls using Visual Studio’s Form Designer and
updating your controls from your command handlers.

Advertising