| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title MetadataPdu.hpp | ||
| 3 | // \author Brian Campuzano | ||
| 4 | // \brief hpp file for CFDP Metadata PDU | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #ifndef Svc_Ccsds_Cfdp_MetadataPdu_HPP | ||
| 8 | #define Svc_Ccsds_Cfdp_MetadataPdu_HPP | ||
| 9 | |||
| 10 | #include <Fw/Types/String.hpp> | ||
| 11 | #include <Svc/Ccsds/CfdpManager/Types/PduBase.hpp> | ||
| 12 | #include <Svc/Ccsds/CfdpManager/Types/Types.hpp> | ||
| 13 | #include <config/CfdpCfg.hpp> | ||
| 14 | |||
| 15 | namespace Svc { | ||
| 16 | namespace Ccsds { | ||
| 17 | namespace Cfdp { | ||
| 18 | |||
| 19 | //! The type of a Metadata PDU | ||
| 20 | class MetadataPdu : public PduBase { | ||
| 21 | private: | ||
| 22 | //! Closure requested flag | ||
| 23 | U8 m_closureRequested; | ||
| 24 | |||
| 25 | //! Checksum type | ||
| 26 | ChecksumType m_checksumType; | ||
| 27 | |||
| 28 | //! File size | ||
| 29 | FileSize m_fileSize; | ||
| 30 | |||
| 31 | //! Source filename | ||
| 32 | Fw::String m_sourceFilename; | ||
| 33 | |||
| 34 | //! Destination filename | ||
| 35 | Fw::String m_destFilename; | ||
| 36 | |||
| 37 | public: | ||
| 38 | //! Constructor | ||
| 39 | 182 | MetadataPdu() | |
| 40 | 364 | : m_closureRequested(0), | |
| 41 | 182 | m_checksumType(ChecksumType::CHECKSUM_TYPE_MODULAR), | |
| 42 | 182 | m_fileSize(0), | |
| 43 |
1/1✓ Branch 4 taken 182 times.
|
182 | m_sourceFilename(""), |
| 44 |
1/1✓ Branch 10 taken 182 times.
|
364 | m_destFilename("") {} |
| 45 | |||
| 46 | //! Initialize a Metadata PDU | ||
| 47 | void initialize(PduDirection direction, | ||
| 48 | Cfdp::Class::T txmMode, | ||
| 49 | EntityId sourceEid, | ||
| 50 | TransactionSeq transactionSeq, | ||
| 51 | EntityId destEid, | ||
| 52 | FileSize fileSize, | ||
| 53 | const Fw::String& sourceFilename, | ||
| 54 | const Fw::String& destFilename, | ||
| 55 | ChecksumType checksumType, | ||
| 56 | U8 closureRequested); | ||
| 57 | |||
| 58 | //! Compute the buffer size needed | ||
| 59 | U32 getBufferSize() const override; | ||
| 60 | |||
| 61 | //! Fw::Serializable interface - serialize to buffer | ||
| 62 | Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer, | ||
| 63 | Fw::Endianness mode = Fw::Endianness::BIG) const override; | ||
| 64 | |||
| 65 | //! Fw::Serializable interface - deserialize from buffer | ||
| 66 | Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer, | ||
| 67 | Fw::Endianness mode = Fw::Endianness::BIG) override; | ||
| 68 | |||
| 69 | //! Get this as a Header | ||
| 70 | 8 | const PduHeader& asHeader() const { return this->m_header; } | |
| 71 | |||
| 72 | //! Get the file size | ||
| 73 | 86 | FileSize getFileSize() const { return this->m_fileSize; } | |
| 74 | |||
| 75 | //! Get the source filename | ||
| 76 | 86 | const Fw::String& getSourceFilename() const { return this->m_sourceFilename; } | |
| 77 | |||
| 78 | //! Get the destination filename | ||
| 79 | 86 | const Fw::String& getDestFilename() const { return this->m_destFilename; } | |
| 80 | |||
| 81 | //! Get checksum type | ||
| 82 | 8 | ChecksumType getChecksumType() const { return this->m_checksumType; } | |
| 83 | |||
| 84 | //! Get closure requested flag | ||
| 85 | 8 | U8 getClosureRequested() const { return this->m_closureRequested; } | |
| 86 | |||
| 87 | //! Get directive code | ||
| 88 | FileDirective getDirectiveCode() const { return FileDirective::FILE_DIRECTIVE_METADATA; } | ||
| 89 | |||
| 90 | private: | ||
| 91 | //! Initialize this MetadataPdu from a SerialBufferBase | ||
| 92 | Fw::SerializeStatus fromSerialBuffer(Fw::SerialBufferBase& serialBuffer); | ||
| 93 | |||
| 94 | //! Write this MetadataPdu to a SerialBufferBase | ||
| 95 | Fw::SerializeStatus toSerialBuffer(Fw::SerialBufferBase& serialBuffer) const; | ||
| 96 | }; | ||
| 97 | |||
| 98 | } // namespace Cfdp | ||
| 99 | } // namespace Ccsds | ||
| 100 | } // namespace Svc | ||
| 101 | |||
| 102 | #endif // Svc_Ccsds_Cfdp_MetadataPdu_HPP | ||
| 103 |