Skip to content

Commit

Permalink
typing improvement for ComInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jan 30, 2025
1 parent eab89cc commit 12ba6bc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tmtccmd/com/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def close(self, args: Any = 0):
"""

@abstractmethod
def send(self, data: bytes):
def send(self, data: bytes | bytearray):
"""Send raw data.
:raises SendError: Sending failed for some reason.
Expand Down
2 changes: 1 addition & 1 deletion src/tmtccmd/com/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ def data_available(self, timeout: float = 0, parameters: any = 0):
def receive(self, parameters: any = 0) -> List[bytes]:
return self.dummy_handler.receive_reply_package()

def send(self, data: bytes):
def send(self, data: bytes | bytearray):
if data is not None:
self.dummy_handler.insert_telecommand(data)
2 changes: 1 addition & 1 deletion src/tmtccmd/com/serial_cobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def close(self, args: any = None) -> None:
self.__reception_thread.join(0.4)
super().close_port()

def send(self, data: bytes):
def send(self, data: bytes | bytearray):
encoded = bytearray([0])
encoded.extend(cobs.encode(data))
encoded.append(0)
Expand Down
2 changes: 1 addition & 1 deletion src/tmtccmd/com/serial_dle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def close(self, args: any = None) -> None:
self.__reception_thread.join(0.4)
super().close_port()

def send(self, data: bytes):
def send(self, data: bytes | bytearray):
encoded_data = self.__encoder.encode(source_packet=data, add_stx_etx=True)
self.serial.write(encoded_data)

Expand Down
2 changes: 1 addition & 1 deletion src/tmtccmd/com/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def close(self, args: any = None) -> None:
self.__connected = False
self.__tcp_socket = None

def send(self, data: bytes):
def send(self, data: bytes | bytearray):
self.__tc_queue.put(data)

def receive(self, poll_timeout: float = 0) -> List[bytes]:
Expand Down
2 changes: 1 addition & 1 deletion src/tmtccmd/com/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def close(self, args: any = None) -> None:
if self.udp_socket is not None:
self.udp_socket.close()

def send(self, data: bytes):
def send(self, data: bytes | bytearray):
if self.udp_socket is None:
return
bytes_sent = self.udp_socket.sendto(data, self.send_address.to_tuple)
Expand Down

0 comments on commit 12ba6bc

Please sign in to comment.