summaryrefslogtreecommitdiff
path: root/host/proto/proto.py
diff options
context:
space:
mode:
authorNicolas Schodet2008-12-17 23:40:36 +0100
committerNicolas Schodet2008-12-17 23:40:36 +0100
commit388dd88e6a66ce5eaad6d1392c742d43f328af30 (patch)
treefd051f71d1fabb4a061c63e1bb9336ae4f995f3a /host/proto/proto.py
parent0b85557b4c5f80178c423cf9934435dbe8dc889f (diff)
* host/proto:
- added documentation. - fixed small discordance between documentation and behaviour.
Diffstat (limited to 'host/proto/proto.py')
-rw-r--r--host/proto/proto.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/host/proto/proto.py b/host/proto/proto.py
index 36616d9c..9eb401e1 100644
--- a/host/proto/proto.py
+++ b/host/proto/proto.py
@@ -33,7 +33,14 @@ class Proto:
def __init__ (self, file, date, timeout, log = None):
"""Initialise and set file (serial port, pty, socket...), date
- function and timeout value."""
+ function and timeout value.
+
+ - file: open file connected to the slave device.
+ - date: when called, should return the current time.
+ - timeout: time after which retransmission is done.
+ - log: if defined, will be called with a log string.
+
+ """
self.file = file
self.date = date
self.last_send = None
@@ -70,7 +77,7 @@ class Proto:
def wait (self, cond = None):
"""Wait forever or until cond () is True."""
- while not (self.sync () and (cond is None or cond ())):
+ while not (self.sync () and (cond is not None or cond ())):
fds = select.select ((self,), (), (), self.timeout)[0]
for i in fds:
assert i is self