beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 373

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-21

Console

.Out.WriteLine(deviceItemsCheck.UCPTname +

"RESET REQUEST STATUS =

"

+ deviceItemsCheck.Command[2].UCPTstatus.Value);

if

(bOnlineFail && deviceItemsCheck.Command[2].fault !=

null

)

{

Console

.Out.WriteLine(

"Error string: "

+

deviceItemsCheck.Command[2].fault.faultstring +

", Error Code"

+

deviceItemsCheck.Command[2].fault.faultcode);

}

if

((bOnlinePass || bOnlineFail) &&

(bCommissionPass || bCommissionFail) &&
(bResetPass || bResetFail))
{

// this device is done

}

else

{
bAllDone =

false

;

break

;

}
}

if

(!bAllDone)

{

Thread

.Sleep(15000);

}
}

while

(!bAllDone);

}

finally

{

iLON_SoapCalls

.CloseBindingToSmartServer();

}

}
}
}

21.1.6

Discovering and Installing External Devices in Visual C# .NET

This console example scans a L

ON

W

ORKS

network for uncommissioned devices, processes the Neuron

ID and program ID data of the discovered devices, and then commissions the devices, starts the
devices’ applications, and gets the devices’ templates (to display the devices’ functional blocks and
data points in the SmartServer Web interface). The example then prints out the names and statuses of
the devices that have been installed.

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.
You must also upload the device interface (XIF) files of the devices you are discovering and
installing to the root/LonWorks/import folder on the SmartServer flash disk, or create device templates
(XML files) for the devices.

For more information on discovering uncommissioned L

ON

W

ORKS

devices, see section 14.1.3.2,

Issuing Network Scan Commands to Discover Devices.

using

System;

using

System.Collections.Generic;

using

System.Linq;

using

System.Text;

using

System.Threading;

namespace

ConsoleApplication_CSharp_Test_3._5

{

class

Program

{

static

public

byte

[] HexStringToArray(

string

str)