now only args to put req conversion missing

This commit is contained in:
Robin Müller 2022-09-09 15:24:23 +02:00
parent d737ba90f9
commit aca667248c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -19,7 +19,7 @@ from tmtccmd.cfdp import (
CfdpUserBase,
)
from spacepackets.util import UnsignedByteField
from tmtccmd.cfdp.defs import CfdpRequestType
from tmtccmd.cfdp.defs import CfdpRequestType, CfdpStates
from tmtccmd.cfdp.handler import SourceHandler, DestHandler
from tmtccmd.cfdp.request import PutRequest, PutRequestCfg
from tmtccmd.logging import get_current_time_string
@ -164,6 +164,9 @@ class CfdpHandler:
return self.dest_handler.pdu_holder
return None
def put_request_pending(self) -> bool:
return self.source_handler.states.state != CfdpStates.IDLE
def confirm_dest_packet_sent(self):
self.dest_handler.confirm_packet_sent_advance_fsm()
@ -280,11 +283,12 @@ class TcHandler(TcHandlerBase):
def handle_cfdp_procedure(self, info: ProcedureHelper):
cfdp_procedure = info.to_cfdp_procedure()
if cfdp_procedure.cfdp_request_type == CfdpRequestType.PUT:
if not self.cfdp_in_ccsds_wrapper.handler.put_request_pending():
put_req = cfdp_procedure.request_wrapper.to_put_request()
LOGGER.info(f"Starting put request {put_req}")
# 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()
)
self.cfdp_in_ccsds_wrapper.handler.put_request(put_req)
pass
pass