Echelon i.LON SmartServer 2.0 User Manual
Page 371
i.LON SmartServer 2.0 Programmer’s Reference
21-19
// If you are using NET 2.0 Framework, uncomment the following line of code to enter your
// SmartServer’s IP Address
// public static string _iLonEndpointIpAddress = "<SmartServer IP Address>";
static
void
Main(
string
[] args)
{
iLON_SoapCalls
.BindClientToSmartServer();
// If you are using NET 2.0 Framework, comment out the previous line of code, and then
// uncomment the following line of code
// iLON_SoapCalls.BindClientToSmartServer(_iLonEndpointIpAddress);
iLON_SmartServer.
iLON100portTypeClient
SmartServer =
iLON_SoapCalls
._iLON;
// See Section 20.2.1 (NET 3.5) or 20.2.2 (NET 2.0)for more information on iLON_SoapCalls class
try
{
//------------Commissioning Uncommissioned External LonWorks Devices---------------------
Console
.Out.WriteLine(
"Commissioning Uncommissioned External LonWorks Devices with an
xSelect\r\n -------------------------------\r\n -------------------------------\r\n"
);
//we create an xSelect object and then specify the filter to be used
iLON_SmartServer.
E_xSelect
xSelect =
new
SmartServerConsoleExample.iLON_SmartServer.
E_xSelect
();
xSelect.xSelect =
"//Item[@xsi:type=\"LON_Device_Cfg\"][UCPTitemStatus=\"IS_UNCONFIGURED\"]"
;
//Create an ItemColl that stores objects returned by List()function that takes an xSelect
//object
iLON_SmartServer.
Item_Coll
ItemColl = SmartServer.List(xSelect);
//we use an xSelect to further filter the items returned by the List() function
ItemColl.xSelect =
"//Item[@xsi:type=\"LON_Device_Cfg\"][UCPTlocal =\"0\"]";
//we create an ItemCfgColl that stores the objects returned by a Get() function that
//takes the ItemColl returned by the List()
iLON_SmartServer.
Item_CfgColl
ItemCfgColl = SmartServer.Get(ItemColl);
//check that there are obejcts in the ItemCfgColl
if
(ItemCfgColl.UCPTfaultCount > 0)
{
PrintGetError(ItemCfgColl);
}
else
{
for
(
int
i = 0; i < ItemCfgColl.Item.Length; i++)
{
iLON_SmartServer.
LON_Device_Cfg
deviceItems =
(iLON_SmartServer.
LON_Device_Cfg
)ItemCfgColl.Item[i];
Console
.Out.WriteLine(deviceItems.UCPTname +
", STATUS = "
+
deviceItems.UCPTitemStatus.Value +
"\r\n"
);
deviceItems.UCPTcommissionStatus.Value =
"COMMISSIONED"
;
deviceItems.UCPTapplicationStatus.Value =
"APP_RUNNING"
;