provide some more helper functions

This commit is contained in:
Robin Müller 2022-09-09 10:51:06 +02:00
parent 6f9a866e9c
commit e296554827
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 10 additions and 1 deletions

View File

@ -3,7 +3,7 @@
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from typing import Sequence from typing import Sequence, Optional
from spacepackets.cfdp import ConditionCode, TransmissionModes, PduType, DirectiveType from spacepackets.cfdp import ConditionCode, TransmissionModes, PduType, DirectiveType
from spacepackets.cfdp.pdu import AbstractFileDirectiveBase, PduHolder from spacepackets.cfdp.pdu import AbstractFileDirectiveBase, PduHolder
@ -81,6 +81,15 @@ class CfdpHandler(CfdpUserBase):
put_request, self.remote_cfg_table.get_remote_entity(self.dest_id) put_request, self.remote_cfg_table.get_remote_entity(self.dest_id)
) )
def pull_next_dest_packet(self) -> Optional[PduHolder]:
res = self.dest_handler.state_machine()
if res.states.packet_ready:
return self.dest_handler.pdu_holder
return None
def confirm_dest_packet_sent(self):
self.dest_handler.confirm_packet_sent_advance_fsm()
def pass_packet(self, packet: AbstractFileDirectiveBase): def pass_packet(self, packet: AbstractFileDirectiveBase):
"""This function routes the packets based on PDU type and directive type if applicable. """This function routes the packets based on PDU type and directive type if applicable.