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

135 lines
4.7 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace Common.Hardware.SIRT.Parameters
{
public class SirtOperating
{
private readonly byte[] bits;
public SirtOperating() => this.bits = new byte[8];
private SirtOperating(byte[] bits) => this.bits = bits;
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>Bluetooth is output for non-requested messages</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>USB port is output for non-requested messages</description>
/// </item>
/// </list>
/// <para>non requested messages are received radio payloads if a radio module is switched on</para>
/// </summary>
public bool DataBtOut
{
get => this.bits[0] == 1;
set => this.bits[0] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>: if both RF-Modules are set to SensusRF Mode, both payloads of RF-Modules will be send out </description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>if both RF-Modules are set to SensusRF Mode, the channel with higher RSSI Level will be send out</description>
/// </item>
/// </list>
/// <para>for test purposes both receiver outputs can be shown - but remember double traffic rate on Bluetoothor USB-output</para>
/// </summary>
public bool BothChsOut
{
get => this.bits[1] == 1;
set => this.bits[1] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>also payloads with incorrect radio-CRC will send out!</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal operation</description>
/// </item>
/// </list>
/// <para>may be only interesting for test purposes </para>
/// </summary>
public bool IgnoreCRC
{
get => this.bits[2] == 1;
set => this.bits[2] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>don't switch Power path off if going to USB Suspend and drawing more current as allowed</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>switch Power path off if going to USB Suspend</description>
/// </item>
/// </list>
/// <para>New at Version 1.0.0.6</para>
/// </summary>
public bool IgnoreUSBrules
{
get => this.bits[3] == 1;
set => this.bits[3] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>after "TIME_OFF" is elapsed without any command to SIRT, SIRT will be switched off</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal operation</description>
/// </item>
/// </list>
/// <para>timeout starts at beginning, if any command or communication to and from SIRT is initiated</para>
/// </summary>
public bool SirtPwrSave
{
get => this.bits[6] == 1;
set => this.bits[6] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>SIRT will be switched off {like push off button}</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal operation</description>
/// </item>
/// </list>
/// <para>
/// SIRT can be switched off per command, but no answer will send if this bit was set.SIRT can not be switched
/// on per command only by pushing green button for a second
/// </para>
/// </summary>
public bool SirtOff
{
get => this.bits[7] == 1;
set => this.bits[7] = (byte)(value ? 1 : 0);
}
public static implicit operator byte(SirtOperating param)
=> param.bits.GetByte();
public static implicit operator SirtOperating(byte _byte)
=> new SirtOperating(_byte.GetBits());
}
}