namespace Common.Hardware.SIRT.Parameters { using System; public class RFModuleOperating { private readonly byte[] bits; public RFModuleOperating() => this.bits = new byte[8]; private RFModuleOperating(byte[] bits) => this.bits = bits; /// /// 0 -> Transparent Mode at 115k2 Baud 8,n,1 /// public OperatingModes OpMode { get { var bits = new byte[8]; Array.Copy(this.bits, 0, bits, 0, 4); return (OperatingModes)bits.GetByte(); } set { var bits = ((byte)value).GetBits(); Array.Copy(bits, 0, this.bits, 0, 4); } } /// /// /// /// true /// external antenna /// /// /// false /// internal antenna /// /// /// public bool Antenna { get => this.bits[4] == 1; set => this.bits[4] = (byte)(value ? 1 : 0); } /// /// /// /// true /// Module not powered /// /// /// false /// Module powered /// /// /// public bool RfOff { get => this.bits[7] == 1; set => this.bits[7] = (byte)(value ? 1 : 0); } public static implicit operator byte(RFModuleOperating param) => param.bits.GetByte(); public static implicit operator RFModuleOperating(byte _byte) => new RFModuleOperating(_byte.GetBits()); } }