doc: update API docs, rename inter_byte_timeout
- inter_character_timeout -> inter_byte_timeout
- keyword args for Serial: rename writeTimeout, interCharTimeout
diff --git a/serial/serialposix.py b/serial/serialposix.py
index e760fa0..79eaa66 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -321,9 +321,9 @@
custom_baud = None
vmin = vtime = 0 # timeout is done via select
- if self._inter_character_timeout is not None:
+ if self._inter_byte_timeout is not None:
vmin = 1
- vtime = int(self._inter_character_timeout * 10)
+ vtime = int(self._inter_byte_timeout * 10)
try:
orig_attr = termios.tcgetattr(self.fd)
iflag, oflag, cflag, lflag, ispeed, ospeed, cc = orig_attr
@@ -638,7 +638,7 @@
if not self.is_open: raise portNotOpenError
return self.fd
- def set_input_flow_control(self, level=True):
+ def set_input_flow_control(self, enable=True):
"""\
Manually control flow - when software flow control is enabled.
This will send XON (true) or XOFF (false) to the other device.
@@ -650,7 +650,7 @@
else:
termios.tcflow(self.fd, termios.TCIOFF)
- def set_output_flow_control(self, enable):
+ def set_output_flow_control(self, enable=True):
"""\
Manually control flow of outgoing data - when hardware or software flow
control is enabled.
@@ -692,8 +692,8 @@
# handled below
buf = os.read(self.fd, size - len(read))
read.extend(buf)
- if ((self._timeout is not None and self._timeout >= 0) or
- (self._inter_character_timeout is not None and self._inter_character_timeout > 0)) and not buf:
+ if ((self._timeout is not None and self._timeout >= 0) or
+ (self._inter_byte_timeout is not None and self._inter_byte_timeout > 0)) and not buf:
break # early abort on timeout
return bytes(read)
diff --git a/serial/serialutil.py b/serial/serialutil.py
index 5e3597b..26e6059 100644
--- a/serial/serialutil.py
+++ b/serial/serialutil.py
@@ -117,9 +117,9 @@
timeout=None, # set a timeout value, None to wait forever
xonxoff=False, # enable software flow control
rtscts=False, # enable RTS/CTS flow control
- writeTimeout=None, # set a timeout for writes
+ write_timeout=None, # set a timeout for writes
dsrdtr=False, # None: use rtscts setting, dsrdtr override if True or False
- interCharTimeout=None # Inter-character timeout, None to disable
+ inter_byte_timeout=None # Inter-character timeout, None to disable
):
"""\
Initialize comm port object. If a port is given, then the port will be
@@ -138,7 +138,7 @@
self._xonxoff = None # correct value is assigned below through properties
self._rtscts = None # correct value is assigned below through properties
self._dsrdtr = None # correct value is assigned below through properties
- self._inter_character_timeout = None # correct value is assigned below through properties
+ self._inter_byte_timeout = None # correct value is assigned below through properties
self._rs485_mode = None # disabled by default
self._rts_state = True
self._dtr_state = True
@@ -151,11 +151,11 @@
self.parity = parity
self.stopbits = stopbits
self.timeout = timeout
- self.write_timeout = writeTimeout
+ self.write_timeout = write_timeout
self.xonxoff = xonxoff
self.rtscts = rtscts
self.dsrdtr = dsrdtr
- self.inter_character_timeout = interCharTimeout
+ self.inter_character_timeout = inter_byte_timeout
if port is not None:
self.open()
@@ -296,13 +296,13 @@
@property
- def inter_character_timeout(self):
+ def inter_byte_timeout(self):
"""Get the current inter-character timeout setting."""
return self._interCharTimeout
- @inter_character_timeout.setter
- def inter_character_timeout(self, ic_timeout):
- """Change inter-character timeout setting."""
+ @inter_byte_timeout.setter
+ def inter_byte_timeout(self, ic_timeout):
+ """Change inter-byte timeout setting."""
if ic_timeout is not None:
if ic_timeout < 0: raise ValueError("Not a valid timeout: %r" % ic_timeout)
try:
@@ -310,7 +310,7 @@
except TypeError:
raise ValueError("Not a valid timeout: %r" % ic_timeout)
- self._interCharTimeout = ic_timeout
+ self._inter_byte_timeout = ic_timeout
if self.is_open:
self._reconfigure_port()
diff --git a/serial/serialwin32.py b/serial/serialwin32.py
index b0f92a2..9422373 100644
--- a/serial/serialwin32.py
+++ b/serial/serialwin32.py
@@ -109,8 +109,8 @@
timeouts = (win32.MAXDWORD, 0, 0, 0, 0)
else:
timeouts = (0, 0, int(self._timeout*1000), 0, 0)
- if self._timeout != 0 and self._inter_character_timeout is not None:
- timeouts = (int(self._inter_character_timeout * 1000),) + timeouts[1:]
+ if self._timeout != 0 and self._inter_byte_timeout is not None:
+ timeouts = (int(self._inter_byte_timeout * 1000),) + timeouts[1:]
if self._write_timeout is None:
pass
@@ -393,7 +393,7 @@
if tx_size is None: tx_size = rx_size
win32.SetupComm(self._port_handle, rx_size, tx_size)
- def set_output_flow_control(self, level=True):
+ def set_output_flow_control(self, enable=True):
"""\
Manually control flow - when software flow control is enabled.
This will do the same as if XON (true) or XOFF (false) are received
@@ -401,7 +401,7 @@
WARNING: this function is not portable to different platforms!
"""
if not self._port_handle: raise portNotOpenError
- if level:
+ if enable:
win32.EscapeCommFunction(self._port_handle, win32.SETXON)
else:
win32.EscapeCommFunction(self._port_handle, win32.SETXOFF)