Echelon i.LON SmartServer 2.0 User Manual
Page 340

i.LON SmartServer 2.0 Programmer’s Reference
20-18
"Net/LON/iLON App/Digital Output 1/nviClaValue_1"
;
((iLON_SmartServer.
Dp_ResetPrio_Invoke
)(itemCollInvoke.Item[0])).UCPTpriority = 200;
((iLON_SmartServer.
Dp_ResetPrio_Invoke
)(itemCollInvoke.Item[0])).UCPTprioritySpecified =
true
;
SmartServer.InvokeCmd(
ref
itemCollInvoke);
// set the DP priority to 200 (see section 4.3.7 for more information)
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTpriority = 200;
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTprioritySpecified =
true
;
// set 100.0 1 as the value
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTvalue =
new
iLON_SmartServer.
E_LonString
[1];
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTvalue[0] =
new
iLON_SmartServer.
E_LonString
();
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTvalue[0].Value =
"100.0 1"
;
// to write a preset, do this (see section 4.3.5.2 for more information)
// dpData.UCPTvalue[0].LonFormat = "UCPTvalueDef";
// dpData.UCPTvalue[0].Value = "ON";
// call the write function
iLON_SmartServer.
Item_Coll
writeResp = SmartServer.Write(dataColl);
if
(writeResp.Item ==
null
)
{
// sanity check. this should not happen
Console
.Out.WriteLine(
"No items were returned"
);
}
else
if
(writeResp.Item[0].fault !=
null
)
{
// error
Console
.Out.WriteLine(
"An error occurred. Fault code = "
+
writeResp.Item[0].fault.faultcode +
". Fault text = %s."
+
writeResp.Item[0].fault.faultstring);
}
else
{
// success
Console
.Out.WriteLine(
"Write is successful"
);
Console
.Out.WriteLine(((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTname +
" = "
+
((iLON_SmartServer.
Dp_Data
)dataColl.Item[0]).UCPTvalue[0].Value);
}
Console
.ReadLine();
}
finally
{
iLON_SoapCalls
.CloseBindingToSmartServer();
}
}
}
}