Migrated to CsWin32 #1

Merged
nefarius merged 14 commits from nefarius/bugfix/refactoring into master 2024-07-13 15:32:14 +02:00
3 changed files with 6 additions and 10 deletions
Showing only changes of commit a8068becba - Show all commits

View File

@ -19,4 +19,5 @@ WaitCommEvent
WriteFile WriteFile
CreateFile CreateFile
ESCAPE_COMM_FUNCTION ESCAPE_COMM_FUNCTION
EscapeCommFunction EscapeCommFunction
CLEAR_COMM_ERROR_FLAGS

View File

@ -496,7 +496,7 @@ public partial class SerialPort : IDisposable
if (PInvoke.ClearCommError(_hPort, &errs, null)) if (PInvoke.ClearCommError(_hPort, &errs, null))
{ {
StringBuilder s = new("UART Error: ", 40); 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,"); s = s.Append("Framing,");
} }
@ -506,17 +506,17 @@ public partial class SerialPort : IDisposable
s = s.Append("IO,"); 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,"); 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,"); 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,"); s = s.Append("Parity,");
} }

View File

@ -6,11 +6,6 @@ namespace Nefarius.Peripherals.SerialPort.Win32PInvoke;
internal class Win32Com internal class Win32Com
{ {
//Constants for lpErrors: //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_TXFULL = 0x0100;
internal const UInt32 CE_PTO = 0x0200; internal const UInt32 CE_PTO = 0x0200;
internal const UInt32 CE_IOE = 0x0400; internal const UInt32 CE_IOE = 0x0400;