CCSDSPack
C++ Library for CCSDS Space Packet manipulation. i.e. generation, extraction, analisys and more
|
Manages CCSDS packets and their templates. More...
#include <CCSDSManager.h>
Public Member Functions | |
Manager ()=default | |
Default constructor. | |
Manager (Packet packet) | |
Constructs a Manager with a given packet template. | |
void | setSyncPattern (uint32_t syncPattern) |
set sync pattern that should indicate the start of a CCSDS packet. | |
uint32_t | getSyncPattern () const |
returns the currently set sync pattern. | |
void | setSyncPatternEnable (bool enable) |
enable sync pattern utilization both in serialization, deserialization, read and write. | |
bool | getSyncPatternEnable () const |
returns the current settings of the sync pattern enable | |
ResultBool | setPacketTemplate (Packet packet) |
Sets a new packet template. | |
void | setDatFieldSize (uint16_t size) |
Sets the size of the data field. | |
ResultBool | setApplicationData (const std::vector< uint8_t > &data) |
Sets the application data for the packet. | |
void | setAutoUpdateEnable (bool enable) |
Enables or disables automatic updates for packets. | |
void | setAutoValidateEnable (bool enable) |
Enables or disables automatic validation of packets. | |
ResultBuffer | getPacketTemplate () |
Retrieves the packet template in serialized form. | |
ResultBuffer | getPacketBufferAtIndex (uint16_t index) |
Retrieves a packet at the specified index. | |
std::vector< uint8_t > | getPacketsBuffer () const |
Retrieves a buffer containing all the stored packets sequentially. | |
ResultBuffer | getApplicationDataBuffer () |
Retrieves the application data from the packets. | |
ResultBuffer | getApplicationDataBufferAtIndex (uint16_t index) |
Retrieves the application data from a packet at the given index. | |
uint16_t | getTotalPackets () const |
Retrieves the total number of packets managed. | |
bool | getAutoUpdateEnable () const |
Checks if automatic updates are enabled. | |
Packet | getTemplate () |
Retrieves the packet template. | |
std::vector< Packet > | getPackets () |
Retrieves all stored packets. | |
ResultBool | addPacket (Packet packet) |
Adds a new packet to the list. | |
ResultBool | addPacketFromBuffer (const std::vector< uint8_t > &packetBuffer) |
Adds a new packet to the list. | |
ResultBool | load (const std::vector< Packet > &packets) |
Load a vector of packets. | |
ResultBool | load (const std::vector< uint8_t > &packetsBuffer) |
Load a packet or a series of packets from a buffer. | |
ResultBool | read (const std::string &binaryFile) |
Load a packet or a series of packets from a binary file. | |
ResultBool | write (const std::string &binaryFile) const |
Write a packet or a series of packets to a binary file. | |
ResultBool | readTemplate (const std::string &filename) |
Load a template packet from a binary or configuration file. | |
void | clear () |
Clears the manager, removes all packets and template. | |
void | clearPackets () |
Clears the packets and sets the counter to 0. | |
Validator & | getValidatorReference () |
Returns a reverence to the manager's Validator. | |
std::vector< Packet > & | getPacketsReference () |
Returns a reference to the packets vector. | |
Private Attributes | |
Packet | m_templatePacket {} |
The template packet used for generating new packets. | |
bool | m_templateIsSet { false } |
Boolean to indicate if Template has been set or not. | |
bool | m_updateEnable { true } |
bool indicating whether automatic updates are enabled (default: true). | |
bool | m_validateEnable { true } |
bool indicating whether automatic validation is enabled (default: true). | |
bool | m_syncPattEnable { false } |
bool indicating whether automatic sync pattern insertion is enabled (default: false). | |
std::vector< Packet > | m_packets |
Collection of stored packets. | |
uint16_t | m_sequenceCount { 0 } |
Validator | m_validator {} |
uint32_t | m_syncPattern {0x1ACFFC1D} |
Manages CCSDS packets and their templates.
This class provides an interface for managing CCSDS packets, allowing users to set a packet template, configure data field sizes, and retrieve application data and packet instances.
Definition at line 18 of file CCSDSManager.h.
|
default |
Default constructor.
|
inlineexplicit |
Constructs a Manager with a given packet template.
packet | The packet template to be used as a reference. |
Definition at line 30 of file CCSDSManager.h.
CCSDS::ResultBool CCSDS::Manager::addPacket | ( | Packet | packet | ) |
Adds a new packet to the list.
packet | The new packet to be added. |
Definition at line 149 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::addPacketFromBuffer | ( | const std::vector< uint8_t > & | packetBuffer | ) |
Adds a new packet to the list.
packetBuffer | The new packet to be added in the form of a buffer. |
Definition at line 162 of file CCSDSManager.cpp.
void CCSDS::Manager::clear | ( | ) |
Clears the manager, removes all packets and template.
Definition at line 239 of file CCSDSManager.cpp.
void CCSDS::Manager::clearPackets | ( | ) |
Clears the packets and sets the counter to 0.
Definition at line 245 of file CCSDSManager.cpp.
CCSDS::ResultBuffer CCSDS::Manager::getApplicationDataBuffer | ( | ) |
Retrieves the application data from the packets.
Definition at line 119 of file CCSDSManager.cpp.
CCSDS::ResultBuffer CCSDS::Manager::getApplicationDataBufferAtIndex | ( | uint16_t | index | ) |
Retrieves the application data from a packet at the given index.
index | The index of the packet. |
Definition at line 135 of file CCSDSManager.cpp.
|
inline |
Checks if automatic updates are enabled.
Definition at line 152 of file CCSDSManager.h.
CCSDS::ResultBuffer CCSDS::Manager::getPacketBufferAtIndex | ( | uint16_t | index | ) |
Retrieves a packet at the specified index.
index | The index of the packet to retrieve. |
Definition at line 92 of file CCSDSManager.cpp.
std::vector< CCSDS::Packet > CCSDS::Manager::getPackets | ( | ) |
Retrieves all stored packets.
Definition at line 145 of file CCSDSManager.cpp.
std::vector< uint8_t > CCSDS::Manager::getPacketsBuffer | ( | ) | const |
Retrieves a buffer containing all the stored packets sequentially.
Definition at line 104 of file CCSDSManager.cpp.
|
inline |
Returns a reference to the packets vector.
Definition at line 239 of file CCSDSManager.h.
CCSDS::ResultBuffer CCSDS::Manager::getPacketTemplate | ( | ) |
Retrieves the packet template in serialized form.
Definition at line 86 of file CCSDSManager.cpp.
uint32_t CCSDS::Manager::getSyncPattern | ( | ) | const |
returns the currently set sync pattern.
Definition at line 9 of file CCSDSManager.cpp.
bool CCSDS::Manager::getSyncPatternEnable | ( | ) | const |
returns the current settings of the sync pattern enable
Definition at line 13 of file CCSDSManager.cpp.
|
inline |
Retrieves the packet template.
Definition at line 159 of file CCSDSManager.h.
uint16_t CCSDS::Manager::getTotalPackets | ( | ) | const |
Retrieves the total number of packets managed.
Definition at line 141 of file CCSDSManager.cpp.
|
inline |
Returns a reverence to the manager's Validator.
Definition at line 232 of file CCSDSManager.h.
CCSDS::ResultBool CCSDS::Manager::load | ( | const std::vector< Packet > & | packets | ) |
Load a vector of packets.
packets | The packets |
Definition at line 170 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::load | ( | const std::vector< uint8_t > & | packetsBuffer | ) |
Load a packet or a series of packets from a buffer.
packetsBuffer | The buffer holding packet data. |
Definition at line 178 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::read | ( | const std::string & | binaryFile | ) |
Load a packet or a series of packets from a binary file.
binaryFile | path to the file holding packet data. |
Definition at line 206 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::readTemplate | ( | const std::string & | filename | ) |
Load a template packet from a binary or configuration file.
filename | path to the file holding template. |
Definition at line 219 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::setApplicationData | ( | const std::vector< uint8_t > & | data | ) |
Sets the application data for the packet.
data | The application data as a vector of bytes. |
Definition at line 29 of file CCSDSManager.cpp.
void CCSDS::Manager::setAutoUpdateEnable | ( | bool | enable | ) |
Enables or disables automatic updates for packets.
enable | Set to true to enable automatic updates, false to disable. |
Definition at line 75 of file CCSDSManager.cpp.
void CCSDS::Manager::setAutoValidateEnable | ( | bool | enable | ) |
Enables or disables automatic validation of packets.
enable | Set to true to enable automatic validation, false to disable. |
Definition at line 82 of file CCSDSManager.cpp.
void CCSDS::Manager::setDatFieldSize | ( | uint16_t | size | ) |
Sets the size of the data field.
size | The new data field size in bytes. |
Definition at line 25 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::setPacketTemplate | ( | Packet | packet | ) |
Sets a new packet template.
packet | The new packet template to use. |
Definition at line 15 of file CCSDSManager.cpp.
void CCSDS::Manager::setSyncPattern | ( | uint32_t | syncPattern | ) |
set sync pattern that should indicate the start of a CCSDS packet.
insertion is disabled by default. use setSyncPatternEnable to enable.
syncPattern | uint32_t (default 0x1ACFFC1D) |
Definition at line 7 of file CCSDSManager.cpp.
void CCSDS::Manager::setSyncPatternEnable | ( | bool | enable | ) |
enable sync pattern utilization both in serialization, deserialization, read and write.
enable | bool (default false) |
Definition at line 11 of file CCSDSManager.cpp.
CCSDS::ResultBool CCSDS::Manager::write | ( | const std::string & | binaryFile | ) | const |
Write a packet or a series of packets to a binary file.
binaryFile | destination file path for packets data. |
Definition at line 213 of file CCSDSManager.cpp.
|
private |
Collection of stored packets.
Definition at line 247 of file CCSDSManager.h.
|
private |
Definition at line 248 of file CCSDSManager.h.
|
private |
bool indicating whether automatic sync pattern insertion is enabled (default: false).
Definition at line 246 of file CCSDSManager.h.
|
private |
Definition at line 251 of file CCSDSManager.h.
|
private |
Boolean to indicate if Template has been set or not.
Definition at line 243 of file CCSDSManager.h.
|
private |
The template packet used for generating new packets.
Definition at line 242 of file CCSDSManager.h.
|
private |
bool indicating whether automatic updates are enabled (default: true).
Definition at line 244 of file CCSDSManager.h.
|
private |
bool indicating whether automatic validation is enabled (default: true).
Definition at line 245 of file CCSDSManager.h.
|
private |
Definition at line 250 of file CCSDSManager.h.