threaded: rename SerialPortWorker -> ReaderThread
diff --git a/documentation/pyserial_api.rst b/documentation/pyserial_api.rst
index c23d837..4d7f3ba 100644
--- a/documentation/pyserial_api.rst
+++ b/documentation/pyserial_api.rst
@@ -969,7 +969,7 @@
.. class:: Protocol
- Protocol as used by the :class:`SerialPortWorker`. This base class provides empty
+ Protocol as used by the :class:`ReaderThread`. This base class provides empty
implementations of all methods.
@@ -1047,7 +1047,7 @@
is applied before sending ans also the newline is append.
-.. class:: SerialPortWorker(threading.Thread)
+.. class:: ReaderThread(threading.Thread)
Implement a serial port read loop and dispatch to a Protocol instance (like
the :class:`asyncio.Protocol`) but do it with threads.
@@ -1121,7 +1121,7 @@
sys.stdout.write('port closed\n')
ser = serial.serial_for_url('loop://', baudrate=115200, timeout=1)
- with SerialPortWorker(ser, PrintLines) as protocol:
+ with ReaderThread(ser, PrintLines) as protocol:
protocol.write_line('hello')
time.sleep(2)
diff --git a/examples/at_protocol.py b/examples/at_protocol.py
index d9e881b..a3ccdfd 100644
--- a/examples/at_protocol.py
+++ b/examples/at_protocol.py
@@ -148,7 +148,7 @@
ser = serial.serial_for_url('spy://COM1', baudrate=115200, timeout=1)
#~ ser = serial.Serial('COM1', baudrate=115200, timeout=1)
- with serial.threaded.SerialPortWorker(ser, PAN1322) as bt_module:
+ with serial.threaded.ReaderThread(ser, PAN1322) as bt_module:
bt_module.reset()
print("reset OK")
print("MAC address is", bt_module.get_mac_address())
diff --git a/serial/threaded/__init__.py b/serial/threaded/__init__.py
index fa62e8f..59c6a4a 100644
--- a/serial/threaded/__init__.py
+++ b/serial/threaded/__init__.py
@@ -14,7 +14,7 @@
class Protocol(object):
"""\
- Protocol as used by the SerialPortWorker. This base class provides empty
+ Protocol as used by the ReaderThread. This base class provides empty
implementations of all methods.
"""
@@ -91,7 +91,7 @@
self.transport.write(text.encode(self.ENCODING, self.UNICODE_HANDLING) + self.TERMINATOR)
-class SerialPortWorker(threading.Thread):
+class ReaderThread(threading.Thread):
"""\
Implement a serial port read loop and dispatch to a Protocol instance (like
the asyncio.Protocol) but do it with threads.
@@ -107,7 +107,7 @@
Note that the serial_instance' timeout is set to one second!
Other settings are not changed.
"""
- super(SerialPortWorker, self).__init__()
+ super(ReaderThread, self).__init__()
self.daemon = True
self.serial = serial_instance
self.protocol_factory = protocol_factory
@@ -221,13 +221,13 @@
sys.stdout.write('port closed\n')
ser = serial.serial_for_url('loop://', baudrate=115200, timeout=1)
- with SerialPortWorker(ser, PrintLines) as protocol:
+ with ReaderThread(ser, PrintLines) as protocol:
protocol.write_line('hello')
time.sleep(2)
# alternative usage
ser = serial.serial_for_url('loop://', baudrate=115200, timeout=1)
- t = SerialPortWorker(ser, PrintLines)
+ t = ReaderThread(ser, PrintLines)
t.start()
transport, protocol = t.connect()
protocol.write_line('hello')