| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title AckPdu.hpp | ||
| 3 | // \author Brian Campuzano | ||
| 4 | // \brief hpp file for CFDP ACK PDU | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #ifndef Svc_Ccsds_Cfdp_AckPdu_HPP | ||
| 8 | #define Svc_Ccsds_Cfdp_AckPdu_HPP | ||
| 9 | |||
| 10 | #include <Svc/Ccsds/CfdpManager/Types/PduBase.hpp> | ||
| 11 | #include <Svc/Ccsds/CfdpManager/Types/Types.hpp> | ||
| 12 | |||
| 13 | namespace Svc { | ||
| 14 | namespace Ccsds { | ||
| 15 | namespace Cfdp { | ||
| 16 | |||
| 17 | //! The type of an ACK PDU | ||
| 18 | class AckPdu : public PduBase { | ||
| 19 | private: | ||
| 20 | //! Directive being acknowledged | ||
| 21 | FileDirective m_directiveCode; | ||
| 22 | |||
| 23 | //! Directive subtype code | ||
| 24 | U8 m_directiveSubtypeCode; | ||
| 25 | |||
| 26 | //! Condition code | ||
| 27 | ConditionCode m_conditionCode; | ||
| 28 | |||
| 29 | //! Transaction status | ||
| 30 | AckTxnStatus m_transactionStatus; | ||
| 31 | |||
| 32 | public: | ||
| 33 | //! Constructor | ||
| 34 | 85 | AckPdu() | |
| 35 | 170 | : m_directiveCode(FileDirective::FILE_DIRECTIVE_INVALID_MIN), | |
| 36 | 85 | m_directiveSubtypeCode(0), | |
| 37 | 85 | m_conditionCode(ConditionCode::CONDITION_CODE_NO_ERROR), | |
| 38 | 170 | m_transactionStatus(AckTxnStatus::ACK_TXN_STATUS_UNDEFINED) {} | |
| 39 | |||
| 40 | //! Initialize an ACK PDU | ||
| 41 | void initialize(PduDirection direction, | ||
| 42 | Cfdp::Class::T txmMode, | ||
| 43 | EntityId sourceEid, | ||
| 44 | TransactionSeq transactionSeq, | ||
| 45 | EntityId destEid, | ||
| 46 | FileDirective directiveCode, | ||
| 47 | U8 directiveSubtypeCode, | ||
| 48 | ConditionCode conditionCode, | ||
| 49 | AckTxnStatus transactionStatus); | ||
| 50 | |||
| 51 | //! Compute the buffer size needed | ||
| 52 | U32 getBufferSize() const override; | ||
| 53 | |||
| 54 | //! Fw::Serializable interface - serialize to buffer | ||
| 55 | Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer, | ||
| 56 | Fw::Endianness mode = Fw::Endianness::BIG) const override; | ||
| 57 | |||
| 58 | //! Fw::Serializable interface - deserialize from buffer | ||
| 59 | Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer, | ||
| 60 | Fw::Endianness mode = Fw::Endianness::BIG) override; | ||
| 61 | |||
| 62 | //! Get this as a Header | ||
| 63 | 8 | const PduHeader& asHeader() const { return this->m_header; } | |
| 64 | |||
| 65 | //! Get directive code | ||
| 66 | 31 | FileDirective getDirectiveCode() const { return this->m_directiveCode; } | |
| 67 | |||
| 68 | //! Get directive subtype code | ||
| 69 | 8 | U8 getDirectiveSubtypeCode() const { return this->m_directiveSubtypeCode; } | |
| 70 | |||
| 71 | //! Get condition code | ||
| 72 | 25 | ConditionCode getConditionCode() const { return this->m_conditionCode; } | |
| 73 | |||
| 74 | //! Get transaction status | ||
| 75 | 26 | AckTxnStatus getTransactionStatus() const { return this->m_transactionStatus; } | |
| 76 | |||
| 77 | private: | ||
| 78 | //! Initialize this AckPdu from a SerialBuffer | ||
| 79 | Fw::SerializeStatus fromSerialBuffer(Fw::SerialBufferBase& serialBuffer); | ||
| 80 | |||
| 81 | //! Write this AckPdu to a SerialBuffer | ||
| 82 | Fw::SerializeStatus toSerialBuffer(Fw::SerialBufferBase& serialBuffer) const; | ||
| 83 | }; | ||
| 84 | |||
| 85 | } // namespace Cfdp | ||
| 86 | } // namespace Ccsds | ||
| 87 | } // namespace Svc | ||
| 88 | |||
| 89 | #endif // Svc_Ccsds_Cfdp_AckPdu_HPP | ||
| 90 |