Echelon i.LON SmartServer 2.0 User Manual
Page 360

i.LON SmartServer 2.0 Programmer’s Reference
21-8
Console
.Out.WriteLine(
"Item: "
+ ItemCfgColl.Item[j].UCPTname +
", fault code: "
+
ItemCfgColl.Item[j].fault.faultcode
+
", fault string: "
+
ItemCfgColl.Item[j].fault.faultstring);
}
}
}
static
void
PrintGetError(iLON_SmartServer.
Item_Coll
ItemColl)
{
// print out error and exit
Console
.Out.WriteLine(
"An error occurred:"
);
for
(
int
j = 0; j < ItemColl.Item.Length; j++)
{
if
(ItemColl.Item[j].fault !=
null
)
{
Console
.Out.WriteLine(
"Item: "
+ ItemColl.Item[j].UCPTname +
", fault code: "
+
ItemColl.Item[j].fault.faultcode
+
", fault string: "
+
ItemColl.Item[j].fault.faultstring);
}
}
}
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;
try
{
// -------------- CREATING A SCHEDULER --------------
//Create an xSelect object and then specify the filter to be used
iLON_SmartServer.
E_xSelect
xSelect =
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
iLON_SmartServer.
Item_Coll
ItemColl = SmartServer.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\"]"
;
iLON_SmartServer.
Item_CfgColl
ItemCfgColl = SmartServer.Get(ItemColl);
//check that there are obejcts in the ItemCfgColl
if
(ItemCfgColl.UCPTfaultCount > 0)
{
PrintGetError(ItemCfgColl);
}
else
{
//Create LON_Fb_Cfg item
ItemCfgColl.Item[0].UCPThidden = 0;
ItemCfgColl.Item[0].UCPTname =
"Net/LON/iLON App/myScheduler"
;
iLON_SmartServer.
Item_Coll
ItemColl_SetReturn = SmartServer.Set(ItemCfgColl);
//create new Scheduler from existing one
iLON_SmartServer.
UFPTscheduler_Cfg
myScheduler =
new
iLON_SmartServer.
UFPTscheduler_Cfg
();