using OmniPlus.Features; using System; using System.Text; using System.Windows.Forms; namespace OmniPlus.UI { public static class Program { [STAThread] public static void Main() { //var connection = new OmniPlusConnection("COM26"); //if (connection.ConnectIrda()) //{ // var response = default(FeatureResponse); // var meterId = "816232411982"; // var offset = 0; // //response = connection.Set(new ProgrammableID("816232411982")); // //response = connection.Set(new FactoryID("816232411982")); // //response = connection.Set(new ReadingDigits { Count = 9 }); // //response = connection.Set(0x14, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00); // //response = connection.Set(0x26, 0x00, 0x1F); // //var mm = BitConverter.GetBytes((ushort)60); // //response = connection.Set(0xFD, 0x7D, 0x00, mm[0], mm[1]); // //response = connection.Set(new ManifacturingTime() { DateTime = new DateTime(2023, 07, 01, 11, 12, 13, DateTimeKind.Utc) }); // //response = connection.Set(new SystemTime() { SecondsSince = Epoch20000101.UTCNow }); // //response = connection.Set(0xFD, 0x56, 0x00); // //response = connection.Set(new BuildInfo() { Value = "816232411982" }); // //response = connection.Set(new DeviceID() { Value = "OMNI-01" }); // var configurationParameters = new byte[92]; // configurationParameters[offset++] = 0xFD; // configurationParameters[offset++] = 0xC8; // // ProgrammableID: 0-20 // Encoding.ASCII.GetBytes(meterId).CopyTo(configurationParameters, offset + 0); // // FactoryID: 21-33 // Encoding.ASCII.GetBytes(meterId).CopyTo(configurationParameters, offset + 21); // // Number of reading digits: 34-35 // configurationParameters[offset + 35] = 0x09; // // Reading preset: 36-47 // Encoding.ASCII.GetBytes("000000000").CopyTo(configurationParameters, offset + 38); // // Optional Uni-directional Fields: 48-49 // // BitConverter.GetBytes((ushort)0).CopyTo(configurationParameters, offset + 48); // // Alarm Persistence Period: 50-51 // configurationParameters[offset + 51] = 31; // // Data Log Interval: 52-54 // // BitConverter.GetBytes((ushort)60).CopyTo(configurationParameters, offset + 53); // configurationParameters[offset + 53] = 60; // // MAnifacturing time: 55-58 // BitConverter // .GetBytes(new ManifacturingTime() { DateTime = new DateTime(2023, 07, 01, 11, 12, 13, DateTimeKind.Utc) }.SecondsSince) // .CopyTo(configurationParameters, 55); // // System time: 59-62 // BitConverter // .GetBytes(new SystemTime() { SecondsSince = Epoch20000101.UTCNow }.SecondsSince) // .CopyTo(configurationParameters, 59); // // Reboots count: 63 // configurationParameters[offset + 63] = 0x00; // // Build information: 64-79 // Encoding.ASCII.GetBytes(meterId).CopyTo(configurationParameters, offset + 64); // // Device ID: 80-89 // Encoding.ASCII.GetBytes("OMNI-01").CopyTo(configurationParameters, offset + 80); // response = connection.Set(configurationParameters); //} //connection.Disconnect(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new OmniPlusUI()); } } }