本文整理汇总了Python中io.RawIOBase.readline方法的典型用法代码示例。如果您正苦于以下问题:Python RawIOBase.readline方法的具体用法?Python RawIOBase.readline怎么用?Python RawIOBase.readline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.RawIOBase
的用法示例。
在下文中一共展示了RawIOBase.readline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wait_until_ready
# 需要导入模块: from io import RawIOBase [as 别名]
# 或者: from io.RawIOBase import readline [as 别名]
def wait_until_ready(self, channel:RawIOBase, timeout=60):
"""
sends ' ' (space) and waits for the corresponding ACK message. Once we have 3 of these in a row we can be fairly
certain the device is ready for ymodem.
:param channel:
:param timeout:
:return:
"""
success_count = 0
while channel.readline(): # flush any existing data
success_count = 0
while success_count < 2:
channel.write(b' ')
result = channel.read()
if result and result[0]==LightYModemProtocol.ack:
success_count += 1