laatzen/Common/CommonConsole/Program.cs
2024-05-15 09:46:10 +02:00

142 lines
5.0 KiB
C#

namespace CommonConsole
{
using System;
public static class Program
{
public static void Main()
{
var minutes = TimeSpan.FromMinutes(10);
Console.WriteLine(minutes);
Console.WriteLine(minutes.TotalMilliseconds);
minutes = minutes - TimeSpan.FromSeconds(1);
Console.WriteLine(minutes);
_ = 0;
//var hexString = "5E-CC-02-1A-00-00-00-00-5E-CC-02-1A-00-00-00-00-5E-CC-02-1A-00-00-00-00-5E-CC-02-1A-00-00-00-00";
//var bytes = new List<byte>();
//var hex = string.Empty;
//foreach (var @char in hexString)
//{
// if (('0' <= @char && @char <= '9') || ('A' <= @char && @char <= 'F') || ('a' <= @char && @char <= 'f'))
// {
// hex += @char;
// }
// if (hex.Length == 2)
// {
// bytes.Add(Convert.ToByte(hex, 16));
// hex = string.Empty;
// }
//}
//Console.WriteLine(BitConverter.ToString(bytes.ToArray()));
//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
*/