laatzen/Common/Hardware/Common.Hardware.SIRT/Parameters/P811.cs
2025-11-20 08:46:37 +01:00

240 lines
7.8 KiB
C#

namespace Common.Hardware.SIRT.Parameters
{
/// <summary>
/// Parameter P81-1 is the first modifier of "Write to PAM Pool" command and is placed at third position,
/// if telegram from PC -> SIRT begins with {0x55, 0x81}.
/// This byte describe in detailed what PAM message should do in detail.
/// <para>There is an public priority within the bits which are described at next table:</para>
/// <list type="table">
/// <listheader>
/// <term>7</term>
/// <term>6</term>
/// <term>5</term>
/// <term>4</term>
/// <term>3</term>
/// <term>2</term>
/// <term>1</term>
/// <term>0</term>
/// <description>Description</description>
/// </listheader>
/// <item>
/// <term>1</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <description>delete all entries from pool, regardless of address</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>1</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <description>delete entry with this radio address from pool</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>0</term>
/// <term>1</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <description>write entry with this radio address to pool and delete after transmit</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>1</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <description>write entry with this radio address to pool and delete after SEMI received</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>1</term>
/// <term>X</term>
/// <term>X</term>
/// <term>X</term>
/// <description>write entry with this radio address to pool and leave entry at pool</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>1</term>
/// <term>X</term>
/// <term>0/1</term>
/// <description>write entry with this radio address to pool, create Wake Up sequence and send out PAM after receive a BUP(LAT) from this address and delete after timeOutPam is elapsed</description>
/// </item>
/// <item>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>0</term>
/// <term>X</term>
/// <term>X</term>
/// <description>write entry with this radio address to pool and delete after timeOutPam is elapsed</description>
/// </item>
/// </list>
/// </summary>
public class P811
{
private readonly byte[] bits;
public P811() => this.bits = new byte[8];
private P811(byte[] bits) => this.bits = bits;
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>module 2 is Wakeup Transmitter</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>module 1 is Wakeup Transmitter</description>
/// </item>
/// </list>
/// </summary>
public bool WakeUpModul
{
get => this.bits[0] == 1;
set => this.bits[0] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>first transmit Wakeup Sequence and afterwards normal PAM</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal PAM</description>
/// </item>
/// </list>
/// </summary>
public bool WakeUpCmd
{
get => this.bits[2] == 1;
set => this.bits[2] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>ignore timeout register for automatic delete of PAM</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>do nothing special</description>
/// </item>
/// </list>
/// </summary>
public bool IgnoreTimeout
{
get => this.bits[3] == 1;
set => this.bits[3] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>delete entry from PAM pool after SEMI receipt</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>do nothing after SEMI receipt</description>
/// </item>
/// </list>
/// </summary>
public bool DelPamSemi
{
get => this.bits[4] == 1;
set => this.bits[4] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>delete entry from PAM pool after PAM transmit</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>do nothing after PAM transmit</description>
/// </item>
/// </list>
/// </summary>
public bool DelPamTx
{
get => this.bits[5] == 1;
set => this.bits[5] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>delete from PAM pool</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>write to PAM pool</description>
/// </item>
/// </list>
/// </summary>
public bool DelPamAdr
{
get => this.bits[6] == 1;
set => this.bits[6] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>delete all entries from PAM pool</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>do nothing special</description>
/// </item>
/// </list>
/// </summary>
public bool DelPamAll
{
get => this.bits[7] == 1;
set => this.bits[7] = (byte)(value ? 1 : 0);
}
public static implicit operator byte(P811 param)
=> param.bits.GetByte();
public static implicit operator P811(byte _byte)
=> new P811(_byte.GetBits());
}
}