summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorARF1 <ARF1@github>2019-05-13 15:26:39 +0200
committerARF1 <ARF1@github>2019-05-13 15:26:39 +0200
commit688e9b310a8026b7aa5a910f0ec4436df08c53e1 (patch)
treec64894a3b91f219add4a296db8376d9b3b9bdcef
parenta4d8f27bf636ee598c4368d7e488f78a226bf778 (diff)
downloadpyserial-git-688e9b310a8026b7aa5a910f0ec4436df08c53e1.tar.gz
Add WaitCommEvent function to win32
This is helpful when a user wants to wait for some kind of communication event. E.g. listening for parity errors, etc.
-rw-r--r--serial/win32.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/serial/win32.py b/serial/win32.py
index 08b6e67..157f470 100644
--- a/serial/win32.py
+++ b/serial/win32.py
@@ -181,6 +181,10 @@ WaitForSingleObject = _stdcall_libraries['kernel32'].WaitForSingleObject
WaitForSingleObject.restype = DWORD
WaitForSingleObject.argtypes = [HANDLE, DWORD]
+WaitCommEvent = _stdcall_libraries['kernel32'].WaitCommEvent
+WaitCommEvent.restype = BOOL
+WaitCommEvent.argtypes = [HANDLE, LPDWORD, LPOVERLAPPED]
+
CancelIoEx = _stdcall_libraries['kernel32'].CancelIoEx
CancelIoEx.restype = BOOL
CancelIoEx.argtypes = [HANDLE, LPOVERLAPPED]
@@ -247,6 +251,12 @@ EV_BREAK = 64 # Variable c_int
PURGE_RXCLEAR = 8 # Variable c_int
INFINITE = 0xFFFFFFFF
+CE_RXOVER = 0x0001
+CE_OVERRUN = 0x0002
+CE_RXPARITY = 0x0004
+CE_FRAME = 0x0008
+CE_BREAK = 0x0010
+
class N11_OVERLAPPED4DOLLAR_48E(Union):
pass