Files
laatzen/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckStateTask.cs
T

35 lines
1.1 KiB
C#

namespace Common.Hardware.WaterMeter.eRegister
{
using Common.Hardware.SIRT;
using Common.Hardware.SIRT.Parameters;
using Common.Hardware.WaterMeter.eRegister.Telegrams;
public class EregisterCheckStateTask : EregisterTask
{
public EregisterCheckStateTask(int frequency)
: base(frequency)
=> this.Name = "Check State";
protected override void ProcessResponse(SIRTMessage response)
{
base.ProcessResponse(response);
if (this.SEMI != null)
{
var isEncrypted = this.IsEncrypted;
this.IsEncrypted = this.SEMI.PAMStatus == PAMStatus.OK && this.SEMI.Crc != 0;
if (this.IsEncrypted != isEncrypted)
{
var data = response.Data.DecryptResponse(this.EncryptionKey);
this.SEMI = new SEMI(data, this.Frequency, response.P1);
this.Label = this.SEMI.PAMStatus.ToString();
this.NotifyTelegram(this.SEMI);
this.NotifyUpdated();
}
}
}
}
}