delete obsolete module, add log printout
This commit is contained in:
65
common.py
65
common.py
@ -123,38 +123,43 @@ class TcHandler(TcHandlerBase):
|
||||
def send_cb(self, params: SendCbParams):
|
||||
if params.entry.is_tc:
|
||||
if params.entry.entry_type == TcQueueEntryType.PUS_TC:
|
||||
pus_tc_wrapper = params.entry.to_pus_tc_entry()
|
||||
# TODO: All of this stuff should be done during queue insertion time
|
||||
# This requires the queue helper to be optionally able to perform TC
|
||||
# post-processing via a callback or something similar. Then an API can be
|
||||
# added which is also able to pack time tagged TCs and stamping both TCs
|
||||
pus_tc_wrapper.pus_tc.seq_count = (
|
||||
self.seq_count_provider.get_and_increment()
|
||||
self.handle_tc_send_cb(params)
|
||||
elif params.entry.entry_type == TcQueueEntryType.LOG:
|
||||
LOGGER.info(params.entry.to_log_entry().log_str)
|
||||
|
||||
def handle_tc_send_cb(self, params: SendCbParams):
|
||||
pus_tc_wrapper = params.entry.to_pus_tc_entry()
|
||||
# TODO: All of this stuff should be done during queue insertion time
|
||||
# This requires the queue helper to be optionally able to perform TC
|
||||
# post-processing via a callback or something similar. Then an API can be
|
||||
# added which is also able to pack time tagged TCs and stamping both TCs
|
||||
pus_tc_wrapper.pus_tc.seq_count = (
|
||||
self.seq_count_provider.get_and_increment()
|
||||
)
|
||||
pus_tc_wrapper.pus_tc.apid = EXAMPLE_APID
|
||||
if (
|
||||
pus_tc_wrapper.pus_tc.service == 11
|
||||
and pus_tc_wrapper.pus_tc.subservice == Pus11Subservices.TC_INSERT
|
||||
):
|
||||
try:
|
||||
pus_tc = PusTelecommand.unpack(
|
||||
pus_tc_wrapper.pus_tc.app_data[4:]
|
||||
)
|
||||
pus_tc_wrapper.pus_tc.apid = EXAMPLE_APID
|
||||
if (
|
||||
pus_tc_wrapper.pus_tc.service == 11
|
||||
and pus_tc_wrapper.pus_tc.subservice == Pus11Subservices.TC_INSERT
|
||||
):
|
||||
try:
|
||||
pus_tc = PusTelecommand.unpack(
|
||||
pus_tc_wrapper.pus_tc.app_data[4:]
|
||||
)
|
||||
self.pus_verificator.add_tc(pus_tc)
|
||||
except ValueError as e:
|
||||
LOGGER.warning(
|
||||
f"Attempt of unpacking time tagged TC failed with exception {e}"
|
||||
)
|
||||
# Add TC after Sequence Count stamping
|
||||
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||
self.raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
||||
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
||||
LOGGER.info(tc_info_string)
|
||||
self.file_logger.info(
|
||||
f"{get_current_time_string(True)}: {tc_info_string}"
|
||||
self.pus_verificator.add_tc(pus_tc)
|
||||
except ValueError as e:
|
||||
LOGGER.warning(
|
||||
f"Attempt of unpacking time tagged TC failed with exception {e}"
|
||||
)
|
||||
params.com_if.send(raw_tc)
|
||||
# Add TC after Sequence Count stamping
|
||||
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||
self.raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
||||
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
||||
LOGGER.info(tc_info_string)
|
||||
self.file_logger.info(
|
||||
f"{get_current_time_string(True)}: {tc_info_string}"
|
||||
)
|
||||
params.com_if.send(raw_tc)
|
||||
|
||||
def queue_finished_cb(self, info: ProcedureHelper):
|
||||
if info is not None and info.proc_type == TcQueueEntryType.PUS_TC:
|
||||
|
Reference in New Issue
Block a user