diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index 883679a3..a894c3cf 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs index a42fd093..8e809a98 100644 --- a/Common/CommonConsole/Program.cs +++ b/Common/CommonConsole/Program.cs @@ -1,20 +1,20 @@ namespace CommonConsole { - using Common.Hardware.WaterMeter.eRegister.Telegrams; - using Microsoft.SharePoint.Client; - using System; - using System.Security; public static class Program { public static void Main() { - var semiBytes25747925 = new byte[] { 0x08, 0x03, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x00, 0x01, 0xF4, 0x00, 0x00, 0x83, 0x0C, 0x00, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x13, 0x01, 0x88, 0xE1, 0xD5, 0x07, 0x0E, 0x10, 0xEC, 0x56, 0x13, 0xDA, 0x4C, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x1E, 0x00, 0x03, 0x01, 0x2F, 0xBE, 0xCA, 0x47, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xEF, 0xA6 }; - var semi25747925 = new SEMI(semiBytes25747925, 868, 0); + var x = (625L * 65536) | 0x80_00_00_00; - var debugBytes25747925 = new byte[] { 0x0B, 0x10, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x0C, 0x11, 0x0B, 0x11, 0x08, 0x04, 0x02, 0x7C, 0x4C, 0x12, 0x84, 0x15, 0x00, 0x66, 0x00, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x8F, 0xD2, 0x02, 0x01, 0x01, 0x16, 0x00, 0x1B, 0x02, 0x71, 0x00, 0x00, 0x82, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xA0, 0xA5 }; - var debug25747925 = new DEBUG(debugBytes25747925, 0); + Console.WriteLine((int)x); + + //var semiBytes25747925 = new byte[] { 0x08, 0x03, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x00, 0x01, 0xF4, 0x00, 0x00, 0x83, 0x0C, 0x00, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x13, 0x01, 0x88, 0xE1, 0xD5, 0x07, 0x0E, 0x10, 0xEC, 0x56, 0x13, 0xDA, 0x4C, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x1E, 0x00, 0x03, 0x01, 0x2F, 0xBE, 0xCA, 0x47, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xEF, 0xA6 }; + //var semi25747925 = new SEMI(semiBytes25747925, 868, 0); + + //var debugBytes25747925 = new byte[] { 0x0B, 0x10, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x0C, 0x11, 0x0B, 0x11, 0x08, 0x04, 0x02, 0x7C, 0x4C, 0x12, 0x84, 0x15, 0x00, 0x66, 0x00, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x8F, 0xD2, 0x02, 0x01, 0x01, 0x16, 0x00, 0x1B, 0x02, 0x71, 0x00, 0x00, 0x82, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xA0, 0xA5 }; + //var debug25747925 = new DEBUG(debugBytes25747925, 0); //var siteUrl = "https://1xylemeur.sharepoint.com/sites/geckoSrc/customer/Pub_CSD/Forms/AllItems.aspx"; diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs index 408c9f2a..ef909814 100644 --- a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs +++ b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs @@ -81,7 +81,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers public static readonly String StartHit = "GENESISFLOW_StartHit"; public static readonly String NumFirePulses = "GENESISFLOW_NumFirePulses"; public static readonly String LookupFileCrc = "GENESISFLOW_LookupFileCrc"; - + public static readonly String DisplayUnits = "GENESISFLOW_DisplayUnits"; + public static readonly String SealDisplay = "GENESISFLOW_SealDisplay"; }; public static class Powermon diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj index 3f79a018..92718aca 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj @@ -49,6 +49,7 @@ + @@ -96,6 +97,7 @@ + diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs index 9ce560f5..82b8893a 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs @@ -89,8 +89,7 @@ private EregisterProgrammingParameters GetProgrammingParameters() { - var alarms = new AlarmsMask(this.SEMIMessage.AlarmActiveInformation); - + var alarms = this.SEMIMessage.AlarmActiveInformation; var dataLogContent = new ChangeDataLoggerSettings(); dataLogContent.SetLogContent(this.SEMIMessage.LogContent); @@ -113,7 +112,7 @@ OffsetTime = this.DEBUGMessage.OffsetTime, FactoryCalibration = (byte)(this.DEBUGMessage.FactoryCalibration * 10), UnitsOfMessureSEMI = (byte)this.SEMIMessage.Units, - MeterSize = this.SEMIMessage.MeterSize, + MeterSize = (byte)this.SEMIMessage.MeterSize, Alarm_Backflow = alarms.Backflow, Alarm_Broken_Pipe = alarms.BrokenPipe, Alarm_Leakage = alarms.Leak, diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs index b8907c57..74b92b0c 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs @@ -1,6 +1,7 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { using Common.Hardware.SIRT; + using System.Text; public class AlarmsMask : Pam { @@ -66,5 +67,21 @@ return base.ToByteArray(); } + + public override System.String ToString() + { + var alarmMaskBuilder = new StringBuilder(); + + alarmMaskBuilder.AppendLine($"{nameof(this.SpecificError)}: {this.SpecificError}"); + alarmMaskBuilder.AppendLine($"{nameof(this.MediumAbsent)}: {this.MediumAbsent}"); + alarmMaskBuilder.AppendLine($"{nameof(this.BrokenPipe)}: {this.BrokenPipe}"); + alarmMaskBuilder.AppendLine($"{nameof(this.Backflow)}: {this.Backflow}"); + alarmMaskBuilder.AppendLine($"{nameof(this.MetrologyUnavailable)}: {this.MetrologyUnavailable}"); + alarmMaskBuilder.AppendLine($"{nameof(this.MagneticTamper)}: {this.MagneticTamper}"); + alarmMaskBuilder.AppendLine($"{nameof(this.Leak)}: {this.Leak}"); + alarmMaskBuilder.AppendLine($"{nameof(this.LowBattery)}: {this.LowBattery}"); + + return alarmMaskBuilder.ToString().Trim(); ; + } } } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MessurementUnits.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MessurementUnits.cs index e1c3aa85..329cf5c1 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MessurementUnits.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MessurementUnits.cs @@ -2,15 +2,15 @@ { public enum MessurementUnits : byte { - CubicMeters = 0, + Cubic_Meters = 0, m3 = 19, - CubicFeet = 1, + Cubic_Feet = 1, CF = 35, - USGallons = 4, + US_Gallons = 4, GAL = 24, - ImperialGallons = 5, + Imperial_Gallons = 5, IGAL = 144, - AcreFeet = 6, + Acre_Feet = 6, Kiloliters = 7, kl = 19, } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterSizes.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterSizes.cs new file mode 100644 index 00000000..2e5a027c --- /dev/null +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterSizes.cs @@ -0,0 +1,29 @@ +namespace Common.Hardware.WaterMeter.eRegister.Features +{ + public enum MeterSizes + { + Meistream__DN40 = 23, + Meistream__DN50 = 24, + Meistream__DN65 = 25, + Meistream__DN80 = 26, + Meistream__DN100 = 27, + Meistream__DN125 = 28, + Meistream__DN150 = 29, + Meistream__DN200 = 30, + Meistream__DN250 = 31, + Meistream__DN300 = 32, + Meistream__Plus__DN40 = 36, + Meistream__Plus__DN50 = 37, + Meistream__Plus__DN65 = 38, + Meistream__Plus__DN80 = 39, + Meistream__Plus__DN100 = 40, + Meistream__Plus__DN150 = 41, + Meitwin__DN50 = 45, + Meitwin__DN65 = 46, + Meitwin__DN80 = 47, + Meitwin__DN100 = 48, + Meitwin__MB = 49, + WPV__MS__DN150 = 56, + Nebenzaehler__DN4 = 53, + } +} diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterTypes.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterTypes.cs index 7e551def..e5249834 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterTypes.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/MeterTypes.cs @@ -4,5 +4,7 @@ { Residential = 0, CandI = 1, + Residential__0x0B = 11, + CandI__0x0C = 12, } } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs index 7ca4d8fb..1979ce16 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs @@ -31,7 +31,7 @@ this.RegisterMode = payload[34]; this.HistorySize = payload[35]; this.FactoryCalibration = payload[36] / 10F; - this.MeterSize = payload[37]; + this.MeterSize = (MeterSizes)payload[37]; this.VolumePerLedPulse = payload.ToUInt32BE(38); this.VolumePerPulse = payload.ToInt32BE(42); this.OffsetFactor = payload.ToInt32BE(46); @@ -89,7 +89,7 @@ public float FactoryCalibration { get; } - public byte MeterSize { get; } + public MeterSizes MeterSize { get; } public uint VolumePerLedPulse { get; } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs index a0784247..79ed7d71 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs @@ -15,7 +15,7 @@ { this.PAMStatus = new PAMStatus(payload[11]); this.RSSI = new RSSI(payload[12], mhz); - this.MeterType = payload[13]; + this.MeterType = (MeterTypes)payload[13]; this.TransmissionInterval = payload.ToUInt16BE(14); this.LATInterval = payload[16]; this.CurrentFlow = payload.ToUInt16BE(17); @@ -25,7 +25,7 @@ this.MeterID = payload.ToUInt32BE(25); this.MBusStatus = payload[29]; this.MBusTransmissionInterval = payload.ToUInt16BE(30); - this.AlarmActiveInformation = payload[32]; + this.AlarmActiveInformation = new AlarmsMask(payload[32]); this.LeakageDetectionParameters = payload[33]; this.BrokenPipeDetectionParameters = payload[34]; this.BatteryRemainingYears = payload.ToUInt16BE(35) / (4D * 365); @@ -52,7 +52,7 @@ this.CustomerSpecificText = Encoding.ASCII.GetString(payload, 77, 9); this.TimeOfFDRReset = payload.ToUInt16BE(86); this.TimeOfLogReset = payload.ToUInt16BE(88); - this.MeterSize = payload[90]; + this.MeterSize = (MeterSizes)payload[90]; this.Crc = 0; if (payload.Length > MIN_LENGTH) @@ -60,16 +60,12 @@ this.Crc = payload.ToUInt16BE(91); } } - - public uint ModuleAddress { get; } - - public AlarmsMask Alarms { get; } public PAMStatus PAMStatus { get; } public RSSI RSSI { get; } - public byte MeterType { get; } + public MeterTypes MeterType { get; } public ushort TransmissionInterval { get; } @@ -89,7 +85,7 @@ public ushort MBusTransmissionInterval { get; } - public byte AlarmActiveInformation { get; } + public AlarmsMask AlarmActiveInformation { get; } public byte LeakageDetectionParameters { get; } @@ -143,6 +139,6 @@ public ushort TimeOfLogReset { get; } - public byte MeterSize { get; } + public MeterSizes MeterSize { get; } } } diff --git a/Common/Ui/Common.UI/Common.UI.csproj b/Common/Ui/Common.UI/Common.UI.csproj index 1950d3b3..75c974b4 100644 --- a/Common/Ui/Common.UI/Common.UI.csproj +++ b/Common/Ui/Common.UI/Common.UI.csproj @@ -168,6 +168,9 @@ ManualProgramming.xaml + + SetMetrologyParameters.xaml + @@ -179,6 +182,9 @@ + + + @@ -257,6 +263,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/Common/Ui/Common.UI/Infrastructure/TaskStateToBackgroundBrushConverter.cs b/Common/Ui/Common.UI/Infrastructure/TaskStateToBackgroundBrushConverter.cs index a1eb0571..23c8c077 100644 --- a/Common/Ui/Common.UI/Infrastructure/TaskStateToBackgroundBrushConverter.cs +++ b/Common/Ui/Common.UI/Infrastructure/TaskStateToBackgroundBrushConverter.cs @@ -25,9 +25,13 @@ switch (label) { case nameof(SIRTTaskState.Pending):; break; + case nameof(SIRTTaskState.Completed): brush = success; break; + case nameof(SIRTTaskState.Cancelled): brush = error; break; + case nameof(SIRTTaskState.Running): brush = warning; break; case nameof(SIRTConstants.BUP): brush = warning; break; case nameof(SIRTConstants.LAT): brush = warning; break; case nameof(SIRTConstants.DEBUG): brush = info; break; + case nameof(SIRTConstants.SEMI): brush = success; break; case nameof(PAMStatus.OK): brush = success; break; case "AKN": brush = warning; break; default: brush = error; break; diff --git a/Common/Ui/Common.UI/Infrastructure/TaskStateToForegroundBrushConverter.cs b/Common/Ui/Common.UI/Infrastructure/TaskStateToForegroundBrushConverter.cs index 82679ad4..9a4dd82f 100644 --- a/Common/Ui/Common.UI/Infrastructure/TaskStateToForegroundBrushConverter.cs +++ b/Common/Ui/Common.UI/Infrastructure/TaskStateToForegroundBrushConverter.cs @@ -20,9 +20,13 @@ switch (label) { case nameof(SIRTTaskState.Pending):; break; + case nameof(SIRTTaskState.Completed): brush = Brushes.DarkGreen; break; + case nameof(SIRTTaskState.Cancelled): brush = Brushes.DarkRed; break; + case nameof(SIRTTaskState.Running): brush = Brushes.DarkOrange; break; case nameof(SIRTConstants.BUP): brush = Brushes.DarkOrange; break; case nameof(SIRTConstants.LAT): brush = Brushes.DarkOrange; break; case nameof(SIRTConstants.DEBUG): brush = Brushes.DarkBlue; break; + case nameof(SIRTConstants.SEMI): brush = Brushes.DarkGreen; break; case nameof(PAMStatus.OK): brush = Brushes.DarkGreen; break; case "AKN": brush = Brushes.DarkOrange; break; default: brush = Brushes.DarkRed; break; diff --git a/Common/Ui/Common.UI/Infrastructure/VMLocator.cs b/Common/Ui/Common.UI/Infrastructure/VMLocator.cs index 2afb9774..82faf53d 100644 --- a/Common/Ui/Common.UI/Infrastructure/VMLocator.cs +++ b/Common/Ui/Common.UI/Infrastructure/VMLocator.cs @@ -4,14 +4,16 @@ public class VMLocator { - public SIRTBroadcastersVM SIRTBroadcasterVM { get; } = new SIRTBroadcastersVM(); + // public SIRTBroadcastersVM SIRTBroadcasterVM { get; } = new SIRTBroadcastersVM(); - public EregisterHistoryVM EregisterHistoryVM { get; } = new EregisterHistoryVM(); + //public EregisterHistoryVM EregisterHistoryVM { get; } = new EregisterHistoryVM(); - public EregisterInitializeVM EregisterInitializeVM { get; } = new EregisterInitializeVM(); + //public EregisterInitializeVM EregisterInitializeVM { get; } = new EregisterInitializeVM(); - public EregisterFinalizeVM EregisterFinalizeVM { get; } = new EregisterFinalizeVM(); + //public EregisterFinalizeVM EregisterFinalizeVM { get; } = new EregisterFinalizeVM(); - public ManualProgrammingVM ManualProgrammingVM { get; } = new ManualProgrammingVM(); + //public ManualProgrammingVM ManualProgrammingVM { get; } = new ManualProgrammingVM(); + + public SetMetrologyParametersVM SetMetrologyParametersVM { get; } = new SetMetrologyParametersVM(); } } diff --git a/Common/Ui/Common.UI/MainWindow.xaml b/Common/Ui/Common.UI/MainWindow.xaml index 3ae01fa8..d9df9c04 100644 --- a/Common/Ui/Common.UI/MainWindow.xaml +++ b/Common/Ui/Common.UI/MainWindow.xaml @@ -2,6 +2,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShowsNavigationUI="False" - Source="Pages/ManualProgramming.xaml" - Title="TestBench UI"> + Source="Pages/SetMetrologyParameters.xaml" + Title="PAM 146: Set metrology parameters"> diff --git a/Common/Ui/Common.UI/Pages/SetMetrologyParameters.xaml b/Common/Ui/Common.UI/Pages/SetMetrologyParameters.xaml new file mode 100644 index 00000000..459e1e4b --- /dev/null +++ b/Common/Ui/Common.UI/Pages/SetMetrologyParameters.xaml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +