Implementation of the basic functionallity
This commit is contained in:
20
AMWD.Protocols.Modbus.Common/Models/DiscreteInput.cs
Normal file
20
AMWD.Protocols.Modbus.Common/Models/DiscreteInput.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace AMWD.Protocols.Modbus.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a discrete input.
|
||||
/// </summary>
|
||||
public class DiscreteInput : ModbusObject
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override ModbusObjectType Type => ModbusObjectType.DiscreteInput;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the discrete input is on or off.
|
||||
/// </summary>
|
||||
public bool Value => HighByte == 0xFF;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
=> $"Discrete Input #{Address} | {(Value ? "ON" : "OFF")}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user