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 optionalUniDir = BitConverter.ToInt16(new byte[] { 0xFC, 0x01 }, 0); 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(10000); var response = connection.Set(new RegisterSettings { IntPart = register.IntPart, Fraction = 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 = "816232411982", ProgrammableID = "816232411982", FactoryID = "816232411982", 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()); } } } /**1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 * T 1 X 9 X X 2 G X A 0 X L S D * T 1 X 9 X X B G 1 A 0 X L S D * T 2 X 9 X X 2 G X A 0 X L S D * T 2 X 9 X X B G 1 A 0 X L S D * R 1 X 9 X X 2 G X A 0 X L S D * R 2 X 9 X X 2 G X A 0 X L S D * * C 1 X 9 X X 2 G X A 0 X L S D * C 1 X 9 X X B G 1 A 0 X L S D * * C 2 X 9 X X 2 G X A 0 X L S D * C 2 X 9 X X B G 1 A 0 X L S D */