diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-06-05 20:02:18 +0200 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-06-05 20:02:18 +0200 |
commit | abb39ea6167aa1e6c4cbc3695a6d0a5440022ad6 (patch) | |
tree | 7c1d216b02128c40f247c6339cf64e45df958830 /lab_control/connection | |
parent | 6db2d5c1ea2c50c479d4ff7b38359529bc12bb83 (diff) |
Diffstat (limited to 'lab_control/connection')
-rw-r--r-- | lab_control/connection/direct_connection.py | 6 | ||||
-rw-r--r-- | lab_control/connection/serial_connection.py | 8 | ||||
-rw-r--r-- | lab_control/connection/tcp_connection.py | 5 |
3 files changed, 5 insertions, 14 deletions
diff --git a/lab_control/connection/direct_connection.py b/lab_control/connection/direct_connection.py index 8df1e42..0ea2ea3 100644 --- a/lab_control/connection/direct_connection.py +++ b/lab_control/connection/direct_connection.py @@ -12,9 +12,3 @@ class DirectConnection: def send(self, request: str, responseExpected=True) -> str: return self.requestHandler(request) - - def checkConfiguration(self) -> None: - assert self.config.get("baudrate") == 115200 - assert self.config.get("bytesize") == 8 - assert self.config.get("stopbits") == 1 - assert self.config.get("parity") == "N" diff --git a/lab_control/connection/serial_connection.py b/lab_control/connection/serial_connection.py index 282494b..2e48d56 100644 --- a/lab_control/connection/serial_connection.py +++ b/lab_control/connection/serial_connection.py @@ -6,10 +6,10 @@ class SerialConnection: self._port = serial.Serial(portName) def configure(self, config: dict) -> None: - self._port.baudrate = parameters["baudrate"] - self._port.bytesize = parameters["bytesize"] - self._port.stopbits = parameters["stopbits"] - self._port.parity = parameters["parity"] + self._port.baudrate = config["baudrate"] + self._port.bytesize = config["bytesize"] + self._port.stopbits = config["stopbits"] + self._port.parity = config["parity"] def send(self, request): self._port.write(request.encode()) diff --git a/lab_control/connection/tcp_connection.py b/lab_control/connection/tcp_connection.py index 6af710c..bdbf811 100644 --- a/lab_control/connection/tcp_connection.py +++ b/lab_control/connection/tcp_connection.py @@ -6,7 +6,7 @@ class TCPConnection: self._socket.connect((address, port)) def configure(self, config: dict) -> None: - self._socket.settimeout(parameters["timeout"]) + self._socket.settimeout(config["timeout"]) def send(self, request, responseExpected=True): self._socket.sendall(request.encode()) @@ -17,6 +17,3 @@ class TCPConnection: except TimeoutError: response = None return response - - def checkConfiguration(self) -> None: - pass |