本文整理汇总了Python中serial.win32.SetCommTimeouts方法的典型用法代码示例。如果您正苦于以下问题:Python win32.SetCommTimeouts方法的具体用法?Python win32.SetCommTimeouts怎么用?Python win32.SetCommTimeouts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serial.win32
的用法示例。
在下文中一共展示了win32.SetCommTimeouts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _close
# 需要导入模块: from serial import win32 [as 别名]
# 或者: from serial.win32 import SetCommTimeouts [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 SetCommTimeouts [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 SetCommTimeouts [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 SetCommTimeouts [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