|
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 | |
| template<typename T > | |
| ResultBool | RegisterSecondaryHeader () |
| Registers a new header type with its creation function. | |
| ResultBool | setApplicationData (const std::vector< std::uint8_t > &applicationData) |
| Sets the application data using a vector of bytes. | |
| ResultBool | setApplicationData (const std::uint8_t *pData, const size_t &sizeData) |
| Sets the application data for the data field. | |
| ResultBool | setDataFieldHeader (const std::uint8_t *pData, const size_t &sizeData) |
| Sets the secondary header data for the data field. | |
| ResultBool | setDataFieldHeader (const std::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< std::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< std::uint8_t > &dataFieldHeader) |
| Sets the data field header for the CCSDS DataField. | |
| ResultBool | setDataFieldHeader (const Config &cfg) |
| Sets the data field header using a configuration file as reference. | |
| 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 std::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. | |
| std::uint16_t | getDataFieldAbsoluteBytesSize () const |
| Retrieves the absolute size of the data field in bytes. | |
| std::uint16_t | getApplicationDataBytesSize () const |
| Retrieves the size of the application data stored in the data field. | |
| std::uint16_t | getDataFieldUsedBytesSize () const |
| Retrieves the used size of the data field in bytes. | |
| std::uint16_t | getDataFieldAvailableBytesSize () const |
| Retrieves the available size of the data field in bytes. | |
| std::vector< std::uint8_t > | getDataFieldHeaderBytes () |
| Retrieves the secondary header data as a vector of bytes. | |
| std::vector< std::uint8_t > | serialize () |
| Retrieves the full data field by combining the data field header and application data. | |
| std::vector< std::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< std::uint8_t > | m_applicationData {} |
| Application data buffer. | |
| std::string | m_dataFieldHeaderType {} |
| Data field Header type. | |
| std::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 25 of file CCSDSDataField.h.
|
inline |
Definition at line 27 of file CCSDSDataField.h.
|
default |
| std::vector< std::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 17 of file CCSDSDataField.cpp.
| uint16_t CCSDS::DataField::getApplicationDataBytesSize | ( | ) | const |
Retrieves the size of the application data stored in the data field.
Definition at line 29 of file CCSDSDataField.cpp.
| uint16_t CCSDS::DataField::getDataFieldAbsoluteBytesSize | ( | ) | const |
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 25 of file CCSDSDataField.cpp.
| uint16_t CCSDS::DataField::getDataFieldAvailableBytesSize | ( | ) | const |
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 21 of file CCSDSDataField.cpp.
|
inline |
returns the secondary header A SecondaryHeaderAbstract derived object containing the header data.
Definition at line 182 of file CCSDSDataField.h.
|
inline |
returns true if auto update has been enabled for the secondary header
Definition at line 266 of file CCSDSDataField.h.
| std::vector< std::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 173 of file CCSDSDataField.cpp.
|
inline |
returns the secondary header factory
Definition at line 174 of file CCSDSDataField.h.
|
inline |
retrieves true if a known secondary header has been set
Definition at line 273 of file CCSDSDataField.h.
| uint16_t CCSDS::DataField::getDataFieldUsedBytesSize | ( | ) | const |
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 34 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.
|
inline |
Registers a new header type with its creation function.
This function adds a new header type to the factory by associating the header's type string with a shared pointer to the header.
| header | A shared pointer to a SecondaryHeaderAbstract object to register. |
Definition at line 49 of file CCSDSDataField.h.
| std::vector< std::uint8_t > CCSDS::DataField::serialize | ( | ) |
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 6 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setApplicationData | ( | const std::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 58 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setApplicationData | ( | const std::vector< std::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 72 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const Config & | cfg | ) |
Sets the data field header using a configuration file as reference.
| cfg | configuration file parser object. |
Definition at line 148 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::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 80 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::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 92 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::vector< std::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 111 of file CCSDSDataField.cpp.
| CCSDS::ResultBool CCSDS::DataField::setDataFieldHeader | ( | const std::vector< std::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 134 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 165 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 199 of file CCSDSDataField.h.
| void CCSDS::DataField::setDataPacketSize | ( | const std::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 171 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 49 of file CCSDSDataField.cpp.
|
private |
|
private |
|
private |
Boolean for secondary header updated status.
Definition at line 300 of file CCSDSDataField.h.
|
private |
|
private |
Boolean for secondary header update enable.
Definition at line 301 of file CCSDSDataField.h.
|
private |
Shared pointer to the secondary header class.
Definition at line 295 of file CCSDSDataField.h.
|
private |
secondary header dispatcher factory
Definition at line 296 of file CCSDSDataField.h.