| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title FinPdu.hpp | ||
| 3 | // \author Brian Campuzano | ||
| 4 | // \brief hpp file for CFDP Finished PDU | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #ifndef Svc_Ccsds_Cfdp_FinPdu_HPP | ||
| 8 | #define Svc_Ccsds_Cfdp_FinPdu_HPP | ||
| 9 | |||
| 10 | #include <Svc/Ccsds/CfdpManager/Types/PduBase.hpp> | ||
| 11 | #include <Svc/Ccsds/CfdpManager/Types/Tlv.hpp> | ||
| 12 | #include <Svc/Ccsds/CfdpManager/Types/Types.hpp> | ||
| 13 | |||
| 14 | namespace Svc { | ||
| 15 | namespace Ccsds { | ||
| 16 | namespace Cfdp { | ||
| 17 | |||
| 18 | //! The type of a Finished PDU | ||
| 19 | class FinPdu : public PduBase { | ||
| 20 | private: | ||
| 21 | //! Condition code | ||
| 22 | ConditionCode m_conditionCode; | ||
| 23 | |||
| 24 | //! Delivery code | ||
| 25 | FinDeliveryCode m_deliveryCode; | ||
| 26 | |||
| 27 | //! File status | ||
| 28 | FinFileStatus m_fileStatus; | ||
| 29 | |||
| 30 | //! TLV list (optional) | ||
| 31 | TlvList m_tlvList; | ||
| 32 | |||
| 33 | public: | ||
| 34 | //! Constructor | ||
| 35 | 39 | FinPdu() | |
| 36 | 78 | : m_conditionCode(ConditionCode::CONDITION_CODE_NO_ERROR), | |
| 37 | 39 | m_deliveryCode(FinDeliveryCode::FIN_DELIVERY_CODE_COMPLETE), | |
| 38 |
1/1✓ Branch 14 taken 39 times.
|
78 | m_fileStatus(FinFileStatus::FIN_FILE_STATUS_RETAINED) {} |
| 39 | |||
| 40 | //! Initialize a Finished PDU | ||
| 41 | void initialize(PduDirection direction, | ||
| 42 | Cfdp::Class::T txmMode, | ||
| 43 | EntityId sourceEid, | ||
| 44 | TransactionSeq transactionSeq, | ||
| 45 | EntityId destEid, | ||
| 46 | ConditionCode conditionCode, | ||
| 47 | FinDeliveryCode deliveryCode, | ||
| 48 | FinFileStatus fileStatus); | ||
| 49 | |||
| 50 | //! Compute the buffer size needed | ||
| 51 | U32 getBufferSize() const override; | ||
| 52 | |||
| 53 | //! Fw::Serializable interface - serialize to buffer | ||
| 54 | Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer, | ||
| 55 | Fw::Endianness mode = Fw::Endianness::BIG) const override; | ||
| 56 | |||
| 57 | //! Fw::Serializable interface - deserialize from buffer | ||
| 58 | Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer, | ||
| 59 | Fw::Endianness mode = Fw::Endianness::BIG) override; | ||
| 60 | |||
| 61 | //! Get this as a Header | ||
| 62 | 7 | const PduHeader& asHeader() const { return this->m_header; } | |
| 63 | |||
| 64 | //! Get condition code | ||
| 65 | 5 | ConditionCode getConditionCode() const { return this->m_conditionCode; } | |
| 66 | |||
| 67 | //! Get delivery code | ||
| 68 | 15 | FinDeliveryCode getDeliveryCode() const { return this->m_deliveryCode; } | |
| 69 | |||
| 70 | //! Get file status | ||
| 71 | 15 | FinFileStatus getFileStatus() const { return this->m_fileStatus; } | |
| 72 | |||
| 73 | //! Get directive code | ||
| 74 | FileDirective getDirectiveCode() const { return FileDirective::FILE_DIRECTIVE_FIN; } | ||
| 75 | |||
| 76 | //! Add a TLV to this FIN PDU | ||
| 77 | //! @return true if added successfully, false if list is full | ||
| 78 | 12 | bool appendTlv(const Tlv& tlv) { return this->m_tlvList.appendTlv(tlv); } | |
| 79 | |||
| 80 | //! Get TLV list | ||
| 81 | 11 | const TlvList& getTlvList() const { return this->m_tlvList; } | |
| 82 | |||
| 83 | //! Get number of TLVs | ||
| 84 | 9 | U8 getNumTlv() const { return this->m_tlvList.getNumTlv(); } | |
| 85 | |||
| 86 | private: | ||
| 87 | //! Initialize this FinPdu from a SerialBuffer | ||
| 88 | Fw::SerializeStatus fromSerialBuffer(Fw::SerialBufferBase& serialBuffer); | ||
| 89 | |||
| 90 | //! Write this FinPdu to a SerialBuffer | ||
| 91 | Fw::SerializeStatus toSerialBuffer(Fw::SerialBufferBase& serialBuffer) const; | ||
| 92 | }; | ||
| 93 | |||
| 94 | } // namespace Cfdp | ||
| 95 | } // namespace Ccsds | ||
| 96 | } // namespace Svc | ||
| 97 | |||
| 98 | #endif // Svc_Ccsds_Cfdp_FinPdu_HPP | ||
| 99 |