本文整理匯總了Python中serial.win32.CloseHandle方法的典型用法代碼示例。如果您正苦於以下問題:Python win32.CloseHandle方法的具體用法?Python win32.CloseHandle怎麽用?Python win32.CloseHandle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類serial.win32
的用法示例。
在下文中一共展示了win32.CloseHandle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _close
# 需要導入模塊: from serial import win32 [as 別名]
# 或者: from serial.win32 import CloseHandle [as 別名]
def _close(self):
"""internal close port helper"""
if self._port_handle:
# Restore original timeout values:
win32.SetCommTimeouts(self._port_handle, self._orgTimeouts)
# Close COM-Port:
win32.CloseHandle(self._port_handle)
if self._overlapped_read is not None:
win32.CloseHandle(self._overlapped_read.hEvent)
self._overlapped_read = None
if self._overlapped_write is not None:
win32.CloseHandle(self._overlapped_write.hEvent)
self._overlapped_write = None
self._port_handle = None
示例2: _close
# 需要導入模塊: from serial import win32 [as 別名]
# 或者: from serial.win32 import CloseHandle [as 別名]
def _close(self):
"""internal close port helper"""
if self.hComPort:
# Restore original timeout values:
win32.SetCommTimeouts(self.hComPort, self._orgTimeouts)
# Close COM-Port:
win32.CloseHandle(self.hComPort)
if self._overlappedRead is not None:
win32.CloseHandle(self._overlappedRead.hEvent)
self._overlappedRead = None
if self._overlappedWrite is not None:
win32.CloseHandle(self._overlappedWrite.hEvent)
self._overlappedWrite = None
self.hComPort = None
示例3: _close
# 需要導入模塊: from serial import win32 [as 別名]
# 或者: from serial.win32 import CloseHandle [as 別名]
def _close(self):
"""internal close port helper"""
if self._port_handle is not None:
# Restore original timeout values:
win32.SetCommTimeouts(self._port_handle, self._orgTimeouts)
if self._overlapped_read is not None:
self.cancel_read()
win32.CloseHandle(self._overlapped_read.hEvent)
self._overlapped_read = None
if self._overlapped_write is not None:
self.cancel_write()
win32.CloseHandle(self._overlapped_write.hEvent)
self._overlapped_write = None
win32.CloseHandle(self._port_handle)
self._port_handle = None
示例4: close
# 需要導入模塊: from serial import win32 [as 別名]
# 或者: from serial.win32 import CloseHandle [as 別名]
def close(self):
"""Close port"""
if self._isOpen:
if self.hComPort:
# Restore original timeout values:
win32.SetCommTimeouts(self.hComPort, self._orgTimeouts)
# Close COM-Port:
win32.CloseHandle(self.hComPort)
win32.CloseHandle(self._overlappedRead.hEvent)
win32.CloseHandle(self._overlappedWrite.hEvent)
self.hComPort = None
self._isOpen = False