separate function for cfdp setup
This commit is contained in:
parent
4a9ed5aad0
commit
7b0c8fa25a
26
common.py
26
common.py
@ -7,7 +7,9 @@ from spacepackets import SpacePacket, SpacePacketHeader
|
|||||||
from spacepackets.cfdp import (
|
from spacepackets.cfdp import (
|
||||||
TransmissionModes,
|
TransmissionModes,
|
||||||
ChecksumTypes,
|
ChecksumTypes,
|
||||||
ConditionCode, PduHolder, DirectiveTypes,
|
ConditionCode,
|
||||||
|
PduHolder,
|
||||||
|
DirectiveTypes,
|
||||||
)
|
)
|
||||||
from spacepackets.cfdp.pdu import MetadataPdu, FileDataPdu
|
from spacepackets.cfdp.pdu import MetadataPdu, FileDataPdu
|
||||||
from tmtccmd.cfdp import (
|
from tmtccmd.cfdp import (
|
||||||
@ -260,8 +262,9 @@ class TcHandler(TcHandlerBase):
|
|||||||
f"{metadata.file_size}"
|
f"{metadata.file_size}"
|
||||||
)
|
)
|
||||||
elif pdu.pdu_directive_type == DirectiveTypes.EOF_PDU:
|
elif pdu.pdu_directive_type == DirectiveTypes.EOF_PDU:
|
||||||
eof = pdu.to_eof_pdu()
|
self.queue_helper.add_log_cmd(
|
||||||
self.queue_helper.add_log_cmd(f"CFDP Source: Sending EOF PDU")
|
f"CFDP Source: Sending EOF PDU"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
fd_pdu = pdu.to_file_data_pdu()
|
fd_pdu = pdu.to_file_data_pdu()
|
||||||
self.queue_helper.add_log_cmd(
|
self.queue_helper.add_log_cmd(
|
||||||
@ -336,12 +339,7 @@ def setup_params(hook_obj: TmTcCfgHookBase) -> SetupWrapper:
|
|||||||
return setup_wrapper
|
return setup_wrapper
|
||||||
|
|
||||||
|
|
||||||
def setup_tmtc_handlers(
|
def setup_cfdp_handler() -> CfdpInCcsdsWrapper:
|
||||||
verif_wrapper: VerificationWrapper,
|
|
||||||
printer: FsfwTmTcPrinter,
|
|
||||||
raw_logger: RawTmtcTimedLogWrapper,
|
|
||||||
) -> (CcsdsTmHandler, TcHandler):
|
|
||||||
|
|
||||||
fh_base = ExampleCfdpFaultHandler()
|
fh_base = ExampleCfdpFaultHandler()
|
||||||
cfdp_cfg = LocalEntityCfg(
|
cfdp_cfg = LocalEntityCfg(
|
||||||
local_entity_id=CFDP_LOCAL_ENTITY_ID,
|
local_entity_id=CFDP_LOCAL_ENTITY_ID,
|
||||||
@ -372,13 +370,21 @@ def setup_tmtc_handlers(
|
|||||||
cfdp_seq_cnt_provider=cfdp_seq_count_provider,
|
cfdp_seq_cnt_provider=cfdp_seq_count_provider,
|
||||||
user=cfdp_user,
|
user=cfdp_user,
|
||||||
)
|
)
|
||||||
cfdp_in_ccsds_wrapper = CfdpInCcsdsWrapper(cfdp_in_ccsds_handler)
|
return CfdpInCcsdsWrapper(cfdp_in_ccsds_handler)
|
||||||
|
|
||||||
|
|
||||||
|
def setup_tmtc_handlers(
|
||||||
|
verif_wrapper: VerificationWrapper,
|
||||||
|
printer: FsfwTmTcPrinter,
|
||||||
|
raw_logger: RawTmtcTimedLogWrapper,
|
||||||
|
) -> (CcsdsTmHandler, TcHandler):
|
||||||
|
cfdp_in_ccsds_wrapper = setup_cfdp_handler()
|
||||||
pus_handler = PusHandler(
|
pus_handler = PusHandler(
|
||||||
printer=printer, raw_logger=raw_logger, wrapper=verif_wrapper
|
printer=printer, raw_logger=raw_logger, wrapper=verif_wrapper
|
||||||
)
|
)
|
||||||
ccsds_handler = CcsdsTmHandler(None)
|
ccsds_handler = CcsdsTmHandler(None)
|
||||||
ccsds_handler.add_apid_handler(pus_handler)
|
ccsds_handler.add_apid_handler(pus_handler)
|
||||||
|
ccsds_handler.add_apid_handler(cfdp_in_ccsds_wrapper)
|
||||||
tc_handler = TcHandler(
|
tc_handler = TcHandler(
|
||||||
file_logger=printer.file_logger,
|
file_logger=printer.file_logger,
|
||||||
raw_logger=raw_logger,
|
raw_logger=raw_logger,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user