From e769d38d2c221cc1673da6b625f5545b15c8d3e7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Sep 2022 14:14:04 +0200 Subject: [PATCH] implement packet passing --- tmtc/deps/spacepackets | 2 +- tmtc/tmtcc.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tmtc/deps/spacepackets b/tmtc/deps/spacepackets index 0b50501..6da0217 160000 --- a/tmtc/deps/spacepackets +++ b/tmtc/deps/spacepackets @@ -1 +1 @@ -Subproject commit 0b50501c6735089910f0272e091daddbd7d03336 +Subproject commit 6da02173f1ca0b58c704d25ed332808e693a87be diff --git a/tmtc/tmtcc.py b/tmtc/tmtcc.py index d4d7860..c4056a0 100755 --- a/tmtc/tmtcc.py +++ b/tmtc/tmtcc.py @@ -7,7 +7,8 @@ from typing import Sequence, Optional from spacepackets import SpacePacket, SpacePacketHeader, PacketTypes from spacepackets.cfdp import ConditionCode, TransmissionModes, PduType, DirectiveType -from spacepackets.cfdp.pdu import AbstractFileDirectiveBase, PduHolder +from spacepackets.cfdp.pdu import AbstractFileDirectiveBase, PduHolder, PduFactory +from spacepackets.cfdp.pdu.helper import GenericPduPacket from spacepackets.ecss import PusVerificator import tmtccmd @@ -79,7 +80,9 @@ class CfdpCcsdsWrapper: def pass_packet(self, packet: SpacePacket): # Unwrap the user data and pass it to the handler - pass + pdu_raw = packet.user_data + pdu_base = PduFactory.from_raw(pdu_raw) + self.handler.pass_packet(pdu_base) class CfdpHandler(CfdpUserBase): @@ -125,7 +128,7 @@ class CfdpHandler(CfdpUserBase): 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: GenericPduPacket): """This function routes the packets based on PDU type and directive type if applicable. The routing is based on section 4.5 of the CFDP standard whcih specifies the PDU forwarding