Write PAM - complete conditions (LAT, DEBUG - required/received)

This commit is contained in:
Stoyan Zlatev
2025-09-01 15:09:56 +02:00
parent 4924711823
commit 5f8a35d5b7
@@ -6,7 +6,6 @@
public class WritePamTask : SIRTTask
{
protected P811 p811;
private event Action<SIRTMessage> AKNReceived;
private event Action<SIRTMessage> BUPReceived;
private event Action<SIRTMessage> LATReceived;
@@ -14,12 +13,10 @@
private event Action<SIRTMessage> SEMIReceived;
private event Action<SIRTMessage> UnknownReceived;
public event Action<SIRTMessage> MessageSent;
public event Action<SIRTMessage> MessageReceived;
private bool debugReceived;
private bool latReceived;
public bool IsEncrypted { get; set; }
public byte[] EncryptionKey { get; set; }
protected P811 p811;
public WritePamTask()
{
@@ -32,8 +29,20 @@
this.DEBUGReceived += this.OnDEBUGReceived;
this.SEMIReceived += this.OnSEMIReceived;
this.UnknownReceived += this.OnUnknownReceived;
this.RequireLAT = true;
}
public event Action<SIRTMessage> MessageSent;
public event Action<SIRTMessage> MessageReceived;
public bool RequireLAT { get; set; }
public bool RequireDEBUG { get; set; }
public bool IsEncrypted { get; set; }
public byte[] EncryptionKey { get; set; }
public bool WakeUpModul
{
get => this.p811.WakeUpModul;
@@ -108,11 +117,13 @@
}
else if (type == SIRTConstants.LAT) // module ready for receiving commands
{
this.latReceived = true;
this.DecriptResponse(response, payload);
this.LATReceived?.Invoke(response);
}
else if (type == SIRTConstants.DEBUG) // received only on specific commands
{
this.debugReceived = true;
this.DecriptResponse(response, payload);
this.DEBUGReceived?.Invoke(response);
}
@@ -191,7 +202,18 @@
protected virtual void OnSEMIReceived(SIRTMessage semi)
{
this.SetCompleted();
if (this.RequireLAT && !this.latReceived)
{
// TODO: Message not complete
}
else if (this.RequireDEBUG && !this.debugReceived)
{
// TODO: Message not complete
}
else
{
this.SetCompleted();
}
}
protected virtual void OnUnknownReceived(SIRTMessage unknown)