Migrated to CsWin32 #1
@ -20,3 +20,4 @@ WriteFile
|
||||
CreateFile
|
||||
ESCAPE_COMM_FUNCTION
|
||||
EscapeCommFunction
|
||||
CLEAR_COMM_ERROR_FLAGS
|
@ -496,7 +496,7 @@ public partial class SerialPort : IDisposable
|
||||
if (PInvoke.ClearCommError(_hPort, &errs, null))
|
||||
{
|
||||
StringBuilder s = new("UART Error: ", 40);
|
||||
if (((uint)errs & Win32Com.CE_FRAME) != 0)
|
||||
if (((uint)errs & (uint)CLEAR_COMM_ERROR_FLAGS.CE_FRAME) != 0)
|
||||
{
|
||||
s = s.Append("Framing,");
|
||||
}
|
||||
@ -506,17 +506,17 @@ public partial class SerialPort : IDisposable
|
||||
s = s.Append("IO,");
|
||||
}
|
||||
|
||||
if (((uint)errs & Win32Com.CE_OVERRUN) != 0)
|
||||
if (((uint)errs & (uint)CLEAR_COMM_ERROR_FLAGS.CE_OVERRUN) != 0)
|
||||
{
|
||||
s = s.Append("Overrun,");
|
||||
}
|
||||
|
||||
if (((uint)errs & Win32Com.CE_RXOVER) != 0)
|
||||
if (((uint)errs & (uint)CLEAR_COMM_ERROR_FLAGS.CE_RXOVER) != 0)
|
||||
{
|
||||
s = s.Append("Receive Overflow,");
|
||||
}
|
||||
|
||||
if (((uint)errs & Win32Com.CE_RXPARITY) != 0)
|
||||
if (((uint)errs & (uint)CLEAR_COMM_ERROR_FLAGS.CE_RXPARITY) != 0)
|
||||
{
|
||||
s = s.Append("Parity,");
|
||||
}
|
||||
|
@ -6,11 +6,6 @@ namespace Nefarius.Peripherals.SerialPort.Win32PInvoke;
|
||||
internal class Win32Com
|
||||
{
|
||||
//Constants for lpErrors:
|
||||
internal const UInt32 CE_RXOVER = 0x0001;
|
||||
internal const UInt32 CE_OVERRUN = 0x0002;
|
||||
internal const UInt32 CE_RXPARITY = 0x0004;
|
||||
internal const UInt32 CE_FRAME = 0x0008;
|
||||
internal const UInt32 CE_BREAK = 0x0010;
|
||||
internal const UInt32 CE_TXFULL = 0x0100;
|
||||
internal const UInt32 CE_PTO = 0x0200;
|
||||
internal const UInt32 CE_IOE = 0x0400;
|
||||
|
Loading…
Reference in New Issue
Block a user