Exporting a lonmaker network, Invoking the export feature – Echelon LonWorks Network XML User Manual

Page 11

Advertising
background image

L

ON

W

ORKS

Network XML Programmer’s Guide

3

Tip: You can download an assembly provided by Echelon, named PlugInWrapper.dll, to expedite the
development of your custom LonMaker application. You can use this assembly instead of developing
your own director application. To use the PlugInWrapper.dll file, you must have LNS Turbo
Editions 3.23 (or newer) installed on your computer. The PlugInWrapper.dll file and the latest LNS
Service Pack are available on the Echelon Web site at

www.echelon.com/downloads

.

After you download the PlugInWrapper.dll file, add it as a reference in your development
environment. For example, if you are using Microsoft Visual Studio, click Project, click Add
Reference
, click Browse, and then select the PlugInWrapper.dll file. You then reference the
PlugInWrapper.dll file in your code. You can then programmatically export and import LonMaker
networks with the LonMaker XML Plug-in following the Visual C# code samples provided in the
subsequent sections.

Exporting a LonMaker Network

You can use the LonMaker XML Plug-in to automate the exporting of a LonMaker network. To do
this, create a director application that does the following:

1. Defines the export automation properties.
2. Invokes the export command of the LonMaker XML Plug-in.

Invoking the Export Feature

The export feature of the LonMaker XML plug-in implements the Report (23)

SendCommand request

and registers for a subsystem object, which consists of the object class (Subsystem, 5) and the
subsystem name. The following Visual C# code example demonstrates how you can invoke the
LonMaker XML Plug-in export command.

using

System;

using

System.Collections.Generic;

using

System.IO;

using

System.Text;

using

System.Threading;

using

System.Xml;

using

PlugInWrapper;

//reference to Echelon PluginWrapper.dll file.

//You can use download and reference this instead of

//creating your own director application.

namespace

myLmXmlNetwork

{

class

myLmXmlNetwork

{

static

void

Main(

string

[] args)

{

//Create an instance of the LonMaker plug-in using its registered

//ActiveX name, which is "EchelonLonMakerXML.Application"

LonMakerXmlPlugIn

m_lmXml =

new

LonMakerXmlPlugIn

();


//Set the network name property to open the network

m_lmXml.NetworkName =

"MyXmlNetwork"

;


//Invoke the send command to specify the action and target

//object. The send command uses the following syntax:

//(23, 5, “network/system/subsystem[/subsystem…])”

m_lmXml.SendCommand(23, 5,

"MyXmlNetwork/MyXmlNetwork/Subsystem 1"

);


//Make plug-in visible so it shows itself

m_lmXml.Visible =

true

;

}
}
}

Advertising