F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDataPdu.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDataPdu.hpp
3 // \author Brian Campuzano
4 // \brief hpp file for CFDP File Data PDU
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_Cfdp_FileDataPdu_HPP
8 #define Svc_Ccsds_Cfdp_FileDataPdu_HPP
9 
13 
14 namespace Svc {
15 namespace Ccsds {
16 namespace Cfdp {
17 
19 class FileDataPdu : public PduBase {
20  private:
22  FileSize m_offset;
23 
25  U16 m_dataSize;
26 
28  const U8* m_data;
29 
30  public:
32  FileDataPdu() : m_offset(0), m_dataSize(0), m_data(nullptr) {}
33 
35  void initialize(PduDirection direction,
36  Cfdp::Class::T txmMode,
37  EntityId sourceEid,
38  TransactionSeq transactionSeq,
39  EntityId destEid,
40  FileSize offset,
41  U16 dataSize,
42  const U8* data);
43 
45  U32 getBufferSize() const override;
46 
49 
52 
55  Fw::Endianness mode = Fw::Endianness::BIG) const override;
56 
59  Fw::Endianness mode = Fw::Endianness::BIG) override;
60 
62  const PduHeader& asHeader() const { return this->m_header; }
63 
65  FileSize getOffset() const { return this->m_offset; }
66 
68  U16 getDataSize() const { return this->m_dataSize; }
69 
71  const U8* getData() const { return this->m_data; }
72 
75  U32 getMaxFileDataSize();
76 
77  private:
79  Fw::SerializeStatus fromSerialBuffer(Fw::SerialBuffer& serialBuffer);
80 
82  Fw::SerializeStatus toSerialBuffer(Fw::SerialBuffer& serialBuffer) const;
83 };
84 
85 } // namespace Cfdp
86 } // namespace Ccsds
87 } // namespace Svc
88 
89 #endif // Svc_Ccsds_Cfdp_FileDataPdu_HPP
Fw::SerializeStatus toBuffer(Fw::Buffer &buffer) const
Convert this FileDataPdu to a Buffer.
Definition: FileDataPdu.cpp:58
U32 getBufferSize() const override
Compute the buffer size needed.
Definition: FileDataPdu.cpp:31
A variable-length serializable buffer.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) override
Fw::Serializable interface - deserialize from buffer.
U32 EntityId
Entity id size.
SerializeStatus
forward declaration for string
U32 TransactionSeq
transaction sequence number size
The type of a File Data PDU.
Definition: FileDataPdu.hpp:19
FileSize getOffset() const
Get the file offset.
Definition: FileDataPdu.hpp:65
Fw::SerializeStatus fromBuffer(const Fw::Buffer &buffer)
Initialize this FileDataPdu from a Buffer.
Definition: FileDataPdu.cpp:67
U16 getDataSize() const
Get the data size.
Definition: FileDataPdu.hpp:68
PduHeader m_header
The PDU header (common to all PDUs)
Definition: PduBase.hpp:27
U32 FileSize
File size and offset type.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const override
Fw::Serializable interface - serialize to buffer.
const U8 * getData() const
Get the data pointer.
Definition: FileDataPdu.hpp:71
The type of a PDU header (common to all PDUs)
Definition: PduHeader.hpp:47
RateGroupDivider component implementation.
Endianness
T
The raw enum type.
Definition: ClassEnumAc.hpp:42
void initialize(PduDirection direction, Cfdp::Class::T txmMode, EntityId sourceEid, TransactionSeq transactionSeq, EntityId destEid, FileSize offset, U16 dataSize, const U8 *data)
Initialize a File Data PDU.
Definition: FileDataPdu.cpp:15
const PduHeader & asHeader() const
Get this as a Header.
Definition: FileDataPdu.hpp:62
Big endian serialization.