1#ifndef CCSDS_DATA_FIELD_H
2#define CCSDS_DATA_FIELD_H
34 printf(
"[CCSDS DataField] Unable to Create Data field, secondary header registration failed.");
114 const std::string &pType);
#define ASSIGN_OR_PRINT(var, result)
Macro to assign a result value or print an error message.
#define FORWARD_RESULT(result)
Macro to return a result as-is (for functions returning Result<T>).
Represents the data field of a CCSDS packet.
std::shared_ptr< SecondaryHeaderAbstract > m_secondaryHeader
Shared pointer to the secondary header class.
ResultBool RegisterSecondaryHeader()
Registers a new header type with its creation function.
std::vector< std::uint8_t > serialize()
Retrieves the full data field by combining the data field header and application data.
SecondaryHeaderAbstract & getDataFieldHeader()
returns the secondary header A SecondaryHeaderAbstract derived object containing the header data.
std::shared_ptr< SecondaryHeaderAbstract > getSecondaryHeader()
retrieves the known PUS type
bool m_dataFieldHeaderUpdated
Boolean for secondary header updated status.
std::uint16_t getDataFieldUsedBytesSize() const
Retrieves the used size of the data field in bytes.
bool getDataFieldHeaderAutoUpdateStatus() const
returns true if auto update has been enabled for the secondary header
bool getDataFieldHeaderFlag() const
retrieves true if a known secondary header has been set
SecondaryHeaderFactory m_secondaryHeaderFactory
secondary header dispatcher factory
void setDataPacketSize(const std::uint16_t &value)
Sets the maximum data packet size for the CCSDS DataField.
std::string m_dataFieldHeaderType
Data field Header type.
ResultBool setDataFieldHeader(const std::uint8_t *pData, const size_t &sizeData)
Sets the secondary header data for the data field.
std::uint16_t getDataFieldAbsoluteBytesSize() const
Retrieves the absolute size of the data field in bytes.
void update()
Updates the data field header based on the current application data size.
std::vector< std::uint8_t > getDataFieldHeaderBytes()
Retrieves the secondary header data as a vector of bytes.
void setDataFieldHeaderAutoUpdateStatus(const bool enable)
Sets The auto update variable, if disabled the data size in the header field will not be updated.
std::uint16_t m_dataPacketSize
Data field maximum size in bytes.
SecondaryHeaderFactory & getDataFieldHeaderFactory()
returns the secondary header factory
bool m_enableDataFieldUpdate
Boolean for secondary header update enable.
std::uint16_t getApplicationDataBytesSize() const
Retrieves the size of the application data stored in the data field.
std::vector< std::uint8_t > getApplicationData()
Retrieves the application data from the data field.
std::vector< std::uint8_t > m_applicationData
Application data buffer.
ResultBool setApplicationData(const std::vector< std::uint8_t > &applicationData)
Sets the application data using a vector of bytes.
std::uint16_t getDataFieldAvailableBytesSize() const
Retrieves the available size of the data field in bytes.
Encapsulates a result that can hold either a value or an Error.
Parses and stores config values from custom file format.
Contains definitions and classes for handling CCSDS headers.