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 19 additions and 24 deletions
Showing only changes of commit cd6fecd8fb - Show all commits

View File

@ -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
WaitCommEvent
WriteFile
CreateFile

View File

@ -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));
}
}
}

View File

@ -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;