| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title PduBase.hpp | ||
| 3 | // \author Brian Campuzano | ||
| 4 | // \brief Base class for all CFDP PDU types | ||
| 5 | // | ||
| 6 | // This base class provides a common interface for all PDU types, | ||
| 7 | // enabling proper construction/destruction and type safety. | ||
| 8 | // ====================================================================== | ||
| 9 | |||
| 10 | #ifndef Svc_Ccsds_Cfdp_PduBase_HPP | ||
| 11 | #define Svc_Ccsds_Cfdp_PduBase_HPP | ||
| 12 | |||
| 13 | #include <Fw/Buffer/Buffer.hpp> | ||
| 14 | #include <Fw/FPrimeBasicTypes.hpp> | ||
| 15 | #include <Fw/Types/Serializable.hpp> | ||
| 16 | #include <Svc/Ccsds/CfdpManager/Types/PduHeader.hpp> | ||
| 17 | |||
| 18 | namespace Svc { | ||
| 19 | namespace Ccsds { | ||
| 20 | namespace Cfdp { | ||
| 21 | |||
| 22 | //! Base class for all CFDP PDUs | ||
| 23 | //! Inherits from Fw::Serializable for F-Prime ecosystem integration | ||
| 24 | class PduBase : public Fw::Serializable { | ||
| 25 | protected: | ||
| 26 | //! The PDU header (common to all PDUs) | ||
| 27 | PduHeader m_header; | ||
| 28 | |||
| 29 | public: | ||
| 30 | //! Constructor | ||
| 31 | 534 | PduBase() {} | |
| 32 | |||
| 33 | //! Virtual destructor for proper cleanup | ||
| 34 | 1068 | virtual ~PduBase() = default; | |
| 35 | |||
| 36 | //! Fw::Serializable interface - serialize to buffer | ||
| 37 | //! @param buffer The buffer to serialize to | ||
| 38 | //! @param mode The endianness mode (default: BIG) | ||
| 39 | //! @return Serialization status | ||
| 40 | Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer, | ||
| 41 | Fw::Endianness mode = Fw::Endianness::BIG) const override = 0; | ||
| 42 | |||
| 43 | //! Fw::Serializable interface - deserialize from buffer | ||
| 44 | //! @param buffer The buffer to deserialize from | ||
| 45 | //! @param mode The endianness mode (default: BIG) | ||
| 46 | //! @return Deserialization status | ||
| 47 | Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer, | ||
| 48 | Fw::Endianness mode = Fw::Endianness::BIG) override = 0; | ||
| 49 | |||
| 50 | //! Get the buffer size needed to hold this PDU | ||
| 51 | //! @return Buffer size in bytes | ||
| 52 | virtual U32 getBufferSize() const = 0; | ||
| 53 | |||
| 54 | //! Get the PDU type | ||
| 55 | //! @return PDU type | ||
| 56 | 1 | PduTypeEnum::T getType() const { return this->m_header.getType(); } | |
| 57 | |||
| 58 | //! Get the direction | ||
| 59 | //! @return PduDirection (toward receiver or sender) | ||
| 60 | PduDirection getDirection() const { return this->m_header.getDirection(); } | ||
| 61 | |||
| 62 | //! Get the transmission mode | ||
| 63 | //! @return Transmission mode (Class 1 or Class 2) | ||
| 64 | Cfdp::Class::T getTxmMode() const { return this->m_header.getTxmMode(); } | ||
| 65 | |||
| 66 | //! Get the source entity ID | ||
| 67 | //! @return Source entity ID | ||
| 68 | EntityId getSourceEid() const { return this->m_header.getSourceEid(); } | ||
| 69 | |||
| 70 | //! Get the transaction sequence number | ||
| 71 | //! @return Transaction sequence number | ||
| 72 | TransactionSeq getTransactionSeq() const { return this->m_header.getTransactionSeq(); } | ||
| 73 | |||
| 74 | //! Get the destination entity ID | ||
| 75 | //! @return Destination entity ID | ||
| 76 | EntityId getDestEid() const { return this->m_header.getDestEid(); } | ||
| 77 | |||
| 78 | //! Get the header | ||
| 79 | //! @return Reference to the PDU header | ||
| 80 | const PduHeader& getHeader() const { return this->m_header; } | ||
| 81 | }; | ||
| 82 | |||
| 83 | } // namespace Cfdp | ||
| 84 | } // namespace Ccsds | ||
| 85 | } // namespace Svc | ||
| 86 | |||
| 87 | // Include all concrete PDU types for convenience (umbrella header pattern) | ||
| 88 | #include <Svc/Ccsds/CfdpManager/Types/AckPdu.hpp> | ||
| 89 | #include <Svc/Ccsds/CfdpManager/Types/EofPdu.hpp> | ||
| 90 | #include <Svc/Ccsds/CfdpManager/Types/FileDataPdu.hpp> | ||
| 91 | #include <Svc/Ccsds/CfdpManager/Types/FinPdu.hpp> | ||
| 92 | #include <Svc/Ccsds/CfdpManager/Types/MetadataPdu.hpp> | ||
| 93 | #include <Svc/Ccsds/CfdpManager/Types/NakPdu.hpp> | ||
| 94 | |||
| 95 | #endif // Svc_Ccsds_Cfdp_PduBase_HPP | ||
| 96 |