2 reading a data logger – Echelon i.LON SmartServer 2.0 User Manual
Page 385

i.LON SmartServer 2.0 Programmer’s Reference
21-33
myDataLogger.DataPoint(1) = dataPointRef2
'call Set function
Dim
itemCfgColl__2
As
New
iLON_SmartServer.Item_CfgColl()
itemCfgColl__2.Item =
New
iLON_SmartServer.Item_Cfg(0) {}
itemCfgColl__2.Item(0) = myDataLogger
Dim
ItemColl_Set_DataLogger_Return
As
iLON_SmartServer.Item_Coll =
SmartServer._iLON.Set(itemCfgColl__2)
If
ItemColl_Set_DataLogger_Return.UCPTfaultCount > 0
Then
Exit
Sub
Else
Dim
newDataLogger
As
iLON_SmartServer.Item = ItemColl_Set_DataLogger_Return.Item(0)
Console.WriteLine(
"New Data Logger = "
& newDataLogger.UCPTname)
End
If
End
If
Console.ReadLine()
Finally
SmartServer.CloseBindingToSmartServer()
End Try
End
Sub
End
Module
21.2.2.2 Reading a Data Logger
This VB console example reads and prints out the last 10 entries for one of the two data points
recorded by the new data logger you created in the previous section, Creating a Data Logger. For
more information on the data logger properties used in this example, see section 5.3.4, Using the Read
Function on a Data Logger.
Module
ReadDataLogModule
Private
Sub
PrintGetError(
ByVal
ItemColl
As
iLON_SmartServer.Item_Coll)
' print out error and exit
Console.Out.WriteLine(
"An error occurred:"
)
For
j
As
Integer
= 0
To
ItemColl.Item.Length - 1
If
ItemColl.Item(j).fault
IsNot
Nothing
Then
Console.Out.WriteLine(((
"Item: "
& ItemColl.Item(j).UCPTname &
", fault code: "
) +
ItemColl.Item(j).fault.faultcode.Value
&
", fault string: "
) +
ItemColl.Item(j).fault.faultstring)
End
If
Next
End
Sub
Public
Sub
Main()
Dim
SmartServer
As
iLON_SoapCalls =
New
iLON_SoapCalls
SmartServer.BindClientToSmartServer()
Try
' -------------- READING A DATA LOGGER --------------
'Create an xSelect object and then specify the filter to be used
Dim
xSelect
As
New
iLON_SmartServer.E_xSelect()
xSelect.xSelect =
"//Item[UCPTname = ""Net/LON/iLON App/myDataLogger""]"
'Create an ItemColl that stores objects returned by List()function that takes an xSelect object
Dim
ItemColl
As
iLON_SmartServer.Item_Coll = SmartServer._iLON.List(xSelect)
'check that there are obejcts in the ItemColl
If
ItemColl.UCPTfaultCount > 0
Then