Add ACS Subsystem Commands #117
28
tmtcc.py
28
tmtcc.py
@ -97,7 +97,6 @@ from pus_tc.procedure_packer import handle_default_procedure
|
|||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
# Put rotating file logger parameters here for quick changes
|
# Put rotating file logger parameters here for quick changes
|
||||||
ROTATING_TIMED_LOGGER_INTERVAL_WHEN = TimedLogWhen.PER_MINUTE
|
ROTATING_TIMED_LOGGER_INTERVAL_WHEN = TimedLogWhen.PER_MINUTE
|
||||||
ROTATING_TIMED_LOGGER_INTERVAL = 30
|
ROTATING_TIMED_LOGGER_INTERVAL = 30
|
||||||
@ -207,8 +206,8 @@ class TcHandler(TcHandlerBase):
|
|||||||
seq_count_provider: FileSeqCountProvider,
|
seq_count_provider: FileSeqCountProvider,
|
||||||
cfdp_in_ccsds_wrapper: CfdpInCcsdsWrapper,
|
cfdp_in_ccsds_wrapper: CfdpInCcsdsWrapper,
|
||||||
pus_verificator: PusVerificator,
|
pus_verificator: PusVerificator,
|
||||||
file_logger: logging.Logger,
|
high_level_file_logger: logging.Logger,
|
||||||
raw_logger: RawTmtcTimedLogWrapper,
|
raw_pus_logger: RawTmtcTimedLogWrapper,
|
||||||
gui: bool,
|
gui: bool,
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -216,8 +215,8 @@ class TcHandler(TcHandlerBase):
|
|||||||
self.cfdp_dest_id = CFDP_REMOTE_ENTITY_ID
|
self.cfdp_dest_id = CFDP_REMOTE_ENTITY_ID
|
||||||
self.seq_count_provider = seq_count_provider
|
self.seq_count_provider = seq_count_provider
|
||||||
self.pus_verificator = pus_verificator
|
self.pus_verificator = pus_verificator
|
||||||
self.file_logger = file_logger
|
self.high_level_file_logger = high_level_file_logger
|
||||||
self.raw_logger = raw_logger
|
self.pus_raw_logger = raw_pus_logger
|
||||||
self.gui = gui
|
self.gui = gui
|
||||||
self.queue_helper = DefaultPusQueueHelper(
|
self.queue_helper = DefaultPusQueueHelper(
|
||||||
queue_wrapper=None,
|
queue_wrapper=None,
|
||||||
@ -226,6 +225,7 @@ class TcHandler(TcHandlerBase):
|
|||||||
pus_verificator=pus_verificator,
|
pus_verificator=pus_verificator,
|
||||||
)
|
)
|
||||||
self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper
|
self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper
|
||||||
|
# self.cfdp_counter = 0
|
||||||
|
|
||||||
def cfdp_done(self) -> bool:
|
def cfdp_done(self) -> bool:
|
||||||
return not self.cfdp_in_ccsds_wrapper.handler.put_request_pending()
|
return not self.cfdp_in_ccsds_wrapper.handler.put_request_pending()
|
||||||
@ -249,20 +249,28 @@ class TcHandler(TcHandlerBase):
|
|||||||
# Add TC after Sequence Count stamping
|
# Add TC after Sequence Count stamping
|
||||||
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
||||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||||
self.raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
self.pus_raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
||||||
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
||||||
LOGGER.info(tc_info_string)
|
LOGGER.info(tc_info_string)
|
||||||
self.file_logger.info(
|
self.high_level_file_logger.info(
|
||||||
f"{get_current_time_string(True)}: {tc_info_string}"
|
f"{get_current_time_string(True)}: {tc_info_string}"
|
||||||
)
|
)
|
||||||
send_params.com_if.send(raw_tc)
|
send_params.com_if.send(raw_tc)
|
||||||
elif entry_helper.entry_type == TcQueueEntryType.CCSDS_TC:
|
elif entry_helper.entry_type == TcQueueEntryType.CCSDS_TC:
|
||||||
cfdp_packet_in_ccsds = entry_helper.to_space_packet_entry()
|
cfdp_packet_in_ccsds = entry_helper.to_space_packet_entry()
|
||||||
send_params.com_if.send(cfdp_packet_in_ccsds.space_packet.pack())
|
send_params.com_if.send(cfdp_packet_in_ccsds.space_packet.pack())
|
||||||
|
# TODO: Log raw CFDP packets similarly to how PUS packets are logged.
|
||||||
|
# - Log full raw format including space packet wrapper
|
||||||
|
# - Log context information: Transaction ID, and PDU type and directive
|
||||||
|
# Could re-use file logger. Should probably do that
|
||||||
|
# print(f"sending packet: [{cfdp_packet_in_ccsds.space_packet.pack()}]")
|
||||||
|
# with open(f"cfdp_packet_{self.cfdp_counter}", "wb") as of:
|
||||||
|
# of.write(cfdp_packet_in_ccsds.space_packet.pack())
|
||||||
|
# self.cfdp_counter += 1
|
||||||
elif entry_helper.entry_type == TcQueueEntryType.LOG:
|
elif entry_helper.entry_type == TcQueueEntryType.LOG:
|
||||||
log_entry = entry_helper.to_log_entry()
|
log_entry = entry_helper.to_log_entry()
|
||||||
LOGGER.info(log_entry.log_str)
|
LOGGER.info(log_entry.log_str)
|
||||||
self.file_logger.info(log_entry.log_str)
|
self.high_level_file_logger.info(log_entry.log_str)
|
||||||
|
|
||||||
def handle_cfdp_procedure(self, info: ProcedureWrapper):
|
def handle_cfdp_procedure(self, info: ProcedureWrapper):
|
||||||
cfdp_procedure = info.to_cfdp_procedure()
|
cfdp_procedure = info.to_cfdp_procedure()
|
||||||
@ -388,8 +396,8 @@ def setup_tmtc_handlers(
|
|||||||
tc_handler = TcHandler(
|
tc_handler = TcHandler(
|
||||||
seq_count_provider=seq_count_provider,
|
seq_count_provider=seq_count_provider,
|
||||||
pus_verificator=verificator,
|
pus_verificator=verificator,
|
||||||
file_logger=printer.file_logger,
|
high_level_file_logger=printer.file_logger,
|
||||||
raw_logger=raw_logger,
|
raw_pus_logger=raw_logger,
|
||||||
gui=gui,
|
gui=gui,
|
||||||
cfdp_in_ccsds_wrapper=cfdp_in_ccsds_wrapper,
|
cfdp_in_ccsds_wrapper=cfdp_in_ccsds_wrapper,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user