diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2009-08-05 12:44:46 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2009-08-05 12:44:46 +0000 |
commit | 8ccc2ffa545d4c337f639267cc46df300614f84c (patch) | |
tree | 0f2cdba77954d470a6f8aea091bc74541b15125f | |
parent | e3ab3533d4285162440be221c3e140c48165b53b (diff) | |
download | pyserial-git-8ccc2ffa545d4c337f639267cc46df300614f84c.tar.gz |
- rename RFC2217 server helper class
- better names in example code
-rw-r--r-- | pyserial/examples/tcp_serial_redirect.py | 11 | ||||
-rw-r--r-- | pyserial/serial/rfc2217.py | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/pyserial/examples/tcp_serial_redirect.py b/pyserial/examples/tcp_serial_redirect.py index 7bfe5d8..896e0a0 100644 --- a/pyserial/examples/tcp_serial_redirect.py +++ b/pyserial/examples/tcp_serial_redirect.py @@ -26,17 +26,16 @@ class Redirector: self.ser_newline = ser_newline self.net_newline = net_newline self.spy = spy - self.rfc2217 = rfc2217 self._write_lock = threading.Lock() - if self.rfc2217: - self.manager = serial.rfc2217.RFC2217Manager(self.serial, self, debug_output=False) + if rfc2217: + self.rfc2217 = serial.rfc2217.PortManager(self.serial, self, debug_output=False) else: - self.manager = None + self.rfc2217 = None def statusline_poller(self): while self.alive: time.sleep(1) - self.manager.check_modem_lines() + self.rfc2217.check_modem_lines() def shortcut(self): """connect the serial port to the TCP port by copying everything @@ -97,7 +96,7 @@ class Redirector: if not data: break if self.rfc2217: - data = ''.join(self.manager.filter(data)) + data = ''.join(self.rfc2217.filter(data)) if self.ser_newline and self.net_newline: # do the newline conversion # XXX fails for CR+LF in input when it is cut in half at the begin or end of the string diff --git a/pyserial/serial/rfc2217.py b/pyserial/serial/rfc2217.py index e4a4e8d..8f1bbe9 100644 --- a/pyserial/serial/rfc2217.py +++ b/pyserial/serial/rfc2217.py @@ -794,7 +794,7 @@ else: # ### # The following is code that helps implementing an RFC2217 server. -class RFC2217Manager(object): +class PortManager(object): """This class manages the state of Telnet and RFC2217. It needs a serial instance and a connection to work with. connection is expected to implement a thread safe write function""" |