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

62 lines
1.8 KiB
C#

namespace Common.Hardware.SIRT.Parameters
{
public class BluetoothOperating
{
private readonly byte[] bits;
public BluetoothOperating() => this.bits = new byte[8];
private BluetoothOperating(byte[] bits) => this.bits = bits;
/// <summary>
/// 0 -> Transparent Mode at 115k2 Baud 8,n,1
/// </summary>
public bool BtOpMode
{
get => this.bits[0] == 1;
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>after "TIME_OFF" is elapsed without any command via Bluetooth, Bluetooth interface will be switched off</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal operation</description>
/// </item>
/// </list>
/// </summary>
public bool BtPwrSave
{
get => this.bits[6] == 1;
set => this.bits[6] = (byte)(value ? 1 : 0);
}
/// <summary>
/// <list>
/// <item>
/// <term>true</term>
/// <description>BT module will be switched off</description>
/// </item>
/// <item>
/// <term>false</term>
/// <description>normal operation</description>
/// </item>
/// </list>
/// </summary>
public bool BtOff
{
get => this.bits[7] == 1;
set => this.bits[7] = (byte)(value ? 1 : 0);
}
public static implicit operator byte(BluetoothOperating param)
=> param.bits.GetByte();
public static implicit operator BluetoothOperating(byte _byte)
=> new BluetoothOperating(_byte.GetBits());
}
}