namespace AMWD.Protocols.Modbus.Common
{
///
/// Represents a coil.
///
public class Coil : ModbusObject
{
///
public override ModbusObjectType Type => ModbusObjectType.Coil;
///
/// Gets or sets a value indicating whether the coil is on or off.
///
public bool Value
{
get => HighByte == 0xFF;
set
{
HighByte = (byte)(value ? 0xFF : 0x00);
LowByte = 0x00;
}
}
///
public override string ToString()
=> $"Coil #{Address} | {(Value ? "ON" : "OFF")}";
}
}