Merge branch 'master' into nefarius/bugfix/refactoring

This commit is contained in:
2024-07-13 14:12:03 +02:00
6 changed files with 50 additions and 32 deletions

View File

@ -1,29 +1,36 @@
using Nefarius.Peripherals.SerialPort.Win32PInvoke;
using Windows.Win32.Devices.Communication;
namespace Nefarius.Peripherals.SerialPort
namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Represents the status of the modem control input signals.
/// </summary>
public readonly struct ModemStatus
{
/// <summary>
/// Represents the status of the modem control input signals.
/// </summary>
public struct ModemStatus
private readonly MODEM_STATUS_FLAGS _status;
internal ModemStatus(MODEM_STATUS_FLAGS val)
{
private readonly uint _status;
internal ModemStatus(uint val) { _status = val; }
/// <summary>
/// Condition of the Clear To Send signal.
/// </summary>
public bool Cts { get { return ((_status & Win32Com.MS_CTS_ON) != 0); } }
/// <summary>
/// Condition of the Data Set Ready signal.
/// </summary>
public bool Dsr { get { return ((_status & Win32Com.MS_DSR_ON) != 0); } }
/// <summary>
/// Condition of the Receive Line Status Detection signal.
/// </summary>
public bool Rlsd { get { return ((_status & Win32Com.MS_RLSD_ON) != 0); } }
/// <summary>
/// Condition of the Ring Detection signal.
/// </summary>
public bool Ring { get { return ((_status & Win32Com.MS_RING_ON) != 0); } }
_status = val;
}
/// <summary>
/// Condition of the Clear To Send signal.
/// </summary>
public bool Cts => (_status & MODEM_STATUS_FLAGS.MS_CTS_ON) != 0;
/// <summary>
/// Condition of the Data Set Ready signal.
/// </summary>
public bool Dsr => (_status & MODEM_STATUS_FLAGS.MS_DSR_ON) != 0;
/// <summary>
/// Condition of the Receive Line Status Detection signal.
/// </summary>
public bool Rlsd => (_status & MODEM_STATUS_FLAGS.MS_RLSD_ON) != 0;
/// <summary>
/// Condition of the Ring Detection signal.
/// </summary>
public bool Ring => (_status & MODEM_STATUS_FLAGS.MS_RING_ON) != 0;
}

View File

@ -31,6 +31,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.63-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>