fix TC handler
EIVE/-/pipeline/pr-main This commit looks good Details

This commit is contained in:
Robin Müller 2024-01-25 13:03:04 +01:00
parent b94c20dab1
commit f3eecfa8ac
Signed by: muellerr
GPG Key ID: A649FB78196E3849
1 changed files with 22 additions and 24 deletions

View File

@ -124,40 +124,38 @@ class TcHandler(TcHandlerBase):
_LOGGER.info(
f"CFDP: Starting file put request with parameters:\n{put_req}"
)
assert put_req is not None
self.cfdp_in_ccsds_handler.cfdp_handler.put_request(put_req)
self.cfdp_handler_started = True
for source_pair, dest_pair in self.cfdp_in_ccsds_handler:
pdu, sp = source_pair
pdu = cast(PduHolder, pdu)
if pdu.is_file_directive:
if pdu.pdu_directive_type == DirectiveType.METADATA_PDU:
metadata = pdu.to_metadata_pdu()
for source_pair, _ in self.cfdp_in_ccsds_handler:
if source_pair is not None:
pdu, sp = source_pair
pdu = cast(PduHolder, pdu)
if pdu.is_file_directive:
if pdu.pdu_directive_type == DirectiveType.METADATA_PDU:
metadata = pdu.to_metadata_pdu()
self.queue_helper.add_log_cmd(
"CFDP Source: Sending Metadata PDU for file with size "
f"{metadata.file_size}"
)
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
self.queue_helper.add_log_cmd(
"CFDP Source: Sending EOF PDU"
)
else:
fd_pdu = pdu.to_file_data_pdu()
self.queue_helper.add_log_cmd(
"CFDP Source: Sending Metadata PDU for file with size "
f"{metadata.file_size}"
"CFDP Source: Sending File Data PDU for segment at offset "
f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}"
)
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
self.queue_helper.add_log_cmd(
"CFDP Source: Sending EOF PDU"
)
else:
fd_pdu = pdu.to_file_data_pdu()
self.queue_helper.add_log_cmd(
"CFDP Source: Sending File Data PDU for segment at offset "
f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}"
)
self.queue_helper.add_ccsds_tc(sp)
self.cfdp_in_ccsds_handler.confirm_source_packet_sent()
self.queue_helper.add_ccsds_tc(sp)
self.cfdp_in_ccsds_handler.source_handler.state_machine()
def queue_finished_cb(self, info: ProcedureWrapper):
if info is not None:
if info.proc_type == TcQueueEntryType.PUS_TC:
def_proc = info.to_def_procedure()
_LOGGER.info(
f"Finished queue for service {def_proc.service} and op code"
f" {def_proc.op_code}"
)
_LOGGER.info(f"Finished queue for command {def_proc.cmd_path}")
elif info.proc_type == TcProcedureType.CFDP:
_LOGGER.info("Finished CFDP queue")