summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2020-09-14 22:53:50 +0200
committerChris Liechti <cliechti@gmx.net>2020-09-14 22:53:50 +0200
commitc1cd16ededb0d9e163209803f4b0f429dbf06753 (patch)
treebecdfcc1144e998e9a5c848461f633385507dc4e
parentfd095194d765438fd20c30d67805a260d95d1d5f (diff)
downloadpyserial-git-c1cd16ededb0d9e163209803f4b0f429dbf06753.tar.gz
loop: add out_waiting
closes #408
-rw-r--r--serial/urlhandler/protocol_loop.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/serial/urlhandler/protocol_loop.py b/serial/urlhandler/protocol_loop.py
index 526583f..8ac8ddf 100644
--- a/serial/urlhandler/protocol_loop.py
+++ b/serial/urlhandler/protocol_loop.py
@@ -227,6 +227,17 @@ class Serial(SerialBase):
except queue.Empty:
pass
+ @property
+ def out_waiting(self):
+ """Return how many bytes the in the outgoing buffer"""
+ if not self.is_open:
+ raise PortNotOpenError()
+ if self.logger:
+ # attention the logged value can differ from return value in
+ # threaded environments...
+ self.logger.debug('out_waiting -> {:d}'.format(self.queue.qsize()))
+ return self.queue.qsize()
+
def _update_break_state(self):
"""\
Set break: Controls TXD. When active, to transmitting is