System information

Table Of Contents
i.LON SmartServer 2.0 Programmer’s Reference
21-3
21.1.2.1 Creating a Data Logger
The following C# console example creates a new data logger from an existing uninstantiated (hidden)
data logger on the SmartServer, specifies the type, format, and size of the new data logger, and then
specifies that the data logger record both of the SmartServer’s digital relay outputs every minute (the
Net/LON/iLON App/Digital Output 1/nviClaValue_1 and Net/LON/iLON App/Digital Output
2/nviClaValue_2 data points).
For more information on the data logger properties set in this example, see
section 5.3.2, Using the
Get Function on a Data Logger.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace SmartServerConsoleExample
{
class Program
{
// 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 PrintGetError(iLON_SmartServer.Item_CfgColl ItemCfgColl)
{
// print out error and exit
Console.Out.WriteLine("An error occurred:");
for (int j = 0; j < ItemCfgColl.Item.Length; j++)
{
if (ItemCfgColl.Item[j].fault != null)
{
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
{