beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 396

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-44

'get the device template to show FBs and DPs in Web UI

my_LON_Device2.Command(2) =

New

iLON_SmartServer.LON_Device_CfgCommand()

my_LON_Device2.Command(2).UCPTcommand =

New

iLON_SmartServer.LON_Device_eCommand()

my_LON_Device2.Command(2).UCPTcommand = iLON_SmartServer.LON_Device_eCommand.GetTemplate
my_LON_Device2.Command(2).UCPTstatus =

New

iLON_SmartServer.E_LonString()

my_LON_Device2.Command(2).UCPTstatus.LonFormat =

"UCPTstatus"

my_LON_Device2.Command(2).UCPTstatus.Value =

"STATUS_REQUEST"

'Call the Set() function

Dim

Device_Return_ItemColl

As

iLON_SmartServer.Item_Coll = SmartServer._iLON.Set(ItemCfgColl)


Device_Return_ItemColl.xSelect =

"//Item[@xsi:type=""LON_Device_Cfg""]"

If

Device_Return_ItemColl.UCPTfaultCount > 0

Then

' print out error and exit

Console.Out.WriteLine(

"An error occurred:"

)


For

j

As

Integer

= 0

To

Device_Return_ItemColl.Item.Length - 1

If

Device_Return_ItemColl.Item(j).fault

IsNot

Nothing

Then

Console.Out.WriteLine((

"Item: "

& Device_Return_ItemColl.Item(j).UCPTname &

", fault code: "

& Device_Return_ItemColl.Item(j).fault.faultcode.Value &

", fault string: "

) & Device_Return_ItemColl.Item(j).fault.faultstring)

End

If

Next

Else

ItemCfgColl = SmartServer._iLON.Get(Device_Return_ItemColl)

For

j

As

Integer

= 0

To

ItemCfgColl.Item.Length - 1

Dim

newDevice

As

iLON_SmartServer.LON_Device_Cfg =

DirectCast

(ItemCfgColl.Item(j), iLON_SmartServer.LON_Device_Cfg)

Console.WriteLine(((

"New Device Created = "

& newDevice.UCPTname &

". Status = "

) +

newDevice.UCPTcommissionStatus.Value

&

" and "

) +

newDevice.UCPTapplicationStatus.Value

&

"."

& vbCr)

Next

End

If

Console.ReadLine()

Finally

SmartServer.CloseBindingToSmartServer()

End Try

End

Sub

End

Module

21.2.5

Commissioning External Devices in Visual Basic.NET

This VB console example reads the of external LonWorks devices (obtained using
an xSelect), commissions any unconfigured devices, and reports the status of the network management
commands. Note that this example does not include code for checking that all the network
management commands have been completed before terminating.

You can execute this code after you have referenced and inherited from the SmartServer WSDL as
described in section 20.1, and instantiated and initialized the Web service client as described in section
20.2.3.

For more information on the network management commands issued in this example, see section
14.3.3.1, Issuing Network Management Commands.

Module

CommDeviceModule


Sub

Main()

'See Section 20.2.3 for more information on iLON_SoapCalls class

Dim

SmartServer

As

iLON_SoapCalls =

New

iLON_SoapCalls

SmartServer.BindClientToSmartServer()

Try