Write() – Echelon i.LON SmartServer 2.0 User Manual
Page 234

220
Appendix A - Programmer’s Reference
• -1. The data point value is read from the SmartServer’s internal data server. The poll rate
used by the FPM application is set to the poll rate configured for that data point in its Setup -
LON Data Point Driver Web page. This is the default.
• 0. The data point value is read directly from the data point. Note that because the data point
value is being read synchronously, the FPM application may not able to perform any other
processing until it receives the data point value.
• >1. The value you specify is compared to the amount of time that the data point value has
been cached in the SmartServer’s internal data server.
o
If nMaxAgeMillis is less than the period of time the data point value has been cached,
the internal data server polls the data point and returns the updated value to the FPM
application.
o
If nMaxAgeMillis is greater than the period of time the data point value has been
cached, the internal data server returns the cached value to the FPM application.
The STATUS value returned by this method can either be ERROR or OK
If you want to read only the values of the data points returned by the List()method, you can use a
Read()
method that does not take the bReadProperties parameter. In this case, the Read()
method has the following signature:
STATUS Read(const CFpmItemInfo& rMeta,
Byte* const pbyValue,
unsigned int nSize,
int nMaxAgeMillis = -1);
EXAMPLE
The following example demonstrates a Read()method that evaluates the value of a data point
returned by a List() method.
FpmItemInfoColl_t items;
SNVT_time_stamp time;
if(List("//Item[@xsi:type=\"Dp_Cfg\"][contains(UCPTname,
\"nvoRtTime Date\")]", items)) == OK
{
printf("\nitems.size()=%d",
items.size());
if(!Read(items[0],(Byte*)&time,
sizeof(SNVT_time_stamp)))
{
printf("\nnvoRtTimeDate: %d-%d-%d %d:%d:%d", time.year,
time.month, time.day, time.hour, time.minute,
time.second);
} else printf("\nRead failed");
}else printf("\nList failed");
Write()
You can perform a Write() method in an FPM application to write values to the data points returned
by the List() method.
SYNTAX
STATUS Write(const FPM::FpmItem& rFpmItem, Byte* pbyValue);
In the rFpmItem parameter, you must specify an object obtained by the List() method. The
object’s cfgItemDepth property must be of type ItemCfgDepth_Fb or
ItemCfgDepth_Dp
; otherwise, this method returns an ERROR in the STATUS value.