simplifications
This commit is contained in:
parent
6a7a8bac47
commit
d737ba90f9
36
common.py
36
common.py
@ -142,27 +142,20 @@ class CfdpHandler:
|
||||
):
|
||||
self.dest_id = UnsignedByteField(EXAMPLE_PUS_APID, 2)
|
||||
self.remote_cfg_table = RemoteEntityCfgTable()
|
||||
self.remote_cfg_table.add_remote_entities(remote_cfg)
|
||||
self.remote_cfg_table.add_configs(remote_cfg)
|
||||
self.dest_handler = DestHandler(cfg, user, self.remote_cfg_table)
|
||||
self.source_handler = SourceHandler(cfg, seq_cnt_provider, user)
|
||||
|
||||
def put_request_file(
|
||||
def put_request(
|
||||
self,
|
||||
source_path: Path,
|
||||
dest_path: Path,
|
||||
trans_mode: TransmissionModes,
|
||||
closure_requested: bool,
|
||||
request: PutRequest
|
||||
):
|
||||
put_request_cfg = PutRequestCfg(
|
||||
destination_id=self.dest_id,
|
||||
source_file=source_path,
|
||||
dest_file=dest_path.as_posix(),
|
||||
trans_mode=trans_mode,
|
||||
closure_requested=closure_requested,
|
||||
)
|
||||
put_request = PutRequest(put_request_cfg)
|
||||
if self.remote_cfg_table.get_cfg(request.cfg.destination_id):
|
||||
raise ValueError(
|
||||
f"No remote CFDP config found for entity ID {request.cfg.destination_id}"
|
||||
)
|
||||
self.source_handler.put_request(
|
||||
put_request, self.remote_cfg_table.get_remote_entity(self.dest_id)
|
||||
request, self.remote_cfg_table.get_cfg(self.dest_id)
|
||||
)
|
||||
|
||||
def pull_next_dest_packet(self) -> Optional[PduHolder]:
|
||||
@ -237,7 +230,7 @@ class TcHandler(TcHandlerBase):
|
||||
def __init__(
|
||||
self,
|
||||
seq_count_provider: FileSeqCountProvider,
|
||||
cfdp_handler: CfdpCcsdsWrapper,
|
||||
cfdp_in_ccsds_wrapper: CfdpCcsdsWrapper,
|
||||
pus_verificator: PusVerificator,
|
||||
file_logger: logging.Logger,
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
@ -253,7 +246,7 @@ class TcHandler(TcHandlerBase):
|
||||
seq_cnt_provider=seq_count_provider,
|
||||
pus_verificator=pus_verificator,
|
||||
)
|
||||
self.cfdp_handler = cfdp_handler
|
||||
self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper
|
||||
|
||||
def feed_cb(self, info: ProcedureHelper, wrapper: FeedWrapper):
|
||||
self.queue_helper.queue_wrapper = wrapper.queue_wrapper
|
||||
@ -287,8 +280,11 @@ class TcHandler(TcHandlerBase):
|
||||
def handle_cfdp_procedure(self, info: ProcedureHelper):
|
||||
cfdp_procedure = info.to_cfdp_procedure()
|
||||
if cfdp_procedure.cfdp_request_type == CfdpRequestType.PUT:
|
||||
# TODO: Start put request if there isn't one pending yet
|
||||
# self.cfdp_handler.handler.put_request_file(...)
|
||||
# TODO: Only start put request if there isn't one pending yet. The source handler
|
||||
# state can probably be used for this.
|
||||
self.cfdp_in_ccsds_wrapper.handler.put_request(
|
||||
cfdp_procedure.request_wrapper.to_put_request()
|
||||
)
|
||||
pass
|
||||
pass
|
||||
|
||||
@ -359,7 +355,7 @@ def setup_tmtc_handlers(
|
||||
raw_logger=raw_logger,
|
||||
pus_verificator=verif_wrapper.pus_verificator,
|
||||
seq_count_provider=PusFileSeqCountProvider(),
|
||||
cfdp_handler=cfdp_handler,
|
||||
cfdp_in_ccsds_wrapper=cfdp_handler,
|
||||
)
|
||||
return ccsds_handler, tc_handler
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user