100 lines
3.6 KiB
C#
100 lines
3.6 KiB
C#
namespace CommonConsole
|
|
{
|
|
using OmniPlus;
|
|
using OmniPlus.Features;
|
|
using OmniPlus.Features.Enums;
|
|
|
|
using System;
|
|
using System.Text;
|
|
using System.Threading;
|
|
|
|
public static class Program
|
|
{
|
|
public static void Main()
|
|
{
|
|
var protokoll = new StringBuilder();
|
|
var connection = new OmniIrdaConnection("COM36");
|
|
connection.StateChenged += x => protokoll.AppendLine(x.ToString());
|
|
connection.StateChenged += Console.WriteLine;
|
|
connection.Open();
|
|
|
|
if (connection.FactorySeal().Sealed)
|
|
{
|
|
var _sealed = connection.FactorySeal(false);
|
|
}
|
|
|
|
var system = connection.ViewSystemParameters();
|
|
var register = connection.ViewRegisterSettings();
|
|
var configuration = connection.ViewConfigurationParameters();
|
|
var systemReset = connection.Set(new SystemTime());
|
|
|
|
Thread.Sleep(30000);
|
|
|
|
var response = connection.Set(new RegisterSettings
|
|
{
|
|
IntPart = register.IntPart,
|
|
Fraction = (ushort)register.Fraction,
|
|
Size = register.Size,
|
|
Range = register.Range,
|
|
VolumePerPulseUnit = 0x00,
|
|
MeterUnits = (byte)MessurementUnits.USGallons,
|
|
FlowUnits = (byte)MessurementUnits.USGallons,
|
|
FlowRate = (byte)TimeUnits.Minutes,
|
|
FactoryCorrection = 0x00,
|
|
FieldCorrection = 0x00,
|
|
PulseWeight = 1,
|
|
PulseWidth = 2,
|
|
PulseUpdate = 0,
|
|
});
|
|
|
|
response = connection.Set(new ConfigurationParametersSet
|
|
{
|
|
BuildInfo = system.BuildInfo.Value,
|
|
ProgrammableID = configuration.ProgrammableID.Value,
|
|
FactoryID = configuration.FactoryID.Value,
|
|
AlarmPercistancePeriodDays = 31,
|
|
DataLogIntervalMinutes = 60,
|
|
ManifacturingTime = system.ManifacturingTime.SecondsSince,
|
|
NumberOfReadingDigits = 8,
|
|
OptionalUniDirFields = 0x01FC,
|
|
ReadingPreset = "000000010",
|
|
RebootCount = 0,
|
|
SystemTime = Epoch20000101.UTCNow,
|
|
DeviceID = "OMNI-02"
|
|
});
|
|
|
|
response = connection.ClearDisplay();
|
|
response = connection.Set(new LeakAlarm
|
|
{
|
|
FlowRateGPM = 0.25F,
|
|
TimeLimit = 24 * 60 * 60
|
|
});
|
|
response = connection.Set(new HighFlowAlarm
|
|
{
|
|
FlowRateGPM = 25F,
|
|
TimeLimit = 1 * 60 * 60
|
|
});
|
|
response = connection.Set(new ReverseFlowAlarm
|
|
{
|
|
FlowRateGPM = -1F,
|
|
TimeLimit = 60
|
|
});
|
|
response = connection.ClearAlarms();
|
|
response = connection.EnableNFC();
|
|
var alarmsState = connection.ViewAlarmsState();
|
|
response = connection.ViewAlarmSettings(0x01);
|
|
response = connection.ViewAlarmSettings(0x02);
|
|
response = connection.ViewAlarmSettings(0x04);
|
|
response = connection.FactorySeal(true);
|
|
response = connection.FactorySeal();
|
|
system = connection.ViewSystemParameters();
|
|
register = connection.ViewRegisterSettings();
|
|
configuration = connection.ViewConfigurationParameters();
|
|
|
|
connection.Close();
|
|
|
|
Console.WriteLine();
|
|
Console.WriteLine(protokoll.ToString());
|
|
}
|
|
}
|
|
} |