beautypg.com

7 configuring the smartserver in visual basic.net – Echelon i.LON SmartServer 2.0 User Manual

Page 403

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-51

21.2.7

Configuring the SmartServer in Visual Basic.NET

This console example uses the system information methods in the SmartServer’s system WSDL
(iLON100_System.wsdl) to check the SmartServer's current time and system information and then
sets a new time. Note that the iLON_SoapCalls class references the iLON100_System Web service
instead of the iLON100 Web service.

You can execute this code after you have referenced and inherited from the SmartServer WSDL as
described in section 20.1.

For more information on the system information properties set in this example, see section 19.1,
System Service Methods.

Main Program

Imports

System.Threading

'make sure you add this statement

Module

SystemTimeModule


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


'This code checks the SmartServer's time and system info and then sets a new time

'------------Checking System Time-------------------------------------------

Console.Out.WriteLine(

"Checking the SmartServer's System Time"

+ vbNewLine)


Dim

time

As

New

iLON_SmartServer_System.messageProperties_system()


Dim

timeData

As

String

=

"SI_TIME"

Dim

timeResult

As

String

= SmartServer._iLON.SystemService_Read_Info(time, timeData)

Console.Out.WriteLine(timeResult)

'------------Checking System Information-------------------------------------------

Console.Out.WriteLine(vbNewLine +

"Checking the SmartServer's System Information"

+

vbNewLine)

Dim

systemInfo

As

New

iLON_SmartServer_System.messageProperties_system()


Dim

staticData

As

String

=

"SI_STATIC"

Dim

staticResult

As

String

=

SmartServer._iLON.SystemService_Read_Info(systemInfo, staticData)


Console.Out.WriteLine(staticResult)

'------------Changing System Time-------------------------------------------

Console.Out.WriteLine(vbNewLine +

"Changing the SmartServer's System Time"

+ vbNewLine)


Dim

revisedTime

As

New

iLON_SmartServer_System.messageProperties_system()


Dim

revisedTimeData

As

String

=

"

2008-07-05T10:20:00"

Dim

revisedTimeResult

As

String

=

SmartServer._iLON.SystemService_Write_Info(revisedTime, revisedTimeData)

Console.Out.WriteLine(revisedTimeResult)

Console.Out.WriteLine(vbNewLine +

"Take a 10-second break to see if time updates properly "

+