More type migrations
This commit is contained in:
parent
cd6fecd8fb
commit
5e30d62651
@ -17,4 +17,6 @@ TransmitCommChar
|
||||
WIN32_ERROR
|
||||
WaitCommEvent
|
||||
WriteFile
|
||||
CreateFile
|
||||
CreateFile
|
||||
ESCAPE_COMM_FUNCTION
|
||||
EscapeCommFunction
|
@ -1,4 +1,7 @@
|
||||
using Nefarius.Peripherals.SerialPort.Win32PInvoke;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Devices.Communication;
|
||||
|
||||
using Nefarius.Peripherals.SerialPort.Win32PInvoke;
|
||||
|
||||
namespace Nefarius.Peripherals.SerialPort;
|
||||
|
||||
@ -141,14 +144,14 @@ public partial class SerialPort
|
||||
CheckOnline();
|
||||
if (value)
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.SETRTS))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.SETRTS))
|
||||
_stateRts = 1;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.CLRRTS))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.CLRRTS))
|
||||
_stateRts = 1;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
@ -173,14 +176,14 @@ public partial class SerialPort
|
||||
CheckOnline();
|
||||
if (value)
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.SETDTR))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.SETDTR))
|
||||
_stateDtr = 1;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.CLRDTR))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.CLRDTR))
|
||||
_stateDtr = 0;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
@ -200,14 +203,14 @@ public partial class SerialPort
|
||||
CheckOnline();
|
||||
if (value)
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.SETBREAK))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.SETBREAK))
|
||||
_stateBrk = 0;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win32Com.EscapeCommFunction(_hPort.DangerousGetHandle(), Win32Com.CLRBREAK))
|
||||
if (PInvoke.EscapeCommFunction(_hPort, ESCAPE_COMM_FUNCTION.CLRBREAK))
|
||||
_stateBrk = 0;
|
||||
else
|
||||
ThrowException("Unexpected Failure");
|
||||
|
@ -5,17 +5,6 @@ namespace Nefarius.Peripherals.SerialPort.Win32PInvoke;
|
||||
|
||||
internal class Win32Com
|
||||
{
|
||||
// Constants for dwFunc:
|
||||
internal const UInt32 SETXOFF = 1;
|
||||
internal const UInt32 SETXON = 2;
|
||||
internal const UInt32 SETRTS = 3;
|
||||
internal const UInt32 CLRRTS = 4;
|
||||
internal const UInt32 SETDTR = 5;
|
||||
internal const UInt32 CLRDTR = 6;
|
||||
internal const UInt32 RESETDEV = 7;
|
||||
internal const UInt32 SETBREAK = 8;
|
||||
internal const UInt32 CLRBREAK = 9;
|
||||
|
||||
//Constants for lpErrors:
|
||||
internal const UInt32 CE_RXOVER = 0x0001;
|
||||
internal const UInt32 CE_OVERRUN = 0x0002;
|
||||
@ -42,12 +31,6 @@ internal class Win32Com
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean TransmitCommChar(IntPtr hFile, Byte cChar);
|
||||
|
||||
/// <summary>
|
||||
/// Control port functions.
|
||||
/// </summary>
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean EscapeCommFunction(IntPtr hFile, UInt32 dwFunc);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean GetCommModemStatus(IntPtr hFile, out UInt32 lpModemStat);
|
||||
}
|
Loading…
Reference in New Issue
Block a user