beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 387

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-35

' print out error and exit

Console.Out.WriteLine(

"An error occurred:"

)

For

j

As

Integer

= 0

To

ItemCfgColl.Item.Length - 1

If

ItemCfgColl.Item(j).fault

IsNot

Nothing

Then

Console.Out.WriteLine(((

"Item: "

& ItemCfgColl.Item(j).UCPTname &

", fault code: "

) +

ItemCfgColl.Item(j).fault.faultcode.Value

&

", fault string: "

) +

ItemCfgColl.Item(j).fault.faultstring)

End

If

Next

End

Sub

Private

Sub

PrintGetError(

ByVal

ItemColl

As

iLON_SmartServer.Item_Coll)

' print out error and exit

Console.Out.WriteLine(

"An error occurred:"

)

For

j

As

Integer

= 0

To

ItemColl.Item.Length - 1

If

ItemColl.Item(j).fault

IsNot

Nothing

Then

Console.Out.WriteLine(((

"Item: "

& ItemColl.Item(j).UCPTname &

", fault code: "

) +

ItemColl.Item(j).fault.faultcode.Value

&

", fault string: "

) +

ItemColl.Item(j).fault.faultstring)

End

If

Next

End

Sub

Public

Sub

Main()


Dim

SmartServer

As

iLON_SoapCalls =

New

iLON_SoapCalls

SmartServer.BindClientToSmartServer()

Try


' -------------- CREATING A SCHEDULER --------------

'Create an xSelect object and then specify the filter to be used

Dim

xSelect

As

New

iLON_SmartServer.E_xSelect()

xSelect.xSelect =

"//Item[@xsi:type=""LON_Fb_Cfg""][contains(UCPTname,""Scheduler"")][UCPThidden = ""1""]"

'Create an ItemColl that stores objects returned by List()function that takes an xSelect object

Dim

ItemColl

As

iLON_SmartServer.Item_Coll = SmartServer._iLON.List(xSelect)


'Create an ItemCfgColl that stores the objects to be returned by a Get() function that takes

'the ItemColl returned by the List()


ItemColl.xSelect =

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

Dim

ItemCfgColl__1

As

iLON_SmartServer.Item_CfgColl = SmartServer._iLON.Get(ItemColl)


'check that there are obejcts in the ItemCfgColl

If

ItemCfgColl__1.UCPTfaultCount > 0

Then

PrintGetError(ItemCfgColl__1)

Else


'Create LON_Fb_Cfg item

ItemCfgColl__1.Item(0).UCPThidden = 0
ItemCfgColl__1.Item(0).UCPTname =

"Net/LON/iLON App/myScheduler"

Dim

ItemColl_SetReturn

As

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

'create new Scheduler from existing one

Dim

myScheduler

As

New

iLON_SmartServer.UFPTscheduler_Cfg()

myScheduler.UCPTname =

"Net/LON/iLON App/myScheduler"

myScheduler.UCPTannotation =

"#8000010128000000[4].UFPTscheduler"

'create DP reference array to store data points controlled by new Scheduler

myScheduler.DataPoint =

New

iLON_SmartServer.E_DpRef(1) {}


'speficy data points to be controlled by new Scheduler

Dim

dataPointRef1

As

New

iLON_SmartServer.UFPTscheduler_DpRef()