diff --git a/Common/.vs/Common/config/applicationhost.config b/Common/.vs/Common/config/applicationhost.config index 8f2db308..143ad9e1 100644 --- a/Common/.vs/Common/config/applicationhost.config +++ b/Common/.vs/Common/config/applicationhost.config @@ -171,7 +171,7 @@ - + diff --git a/Common/CommonConsole/CommonConsole.csproj b/Common/CommonConsole/CommonConsole.csproj index d539bb10..c4c38f16 100644 --- a/Common/CommonConsole/CommonConsole.csproj +++ b/Common/CommonConsole/CommonConsole.csproj @@ -72,5 +72,8 @@ Common.Hardware.WaterMeter.eRegister + + + \ No newline at end of file diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs index 99c04106..65a7fdb6 100644 --- a/Common/CommonConsole/Program.cs +++ b/Common/CommonConsole/Program.cs @@ -1,15 +1,117 @@ namespace CommonConsole { using System; - using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.RFTelegrams; public static class Program { static void Main() + { + var alarmMask = 0 << AlarmMask.ALARM_REBOOT + | 1 << AlarmMask.ALARM_LOW_BATTERY + | 0 << AlarmMask.ALARM_VERY_LOW_BATTERY + | 0 << AlarmMask.ALARM_CONFIG_ERROR + | 1 << AlarmMask.ALARM_EMPTY_PIPE + | 0 << AlarmMask.ALARM_MAGNETIC_TAMPER + | 0 << AlarmMask.ALARM_REVERSE_FLOW + | 1 << AlarmMask.ALARM_SUSPECT_LEAK + | 1 << AlarmMask.ALARM_BROKEN_PIPE + | 1 << AlarmMask.ALARM_LOW_PRESSURE + | 1 << AlarmMask.ALARM_HIGH_PRESSURE + | 1 << AlarmMask.ALARM_LOW_TEMPERATURE + | 1 << AlarmMask.ALARM_HIGH_TEMPERATURE + | 0 << AlarmMask.ALARM_RADIO_ERROR + | 0 << AlarmMask.ALARM_METROLOGY_PARAMS + | 0 << AlarmMask.ALARM_METROLOGY_MEASURE + | 0 << AlarmMask.ALARM_MAX; + var alarmBytes = BitConverter.GetBytes(alarmMask); + Array.Reverse(alarmBytes); + Console.WriteLine($"{"ALARMS:",11} {alarmMask,11} - {BitConverter.ToString(alarmBytes).Replace("-", "")}"); + + uint content = (uint)1 << LogContentBits.AlarmStatus // ALWAYS ON + | (uint)1 << LogContentBits.BillingCounter // ALWAYS ON + | (uint)0 << LogContentBits.ReverseCounter // + | (uint)0 << LogContentBits.MaxFlow // + // + | (uint)0 << LogContentBits.MaxFlowTime // + | (uint)0 << LogContentBits.PeakFlow // + | (uint)0 << LogContentBits.PeakFlowTime // + | (uint)0 << LogContentBits.AvgFlow // + // + | (uint)0 << LogContentBits.BrokenPipe // + | (uint)0 << LogContentBits.BrokenPipeTime // + | (uint)1 << LogContentBits.MinFlow // + | (uint)0 << LogContentBits.MinFlowTime // + // + | (uint)0 << LogContentBits.ForwardCounter // + | (uint)1 << LogContentBits._UTC32 // ALWAYS ON + | (uint)0 << LogContentBits._MaskSelector_1_1 // + | (uint)0 << LogContentBits._MaskSelector_1_2 // + // + | (uint)1 << LogContentBits.MinPress // + | (uint)0 << LogContentBits.MinPressTime // + | (uint)1 << LogContentBits.MaxPress // + | (uint)0 << LogContentBits.MaxPressTime // + // + | (uint)1 << LogContentBits.MinTemp // + | (uint)0 << LogContentBits.MinTempTime // + | (uint)0 << LogContentBits.MaxTemp // + | (uint)0 << LogContentBits.MaxTempTime // + // + | (uint)0 << LogContentBits.CurrentPress // + | (uint)0 << LogContentBits.CurrentTemp // + | (uint)1 << LogContentBits.ExtendedAlarm // ALWAYS ON + | (uint)1 << LogContentBits._RecordCheckSum; // ALWAYS ON + + var contentBytes = BitConverter.GetBytes(content); + Array.Reverse(contentBytes); + Console.WriteLine($"{"DATALOGGER:",11} {content,11} - {BitConverter.ToString(contentBytes).Replace("-", "")}"); + + uint fdr = (uint)1 << LogContentBits.AlarmStatus // ALWAYS ON + | (uint)1 << LogContentBits.BillingCounter // ALWAYS ON + | (uint)0 << LogContentBits.ReverseCounter // + | (uint)0 << LogContentBits.MaxFlow // + // + | (uint)0 << LogContentBits.MaxFlowTime // + | (uint)0 << LogContentBits.PeakFlow // + | (uint)0 << LogContentBits.PeakFlowTime // + | (uint)0 << LogContentBits.AvgFlow // + // + | (uint)0 << LogContentBits.BrokenPipe // + | (uint)0 << LogContentBits.BrokenPipeTime // + | (uint)0 << LogContentBits.MinFlow // + | (uint)0 << LogContentBits.MinFlowTime // + // + | (uint)0 << LogContentBits.ForwardCounter // + | (uint)1 << LogContentBits._UTC32 // ALWAYS ON + | (uint)0 << LogContentBits._MaskSelector_1_1 // + | (uint)0 << LogContentBits._MaskSelector_1_2 // + // + | (uint)0 << LogContentBits.MinPress // + | (uint)0 << LogContentBits.MinPressTime // + | (uint)0 << LogContentBits.MaxPress // + | (uint)0 << LogContentBits.MaxPressTime // + // + | (uint)0 << LogContentBits.MinTemp // + | (uint)0 << LogContentBits.MinTempTime // + | (uint)0 << LogContentBits.MaxTemp // + | (uint)0 << LogContentBits.MaxTempTime // + // + | (uint)0 << LogContentBits.CurrentPress // + | (uint)0 << LogContentBits.CurrentTemp // + | (uint)1 << LogContentBits.ExtendedAlarm // ALWAYS ON + | (uint)1 << LogContentBits._RecordCheckSum; // ALWAYS ON + + var fdrBytes = BitConverter.GetBytes(fdr); + Array.Reverse(fdrBytes); + Console.WriteLine($"{"FDR:",11} {fdr,11} - {BitConverter.ToString(fdrBytes).Replace("-", "")}"); + + } // CONTENT: 67110031 - 04-00-04-8F => 0400048F <-> 8F040004 04000C03 + + static void Main123() { // Console.WriteLine(BitConverter.ToInt32(new byte[] { 0xEC, 0xFF, 0xFF, 0xFF }, 0)); - SIRTServer.StartServer(Console.WriteLine, Console.WriteLine, 6, 8); + // SIRTServer.StartServer(Console.WriteLine, Console.WriteLine, 6, 8); // SIRTServer.StartProgramming(433, 412013443, "0E9FACC6A0E1EF1C3B27A49BAC216535"); // SIRTServer.StartProgramming(433, 412013444, "0E9FACC6A0E1EF1C3B27A49BAC216535"); // SIRTServer.StartProgramming(433, 412013356, "80D46C00E1BED73FE0DA85D95CA4BEE3"); @@ -53,12 +155,15 @@ public const byte LOG_MAX_FLOW_TIME = 4; // 0x00000010, //!< Date/Time of MaxFlow public const byte LOG_PEAK_FLOW_VAL = 5; // 0x00000020, //!< Value of PeakFlow public const byte LOG_PEAK_FLOW_TIME = 6; // 0x00000040, //!< Date/Time of PeakFlow - public const byte LOG_CUR_FLOW_VAL = 7; // 0x00000080, //!< Current Flow Value (Average of Period) + public const byte LOG_AVG_FLOW_VAL = 7; // 0x00000080, //!< Current Flow Value (Average of Period) public const byte LOG_BROKEN_PIPE_FLOW_VAL = 8; // 0x00000100, //!< Value of BrokenPipe public const byte LOG_BROKEN_PIPE_FLOW_TIME = 9; // 0x00000200, //!< Date/Time of BrokenPipe public const byte LOG_MIN_FLOW_VAL = 10; // 0x00000400, //!< Value of FlowMin public const byte LOG_MIN_FLOW_TIME = 11; // 0x00000800, //!< Date/Time of FlowMin public const byte LOG_FORWARD_COUNTER = 12; // 0x00001000, //!< ForwardCounter + // public const byte LOG_FORWARD_COUNTER = 12; // 0x00002000, //!< ForwardCounter + // public const byte LOG_FORWARD_COUNTER = 12; // 0x00004000, //!< ForwardCounter + // public const byte LOG_FORWARD_COUNTER = 12; // 0x00008000, //!< ForwardCounter public const byte LOG_MIN_PRESS_VAL = 13; // 0x00010000, //!< Pressure Minimum public const byte LOG_MIN_PRESS_TIME = 14; // 0x00020000, //!< Pressure Minimum Time public const byte LOG_MAX_PRESS_VAL = 15; // 0x00040000, //!< Pressure Maximum @@ -72,6 +177,115 @@ public const byte LOG_EXT_ALARM_STATE = 23; // 0x04000000,    // MIN 1100 0000 0000 0100 0000 0000 0011 + // [0..26] 1100 0000 0011 0100 0000 0000 0011 + // [0..26] 1100 0001 0000 0100 0000 0000 1111 + // [0..26] 1100 0001 1111 0100 0000 0000 0011 + // [0..26] 1101 1111 1111 1100 0000 0000 0011 + // [0..26] 1100 0000 0000 0100 0000 0000 0011 + // [0..26] 1100 0000 0000 0100 1100 0000 0011 + // [0..26] 1100 0000 0011 0100 0000 1000 0011 + // [0..26] 1110 0110 0000 0100 0000 0000 0011 + // [0..26] 1100 0001 0010 0100 0000 0000 0011 + // [0..26] 1100 0001 0010 0100 0000 0001 0011 + // [0..26] 1111 0001 0010 0100 0000 0000 0011 + // [0..26] 1111 1111 1111 0100 0000 1000 0011 + // [0..26] 1111 1111 1111 1100 0000 1000 0011 + // [0..26] 1111 1111 1111 1100 0000 1111 0111 + // [0..26] 1100 0000 0010 0100 0000 1111 0111 + // [0..26] 1101 0000 0010 0100 0000 0000 0011 + // [0..26] 1101 0000 0010 0100 0000 1010 0011 + // [0..26] 1111 1000 0000 0100 0000 0000 0011 + // [0..26] 1110 0001 0010 0100 0000 0000 0011 + // [0..26] 1110 0001 0000 1100 0000 0000 0011 + // [0..26] 1110 0001 0000 1100 0000 1010 0011 + // [0..26] 1111 1001 0011 1100 0000 0000 0011 + // [0..26] 1100 0000 0000 0100 0000 0000 1011 + // [0..26] 1100 0000 0010 0100 0000 0000 0001 + // [0..26] 1100 0000 0010 0100 0000 0000 0011 + // [0..26] 1110 0000 0000 0100 0000 0000 0011 + // [0..26] 1101 0000 0010 0100 1010 1010 0011 + // [0..26] 1100 0001 0000 0100 0000 0000 0011 + // [0..26] 1100 0011 0000 0100 0100 0000 0011 + // [0..26] 1111 1111 0011 0100 0000 0000 0011 + // [0..26] 1111 1111 0011 0100 0000 0000 0111 + // [0..26] 1111 1111 1111 1100 0000 0000 0011 + // [0..26] 1111 1111 1111 1100 1111 1111 1111 + // --> MAX 1111 1111 1111 1100 1111 1111 1111 + } + + [Flags] + enum LogContentHex : uint + { + AlarmStatus = 0x00000001, // ;The active alarm information at UTC32  + BillingCounter = 0x00000002, // ;The billing counter at UTC32  + ReverseCounter = 0x00000004, // ;The reverse counter at UTC32  + MaxFlow = 0x00000008, // ;The maximum flow of the current FDR period UTC32n -… UTC32n-1  + MaxFlowTime = 0x00000010, // ;The Date/Time information when Qmax happened in the FDR period  + PeakFlow = 0x00000020, // ;The peak flow of the current FDR period  + PeakFlowTime = 0x00000040, // ;The Date/Time information when Qpeak happened in the FDR period  + AvgFlow = 0x00000080, // ;The average flow rate in the current FDR period  + BrokenPipe = 0x00000100, // ;The weak flow in the current FDR period   + BrokenPipeTime = 0x00000200, // ;The Date/Time information when Qweak happened in the FDR period  + MinFlow = 0x00000400, // ;The minimum flow in the current FDR period  + MinFlowTime = 0x00000800, // ;The Date/Time information when Qmin happened in the FDR period  + ForwardCounter = 0x00001000, // ;The forward counter at UTC32  + _UTC32 = 0x00002000, // ;Date/Time information when the record was stored.  + _MaskSelector_1_1 = 0x00004000, // ;Two selector bits to switch the bitmask of the RF-communication between the internal pages  + _MaskSelector_1_2 = 0x00008000, // ; + MinPress = 0x00010000, // ;The minimum pressure in the current LOG period  + MinPressTime = 0x00020000, // ;The number of 1-second intervals when Pmin happened in the LOG period  + MaxPress = 0x00040000, // ;The maximum pressure in the current LOG period  + MaxPressTime = 0x00080000, // ;The number of 1-second intervals when Pmax happened in the LOG period  + MinTemp = 0x00100000, // ;The minimum temperature in the current LOG period  + MinTempTime = 0x00200000, // ;The number of 1-second intervals when Tmin happened in the LOG period  + MaxTemp = 0x00400000, // ;The maximum temperature in the current LOG period  + MaxTempTime = 0x00800000, // ;The number of 1-second intervals when Tmax happened in the LOG period  + CurrentPress = 0x01000000, // ;The last measured instantaneous pressure at RTC32  + CurrentTemp = 0x02000000, // ;The last measured instantaneous temperature at RTC32   + ExtendedAlarm = 0x04000000, // ;"Similar to the AlarmStatus; P and T related Alarms. " + _RecordCheckSum = 0x08000000, // ;A Checksum across the entire FDR record  + _Reserved_1 = 0x10000000, // ;A reserved mask for a further item  + _Reserved_2 = 0x20000000, // ;A reserved mask for a further item  + _MaskSelector_2_1 = 0x40000000, // ;The mirror of the MaskSelector_1  + _MaskSelector_2_2 = 0x80000000, // ;The mirror of the MaskSelector_2  + } + class AlarmMask { public const byte ALARM_REBOOT = 0; // immer An @@ -281,7 +495,7 @@ | 1 < LoadInspectionInitializationTasks() { - //this.executionType = nameof(LoadInspectionInitializationTasks); - //var features = this.parameters.LoadInspectionInitializationFeatures(); + this.executionType = nameof(LoadInspectionInitializationTasks); - //if (features.RequestAddress > 0 && features.ResponseAddress > 0) - //{ - // this.LoadProgrammingParameters(features); + if (this.parameters.Completed) + { + return new EregisterTask[] { }; + } - // if (this.runningTasks.Any()) - // { - // this.runningTasks.Enqueue(new EregisterChangeMeterTypeTask(features.Frequency) - // { - // SlotNr = features.SlotNr, - // PoNr = features.PoNr, - // SerialNr = features.SerialNr, - // DelPamSemi = true, - // RequestAddress = features.RequestAddress, - // ResponseAddress = features.ResponseAddress, - // EncryptionKey = features.EncryptionKey, - // Name = "Change Meter Type" - // }); - // } - //} + var features = this.parameters.LoadInspectionInitializationFeatures(); - //return this.runningTasks.AsEnumerable(); + if (features.RequestAddress > 0 && features.ResponseAddress > 0) + { + this.LoadProgrammingParameters(features); - return this.LoadInspectionFinalizationTasks(); + if (this.runningTasks.Any()) + { + this.runningTasks.Enqueue(new EregisterChangeMeterTypeTask(features.Frequency) + { + SlotNr = features.SlotNr, + PoNr = features.PoNr, + SerialNr = features.SerialNr, + DelPamSemi = true, + RequestAddress = features.RequestAddress, + ResponseAddress = features.ResponseAddress, + EncryptionKey = features.EncryptionKey, + Name = "Change Meter Type" + }); + } + } - //this.runningTasks.Enqueue(new EregisterTask(features.Frequency) - //{ - // //WakeUpCmd = true, - // //WakeUpModul = true, - // SlotNr = features.SlotNr, - // PoNr = features.PoNr, - // SerialNr = features.SerialNr, - // RequestAddress = features.RequestAddress, - // ResponseAddress = features.ResponseAddress, - // EncryptionKey = features.EncryptionKey, - // IsEncrypted = this.parameters.IsEncrypted, - // Data = new ChangeWakeUp(WakeUpMode.StayAwake).Append(new ProvidePin(AuthLevel.II)) - //}); - - //return this.runningTasks.AsEnumerable(); + return this.runningTasks.ToArray(); } internal IEnumerable LoadInspectionFinalizationTasks() @@ -95,31 +82,17 @@ this.executionType = nameof(LoadInspectionFinalizationTasks); var features = this.parameters.LoadInspectionFinalizationFeatures(); + if (this.parameters.Completed) + { + return new EregisterTask[] { }; + } + if (features.RequestAddress > 0 && features.ResponseAddress > 0) { this.LoadProgrammingParameters(features); if (this.parameters.StatusFertigung == 30) { - // Setting all transmision intervals at the end - //this.runningTasks.Enqueue(new EregisterTask(features.Frequency) - //{ - // SlotNr = features.SlotNr, - // PoNr = features.PoNr, - // SerialNr = features.SerialNr, - // RequestAddress = features.RequestAddress, - // ResponseAddress = features.ResponseAddress, - // EncryptionKey = features.EncryptionKey, - // IsEncrypted = this.parameters.IsEncrypted, - // Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval) - // .Append(new ChangeNumberOfLatWindows(this.parameters.LAT_Interval)) - // .Append(new ChangeTransmissionInterval(this.parameters.Transmission_Intervall)) - // .Append(new OpenMeteringTransmitionIntervalWMBus(this.parameters.OMS_Interval)) - // .Append(new ProvidePin(AuthLevel.II)), - // Name = "0, 2, 16, 17", - //}); - - // The last checked DEBUG telegram this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency) { WakeUpModul = true, @@ -131,9 +104,25 @@ EncryptionKey = features.EncryptionKey, IsEncrypted = this.parameters.IsEncrypted, }); + + this.runningTasks.Enqueue(new EregisterTask(this.parameters.Frequency) + { + Name = "0, 2, 16", + SlotNr = features.SlotNr, + PoNr = features.PoNr, + SerialNr = features.SerialNr, + RequestAddress = features.RequestAddress, + ResponseAddress = features.ResponseAddress, + EncryptionKey = features.EncryptionKey, + IsEncrypted = this.parameters.IsEncrypted, + Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval) + .Append(new ChangeNumberOfLatWindows(this.parameters.LAT_Interval)) + .Append(new ChangeTransmissionInterval(this.parameters.Transmission_Intervall)) + .Append(new ProvidePin(AuthLevel.II)), + }); } } - + return this.runningTasks.AsEnumerable(); } @@ -143,6 +132,11 @@ internal void StartProgrammingAsync(CancellationToken cancellationToken) { + if (this.parameters.Completed) + { + return; + } + this.history.SerienNr = this.parameters.SerienNr; this.history.Adresse = this.parameters.Adresse; this.history.TempAdresse = this.parameters.TempAdresse; @@ -153,7 +147,6 @@ var lat = default(LAT); var debug = default(DEBUG); var semi = default(SEMI); - var awaiter = new ManualResetEventSlim(false); while (this.runningTasks.TryPeek(out task) && task.State != SIRTTaskState.Cancelled && !cancellationToken.IsCancellationRequested) { @@ -173,30 +166,15 @@ if (task.ErrorMessage != null) { - var error = task.ErrorMessage; - var message = $"{error.Text}{Environment.NewLine}{Environment.NewLine}Möchten Sie fortfahren?"; - var result = MessageBox.Show(message, error.Title, MessageBoxButtons.YesNo); - - if (result == DialogResult.No) - { - task.SetCancelled(); - - stopProgramming = true; - - break; - } - } + this.state.Bemerkung += task.ErrorMessage.Title + Environment.NewLine; + this.state.Bemerkung += task.ErrorMessage.Text + Environment.NewLine; + } } task.MessageReceived -= this.history.Push; if (stopProgramming) { - if (task.FactoryState == FactoryState.Shipment) - { - task.Label = "GESCHLOSSEN"; - } - break; } @@ -210,9 +188,20 @@ debug = task.DEBUGMessage; semi = task.SEMIMessage; factoryState = task.FactoryState; + this.state.SemiDebugDatum = DateTime.Now; } - this.runningTasks.TryDequeue(out task); + if (task.RequestAddress == this.parameters.Adresse) + { + this.state.FunkadresseDatum = DateTime.Now; + } + + if (!this.runningTasks.TryDequeue(out task)) + { + stopProgramming = true; + + break; + } } else if (task.State == SIRTTaskState.Cancelled) { @@ -227,13 +216,12 @@ return; } - this.state.ShouldUpdate = true; // task.FactoryState == FactoryState.Shipment; - this.state.Bemerkung = this.executionType; + this.state.ShouldUpdate = true; + this.state.Bemerkung += this.executionType; this.state.Fabrikationsnummer = debug?.PCBID; this.state.BUP = lat?.ToString()?.Replace('-', '\t'); this.state.DEBUG = debug?.ToString()?.Replace('-', '\t'); this.state.SEMI = semi?.ToString()?.Replace('-', '\t'); - this.state.SemiDebugDatum = DateTime.Now; this.state.Seriennummer = this.parameters.SerienNr; this.state.TempAdresse = this.parameters.TempAdresse; @@ -241,7 +229,6 @@ && factoryState == FactoryState.Shipment && this.parameters.StatusFertigung == 30) { - this.state.FunkadresseDatum = DateTime.Now; this.state.GeschlossenDatum = DateTime.Now; } } @@ -286,6 +273,22 @@ var frequency = this.parameters.Frequency; + this.runningTasks.Enqueue(new EregisterTask(frequency) + { + Name = "WUP", + SlotNr = features.SlotNr, + PoNr = features.PoNr, + SerialNr = features.SerialNr, + RequestAddress = features.RequestAddress, + ResponseAddress = features.ResponseAddress, + EncryptionKey = features.EncryptionKey, + IsEncrypted = this.parameters.IsEncrypted, + Data = new ChangeWakeUp(WakeUpMode.StayAwake) + .Append(new ChangeNumberOfLatWindows(this.parameters.LatWindowsInitialization)) + .Append(new ChangeTransmissionInterval(this.parameters.TransmissionIntervalInitialization)) + .Append(new ProvidePin(AuthLevel.II)), + }); + this.runningTasks.Enqueue(new EregisterCheckInitializationTask(this.parameters, frequency) { SlotNr = features.SlotNr, diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs index 3a7c1485..2c313a46 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs @@ -17,12 +17,11 @@ public EregisterTask(int frequency) { - this.Timeout = 5000; this.DelPamSemi = true; this.Frequency = frequency; this.RSSI = new RSSI(0, frequency); this.Label = nameof(SIRTTaskState.Pending); - // this.AnyTelegramReceived = true; + this.AnyTelegramReceived = true; } public event Action Changed; @@ -44,12 +43,7 @@ { this.label = value; // $"({this.runsCount}) {value}"; - var changeEvent = this.Changed; - - if (changeEvent != null) - { - changeEvent(this); - } + this.Changed?.Invoke(this); } } @@ -152,7 +146,6 @@ if (type == SIRTConstants.BUP) // always: 13 - enc: CRC != 0 { - this.Label = nameof(SIRTConstants.BUP); var bupMessage = new BUP(data, this.P11); this.IsEncrypted = bupMessage.Crc != 0; @@ -163,10 +156,10 @@ } this.BUPMessage = bupMessage; + this.Label = nameof(SIRTConstants.BUP); } else if (type == SIRTConstants.LAT) // always: 13 - enc: CRC != 0 { - this.Label = nameof(SIRTConstants.LAT); var latMessage = new LAT(data, this.P11); this.IsEncrypted = latMessage.Crc != 0; @@ -177,6 +170,7 @@ } this.LATMessage = latMessage; + this.Label = nameof(SIRTConstants.LAT); } else if (type == SIRTConstants.DEBUG) // plain: 52 - enc: 54 { @@ -186,14 +180,19 @@ { data = data.DecryptResponse(this.EncryptionKey); } - - this.Label = nameof(SIRTConstants.DEBUG); + this.DEBUGMessage = new DEBUG(data, this.P11); this.FactoryState = this.DEBUGMessage.FactoryState; - if (this.LATMessage != null && this.SEMIMessage != null && this.SEMIMessage.PAMStatus == PAMStatus.OK) + if (this.LATMessage is null) { - this.SetCompleted(); + this.Label = "!LAT"; + + this.SetPending(); + } + else + { + this.Label = nameof(SIRTConstants.DEBUG); } } else if (type == SIRTConstants.SEMI) // plain: 91 - enc: 93 @@ -214,10 +213,14 @@ if (this.LATMessage is null) { this.Label = "!LAT"; + + this.SetPending(); } else if (this.request.Length > 0 && this.request.Payload[0] == Pam.GetDebug && this.DEBUGMessage == null) { this.Label = "!DEBUG"; + + this.SetPending(); } else { @@ -246,11 +249,14 @@ { this.P12 = new P12(response.P1); this.Label = "AKN"; + this.SetPending(); } else { this.Label = "NA"; + + this.SetPending(); } } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs index d063b0f5..df62d4d5 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs @@ -219,7 +219,7 @@ public byte ActivationByThreshold { get; set; } - // [CompareProperty] + [CompareProperty] public ushort OMS_Interval { get; set; } public uint DisplayVolume { get; set; } @@ -263,11 +263,17 @@ ResponseAddress = (uint)(this.IsEncrypted ? this.TempAdresse : this.Adresse), Frequency = this.Frequency, EncryptionKey = this.EncryptionKey.GetEncryptionKey(), - ///////////////////////////////////////////////////// - ChangeMeterReading = this.DisplayVolume, - Debug = new EregisterDebugFeatures() }; + if (this.Completed) + { + return features; + } + + ///////////////////////////////////////////////////// + features.Debug = new EregisterDebugFeatures(); + features.ChangeMeterReading = this.DisplayVolume; + if (!this.IsEbeling && !this.IsFuhzoe) { features.Debug.DisableOTAFirmwareUpdate = this.DisableOTA; @@ -276,7 +282,6 @@ if (this.StatusFertigung != 30) { - features.ChangeWakeUp = WakeUpMode.StayAwake; features.ChangeMeterReading = 333_333_333; features.Debug = new EregisterDebugFeatures { @@ -298,9 +303,9 @@ features.Debug.ChangeState = FactoryState.Shipment; } - features.ChangeWakeUp = (WakeUpMode)this.Wake_Up_Interval; - features.ChangeNumberOfLatWindows = this.LAT_Interval; - features.ChangeTransmissionInterval = this.Transmission_Intervall; + // features.ChangeWakeUp = (WakeUpMode)this.Wake_Up_Interval; + // features.ChangeNumberOfLatWindows = this.LAT_Interval; + // features.ChangeTransmissionInterval = this.Transmission_Intervall; features.OpenMeteringTransmitionIntervalWMBus = this.OMS_Interval; features.ChangeRadioId = (uint)this.Adresse; features.ChangeMeterId = this.MeterId; @@ -338,7 +343,6 @@ Counter = this.Data_Logging_Counter, AlarmState = this.Data_Logging_Alarm_State, }; - features.ChangeWakeUp = WakeUpMode.SleepAutoOn; features.ChangeFixedDateReadingSettings = new ChangeFixedDateReadingSettings { DayOfMonth = this.FDR_Day_Of_Data_Reading, @@ -378,9 +382,9 @@ Frequency = this.Frequency, EncryptionKey = this.EncryptionKey.GetEncryptionKey(), ///////////////////////////////////////////////////// - ChangeWakeUp = WakeUpMode.StayAwake, - ChangeTransmissionInterval = this.TransmissionIntervalInitialization, - ChangeNumberOfLatWindows = this.LatWindowsInitialization, + // ChangeWakeUp = WakeUpMode.StayAwake, + // ChangeTransmissionInterval = this.TransmissionIntervalInitialization, + // ChangeNumberOfLatWindows = this.LatWindowsInitialization, ChangeMeterReading = 111_111_111, WirelessMBusMode = this.MBusStatus, SetMetrologyParameters = new SetMetrologyParameters diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterState.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterState.cs index 34acabfa..93ecc478 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterState.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterState.cs @@ -6,7 +6,7 @@ { public long? Fabrikationsnummer { get; set; } - public string Bemerkung { get; set; } + public string Bemerkung { get; set; } = string.Empty; public string BUP { get; set; } diff --git a/Common/Ui/Common.UI/App.config b/Common/Ui/Common.UI/App.config index 9f6b3f7a..c63681ec 100644 --- a/Common/Ui/Common.UI/App.config +++ b/Common/Ui/Common.UI/App.config @@ -7,7 +7,7 @@ - + diff --git a/Common/Ui/Common.UI/Infrastructure/AppHost.cs b/Common/Ui/Common.UI/Infrastructure/AppHost.cs index fef5ba02..fc65ba07 100644 --- a/Common/Ui/Common.UI/Infrastructure/AppHost.cs +++ b/Common/Ui/Common.UI/Infrastructure/AppHost.cs @@ -33,7 +33,8 @@ { CreateDirs = true, KeepFileOpen = true, - FileName = file + FileName = file, + Layout = "${message}" }); LogManager.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, name);