181 lines
5.7 KiB
C#
181 lines
5.7 KiB
C#
namespace Common.Hardware.Interfaces.Ports.SIRT.Parameters
|
|
{
|
|
using Common.Utils.Extensions;
|
|
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Parameter P11 is given at third position of "Telegram from Air" telegram and give more detailed information about the
|
|
/// received packets from radio section of SIRT.The bits of Parameter 11 are decoded as following, where Bit 0 is the least
|
|
/// significant bit:
|
|
/// </summary>
|
|
public class P11
|
|
{
|
|
private readonly Byte[] bits;
|
|
|
|
public P11() => this.bits = new Byte[8];
|
|
|
|
private P11(Byte[] bits) => this.bits = bits;
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>RF-Module2 is source</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>RF-Module1 is source</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// <para>only valid if both RF-Module programmed for Sensus RF</para>
|
|
/// </summary>
|
|
public Boolean SrcChannel
|
|
{
|
|
get => this.bits[0] == 1;
|
|
set => this.bits[0] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>both RF module data are valid</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>only one RF module data is valid</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// <para>only valid if both RF-Module programmed for Sensus RF</para>
|
|
/// </summary>
|
|
public Boolean BothValid
|
|
{
|
|
get => this.bits[1] == 1;
|
|
set => this.bits[1] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>RF-Module1 data is invalid</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>RF-Module1 data is valid</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// <para>i.e. radio checksum is wrong ...</para>
|
|
/// </summary>
|
|
public Boolean InvalidMod1
|
|
{
|
|
get => this.bits[2] == 1;
|
|
set => this.bits[2] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>RF-Module2 data is invalid</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>RF-Module2 data is valid</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// <para>i.e. radio checksum is wrong ...</para>
|
|
/// </summary>
|
|
public Boolean InvalidMod2
|
|
{
|
|
get => this.bits[3] == 1;
|
|
set => this.bits[3] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>invalid -> module detects length > 128</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>all ok</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// </summary>
|
|
public Boolean LenOverflow
|
|
{
|
|
get => this.bits[4] == 1;
|
|
set => this.bits[4] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>will look at PAM / RAC Pool</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>no attention for PAM / RAC</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// </summary>
|
|
public Boolean Attention
|
|
{
|
|
get => this.bits[5] == 1;
|
|
set => this.bits[5] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>
|
|
/// <para>If .modeSensus = 0 wireless M-busMode -> T1 - Mode</para>
|
|
/// <para>If .modeSensus = 1 SensusRF -> receive at f2</para>
|
|
/// </description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>
|
|
/// <para>If .modeSensus = 0 wireless M-busMode -> S1 - Mode</para>
|
|
/// <para>If .modeSensus = 1 SensusRF -> receive at f1</para>
|
|
/// </description>
|
|
/// </item>
|
|
/// </list>
|
|
/// </summary>
|
|
public Boolean ModeRF
|
|
{
|
|
get => this.bits[6] == 1;
|
|
set => this.bits[6] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <list>
|
|
/// <item>
|
|
/// <term>true</term>
|
|
/// <description>Sensus RF Mode</description>
|
|
/// </item>
|
|
/// <item>
|
|
/// <term>false</term>
|
|
/// <description>wireless M-Bus Mode</description>
|
|
/// </item>
|
|
/// </list>
|
|
/// </summary>
|
|
public Boolean ModeSensus
|
|
{
|
|
get => this.bits[7] == 1;
|
|
set => this.bits[7] = (Byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public static implicit operator Byte(P11 param)
|
|
=> param.bits.ToByte();
|
|
|
|
public static implicit operator P11(Byte _byte)
|
|
=> new P11(_byte.GetBits());
|
|
}
|
|
}
|