CCSDSPack
C++ Library for CCSDS Space Packet manipulation. i.e. generation, extraction, analisys and more
|
Represents the data field of a CCSDS packet. More...
#include <CCSDSDataField.h>
Public Member Functions | |
DataField () | |
~DataField ()=default | |
ResultBool | setApplicationData (const std::vector< uint8_t > &applicationData) |
Sets the application data using a vector of bytes. | |
ResultBool | setApplicationData (const uint8_t *pData, const size_t &sizeData) |
Sets the application data for the data field. | |
ResultBool | setDataFieldHeader (const uint8_t *pData, const size_t &sizeData) |
Sets the secondary header data for the data field. | |
ResultBool | setDataFieldHeader (const uint8_t *pData, const size_t &sizeData, const std::string &pType) |
Sets the secondary header for the data field using a PUS Type. | |
ResultBool | setDataFieldHeader (const std::vector< uint8_t > &data, const std::string &pType) |
Sets the data field header for the CCSDS DataField with a specific PUS type. | |
ResultBool | setDataFieldHeader (const std::vector< uint8_t > &dataFieldHeader) |
Sets the data field header for the CCSDS DataField. | |
void | setDataFieldHeader (std::shared_ptr< SecondaryHeaderAbstract > header) |
Sets the secondary header for the data field using a PUS-A header. | |
SecondaryHeaderFactory & | getDataFieldHeaderFactory () |
returns the secondary header factory | |
SecondaryHeaderAbstract & | getDataFieldHeader () |
returns the secondary header A SecondaryHeaderAbstract derived object containing the header data. | |
void | setDataPacketSize (const uint16_t &value) |
Sets the maximum data packet size for the CCSDS DataField. | |
void | setDataFieldHeaderAutoUpdateStatus (const bool enable) |
Sets The auto update variable, if disabled the data size in the header field will not be updated. | |
uint16_t | getDataFieldAbsoluteBytesSize () |
Retrieves the absolute size of the data field in bytes. | |
uint16_t | getDataFieldUsedBytesSize () |
Retrieves the used size of the data field in bytes. | |
uint16_t | getDataFieldAvailableBytesSize () |
Retrieves the available size of the data field in bytes. | |
std::vector< uint8_t > | getDataFieldHeaderBytes () |
Retrieves the secondary header data as a vector of bytes. | |
std::vector< uint8_t > | getFullDataFieldBytes () |
Retrieves the full data field by combining the data field header and application data. | |
std::vector< uint8_t > | getApplicationData () |
Retrieves the application data from the data field. | |
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 | |
std::shared_ptr< SecondaryHeaderAbstract > | getSecondaryHeader () |
retrieves the known PUS type | |
void | update () |
Updates the data field header based on the current application data size. | |
Private Attributes | |
std::shared_ptr< SecondaryHeaderAbstract > | m_secondaryHeader {} |
Shared pointer to the secondary header class. | |
SecondaryHeaderFactory | m_secondaryHeaderFactory |
secondary header dispatcher factory | |
std::vector< uint8_t > | m_applicationData {} |
Application data buffer. | |
std::string | m_dataFieldHeaderType {} |
Data field Header type. | |
uint16_t | m_dataPacketSize {2024} |
Data field maximum size in bytes. | |
bool | m_dataFieldHeaderUpdated {false} |
Boolean for secondary header updated status. | |
bool | m_enableDataFieldUpdate {true} |
Boolean for secondary header update enable. | |
Represents the data field of a CCSDS packet.
This class encapsulates the structure and operations for handling the data field of a CCSDS (Consultative Committee for Space Data Systems) packet. It allows for setting and retrieving application data, data field headers, and calculating the full data field. Additionally, it provides methods for managing the data field's size and printing its content.
The data field consists of headers and application data, and the class supports different header types (PusA, PusB, PusC). It also allows setting and getting the data packet size, as well as managing the data field header flag.
Definition at line 26 of file CCSDSDataField.h.
|
inline |
Definition at line 28 of file CCSDSDataField.h.
|
default |
std::vector< uint8_t > CCSDS::DataField::getApplicationData | ( | ) |
Retrieves the application data from the data field.
This method returns a vector containing the raw application data stored in the data field.
Definition at line 18 of file CCSDSDataField.cpp.
uint16_t CCSDS::DataField::getDataFieldAbsoluteBytesSize | ( | ) |
Retrieves the absolute size of the data field in bytes.
This method returns the total allocated size for the data field, including both the header and application data.
Definition at line 28 of file CCSDSDataField.cpp.
uint16_t CCSDS::DataField::getDataFieldAvailableBytesSize | ( | ) |
Retrieves the available size of the data field in bytes.
This method calculates and returns the remaining free space within the data field that can be utilized.
Definition at line 23 of file CCSDSDataField.cpp.
|
inline |
returns the secondary header A SecondaryHeaderAbstract derived object containing the header data.
Definition at line 149 of file CCSDSDataField.h.
|
inline |
returns true if auto update has been enabled for the secondary header
Definition at line 226 of file CCSDSDataField.h.
std::vector< uint8_t > CCSDS::DataField::getDataFieldHeaderBytes | ( | ) |
Retrieves the secondary header data as a vector of bytes.
If the header type is not OTHER or NA, retrieves the data from the corresponding PUS header object.
Definition at line 153 of file CCSDSDataField.cpp.
|
inline |
returns the secondary header factory
Definition at line 141 of file CCSDSDataField.h.
|
inline |
retrieves true if a known secondary header has been set
Definition at line 233 of file CCSDSDataField.h.
uint16_t CCSDS::DataField::getDataFieldUsedBytesSize | ( | ) |
Retrieves the used size of the data field in bytes.
This method returns the amount of space currently occupied by valid data within the data field.
Definition at line 33 of file CCSDSDataField.cpp.
std::vector< uint8_t > CCSDS::DataField::getFullDataFieldBytes | ( | ) |
Retrieves the full data field by combining the data field header and application data.
Combines the secondary header (if present) and application data into a single vector. Ensures that the total size does not exceed the maximum allowed data packet size.
Definition at line 7 of file CCSDSDataField.cpp.
std::shared_ptr< CCSDS::SecondaryHeaderAbstract > CCSDS::DataField::getSecondaryHeader | ( | ) |
retrieves the known PUS type
Definition at line 44 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setApplicationData | ( | const std::vector< uint8_t > & | applicationData | ) |
Sets the application data using a vector of bytes.
Replaces the current application data with the given vector and updates the header.
applicationData | A vector containing the application data bytes. |
Definition at line 71 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setApplicationData | ( | const uint8_t * | pData, |
const size_t & | sizeData | ||
) |
Sets the application data for the data field.
Validates and assigns the given application data to the data field. Ensures the data size is within acceptable limits and does not exceed
pData | A pointer to the application data. |
sizeData | The size of the application data in bytes. |
Definition at line 57 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::vector< uint8_t > & | data, |
const std::string & | pType | ||
) |
Sets the data field header for the CCSDS DataField with a specific PUS type.
This method configures the data field header based on the provided data and the specified Packet Utilization Standard (PUS) type. It validates the header size to ensure it does not exceed the maximum allowed packet size and creates the appropriate header object based on the PUS type.
data | A vector containing the data for the data field header. |
pType | The PUS type (PUS_A, PUS_B, PUS_C, or OTHER) indicating the header format. |
Definition at line 110 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::vector< uint8_t > & | dataFieldHeader | ) |
Sets the data field header for the CCSDS DataField.
This method updates the data field header with the provided vector of bytes. If the existing data field header is not empty, it clears the current contents and logs a warning to indicate that the header has been overwritten.
dataFieldHeader | A vector containing the new data field header. |
Definition at line 132 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const uint8_t * | pData, |
const size_t & | sizeData | ||
) |
Sets the secondary header data for the data field.
Validates and assigns the given secondary header data to the data field. Ensures the data size is within acceptable limits and does not exceed the remaining packet size after accounting for the header.
pData | A pointer to the application data. |
sizeData | The size of the application data in bytes. |
Definition at line 79 of file CCSDSDataField.cpp.
CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const uint8_t * | pData, |
const size_t & | sizeData, | ||
const std::string & | pType | ||
) |
Sets the secondary header for the data field using a PUS Type.
Validates and assigns the given header data to the secondary header field. Ensures the header size is within acceptable limits and does not exceed the remaining packet size after accounting for the application data.
pData | A pointer to the header data. |
sizeData | The size of the header data in bytes. |
pType | enum of type PUSType to select |
Definition at line 91 of file CCSDSDataField.cpp.
void CCSDS::DataField::setDataFieldHeader | ( | std::shared_ptr< SecondaryHeaderAbstract > | header | ) |
Sets the secondary header for the data field using a PUS-A header.
header | A SecondaryHeaderAbstract derived object containing the header data. |
Definition at line 145 of file CCSDSDataField.cpp.
|
inline |
Sets The auto update variable, if disabled the data size in the header field will not be updated.
enable |
Definition at line 166 of file CCSDSDataField.h.
void CCSDS::DataField::setDataPacketSize | ( | const uint16_t & | value | ) |
Sets the maximum data packet size for the CCSDS DataField.
This method updates the maximum allowed size for the data packet. The data packet size is used to validate that the combined size of the header and application data does not exceed this limit.
value | The maximum size of the data packet, in bytes. |
Definition at line 151 of file CCSDSDataField.cpp.
void CCSDS::DataField::update | ( | ) |
Updates the data field header based on the current application data size.
Updates the length field in the secondary header to match the size of the application data. Ensures the header reflects the most recent data state.
Definition at line 48 of file CCSDSDataField.cpp.
|
private |
|
private |
|
private |
Boolean for secondary header updated status.
Definition at line 260 of file CCSDSDataField.h.
|
private |
|
private |
Boolean for secondary header update enable.
Definition at line 261 of file CCSDSDataField.h.
|
private |
Shared pointer to the secondary header class.
Definition at line 255 of file CCSDSDataField.h.
|
private |
secondary header dispatcher factory
Definition at line 256 of file CCSDSDataField.h.