diff --git a/Nefarius.Peripherals.SerialPort/NativeMethods.txt b/Nefarius.Peripherals.SerialPort/NativeMethods.txt index 15e5192..3194ae2 100644 --- a/Nefarius.Peripherals.SerialPort/NativeMethods.txt +++ b/Nefarius.Peripherals.SerialPort/NativeMethods.txt @@ -1,19 +1,20 @@ -CreateFile +CancelIo +ClearCommError +EscapeCommFunction FILE_ACCESS_RIGHTS +GetCommModemStatus +GetCommProperties GetHandleInformation +GetHandleInformation +GetOverlappedResult +MODEM_STATUS_FLAGS +ReadFile +SetCommMask SetCommState SetCommTimeouts SetupComm -WriteFile -SetCommMask -WaitCommEvent -CancelIo -ReadFile TransmitCommChar -EscapeCommFunction -GetCommModemStatus -GetOverlappedResult -ClearCommError -GetCommProperties WIN32_ERROR -GetHandleInformation \ No newline at end of file +WaitCommEvent +WriteFile +CreateFile \ No newline at end of file diff --git a/Nefarius.Peripherals.SerialPort/SerialPort.cs b/Nefarius.Peripherals.SerialPort/SerialPort.cs index 7dde20b..8c8d25d 100644 --- a/Nefarius.Peripherals.SerialPort/SerialPort.cs +++ b/Nefarius.Peripherals.SerialPort/SerialPort.cs @@ -568,25 +568,25 @@ public partial class SerialPort : IDisposable OnBreak(); } - uint i = 0; + MODEM_STATUS_FLAGS i = 0; if ((eventMask & COMM_EVENT_MASK.EV_CTS) != 0) { - i |= Win32Com.MS_CTS_ON; + i |= MODEM_STATUS_FLAGS.MS_CTS_ON; } if ((eventMask & COMM_EVENT_MASK.EV_DSR) != 0) { - i |= Win32Com.MS_DSR_ON; + i |= MODEM_STATUS_FLAGS.MS_DSR_ON; } if ((eventMask & COMM_EVENT_MASK.EV_RLSD) != 0) { - i |= Win32Com.MS_RLSD_ON; + i |= MODEM_STATUS_FLAGS.MS_RLSD_ON; } if ((eventMask & COMM_EVENT_MASK.EV_RING) != 0) { - i |= Win32Com.MS_RING_ON; + i |= MODEM_STATUS_FLAGS.MS_RING_ON; } if (i != 0) @@ -596,7 +596,7 @@ public partial class SerialPort : IDisposable throw new CommPortException("IO Error [005]"); } - OnStatusChange(new ModemStatus((MODEM_STATUS_FLAGS)i), new ModemStatus((MODEM_STATUS_FLAGS)f)); + OnStatusChange(new ModemStatus(i), new ModemStatus((MODEM_STATUS_FLAGS)f)); } } } diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs index 98b2284..010308c 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs @@ -16,12 +16,6 @@ internal class Win32Com internal const UInt32 SETBREAK = 8; internal const UInt32 CLRBREAK = 9; - // Constants for lpModemStat: - internal const UInt32 MS_CTS_ON = 0x0010; - internal const UInt32 MS_DSR_ON = 0x0020; - internal const UInt32 MS_RING_ON = 0x0040; - internal const UInt32 MS_RLSD_ON = 0x0080; - //Constants for lpErrors: internal const UInt32 CE_RXOVER = 0x0001; internal const UInt32 CE_OVERRUN = 0x0002;