Files
Nefarius.Peripherals.Serial…/Nefarius.Peripherals.SerialPort/ModemStatus.cs
T

36 lines
1016 B
C#
Raw Normal View History

2022-09-26 21:44:50 +02:00
using Windows.Win32.Devices.Communication;
2012-03-03 13:20:54 +03:30
2022-09-26 21:44:50 +02:00
namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Represents the status of the modem control input signals.
/// </summary>
public readonly struct ModemStatus
2012-03-03 13:20:54 +03:30
{
2022-09-26 23:51:23 +02:00
private readonly MODEM_STATUS_FLAGS _status;
2022-09-26 21:44:50 +02:00
2022-09-26 23:51:23 +02:00
internal ModemStatus(MODEM_STATUS_FLAGS val)
2012-03-03 13:20:54 +03:30
{
2022-09-26 21:44:50 +02:00
_status = val;
2012-03-03 13:20:54 +03:30
}
2022-09-26 21:44:50 +02:00
/// <summary>
/// Condition of the Clear To Send signal.
/// </summary>
2022-09-26 23:51:23 +02:00
public bool Cts => (_status & MODEM_STATUS_FLAGS.MS_CTS_ON) != 0;
2022-09-26 21:44:50 +02:00
/// <summary>
/// Condition of the Data Set Ready signal.
/// </summary>
2022-09-26 23:51:23 +02:00
public bool Dsr => (_status & MODEM_STATUS_FLAGS.MS_DSR_ON) != 0;
2022-09-26 21:44:50 +02:00
/// <summary>
/// Condition of the Receive Line Status Detection signal.
/// </summary>
2022-09-26 23:51:23 +02:00
public bool Rlsd => (_status & MODEM_STATUS_FLAGS.MS_RLSD_ON) != 0;
2022-09-26 21:44:50 +02:00
/// <summary>
/// Condition of the Ring Detection signal.
/// </summary>
2022-09-26 23:51:23 +02:00
public bool Ring => (_status & MODEM_STATUS_FLAGS.MS_RING_ON) != 0;
2012-03-03 13:20:54 +03:30
}