diff --git a/obsw_tmtc_client.py b/obsw_tmtc_client.py index 49240685d10cded979d0bdbca31e89a4715f9a8a..02ed4b53b9dbee22b2abade04191ce25259b4f7b 100755 --- a/obsw_tmtc_client.py +++ b/obsw_tmtc_client.py @@ -118,21 +118,20 @@ class TmTcHandler: # This flag could be used later to command the TMTC Client with a front-end self.command_received = True self.tmtc_printer = TmTcPrinter(g.G_DISPLAY_MODE, g.G_PRINT_TO_FILE, True) - self.communication_interface = None - self.tm_listener = None + self.communication_interface = set_communication_interface(self.tmtc_printer) + self.tm_listener = TmListener( + com_interface=self.communication_interface, tm_timeout=g.G_TM_TIMEOUT, + tc_timeout_factor=g.G_TC_SEND_TIMEOUT_FACTOR + ) self.initialize_com_if_and_listener() atexit.register(keyboard_interrupt_handler, com_interface=self.communication_interface) def initialize_com_if_and_listener(self): - self.communication_interface = set_communication_interface(self.tmtc_printer) - if self.communication_interface is None: + if not self.communication_interface.valid: LOGGER.info("No communication interface set for now") LOGGER.info("TM listener will not be started") return - self.tm_listener = TmListener( - com_interface=self.communication_interface, tm_timeout=g.G_TM_TIMEOUT, - tc_timeout_factor=g.G_TC_SEND_TIMEOUT_FACTOR - ) + self.tm_listener.start() def perform_operation(self): @@ -168,7 +167,9 @@ class TmTcHandler: if self.tm_listener.event_reply_received.is_set(): LOGGER.info("TmTcHandler: Packets received.") self.tmtc_printer.print_telemetry_queue(self.tm_listener.retrieve_tm_packet_queue()) - self.command_received = True + self.tm_listener.clear_tm_packet_queue() + self.tm_listener.event_reply_received.clear() + self.command_received = True elif self.mode == g.ModeList.SingleCommandMode: pus_packet_tuple = command_preparation() diff --git a/tmtc_core b/tmtc_core index 7314ea01cc62f8513f4310f96286e667399145ba..66da7ab3912f96494b6011f22738d1750149cd44 160000 --- a/tmtc_core +++ b/tmtc_core @@ -1 +1 @@ -Subproject commit 7314ea01cc62f8513f4310f96286e667399145ba +Subproject commit 66da7ab3912f96494b6011f22738d1750149cd44