|
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 (std::uint32_t syncPattern) |
| set sync pattern that should indicate the start of a CCSDS packet. | |
| std::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. | |
| ResultBool | loadTemplateConfigFile (const std::string &configPath) |
| Loads a template packet from a configuration file. | |
| ResultBool | loadTemplateConfig (const Config &cfg) |
| Loads a template packet from a configuration object. | |
| void | setDataFieldSize (std::uint16_t size) |
| Sets the size of the data field. | |
| std::uint16_t | getDataFieldSize () const |
| retrieves the set data field size (this includes the secondary header if present) | |
| ResultBool | setApplicationData (const std::vector< std::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 (std::uint16_t index) |
| Retrieves a packet at the specified index. | |
| std::vector< std::uint8_t > | getPacketsBuffer () const |
| Retrieves a buffer containing all the stored packets sequentially. | |
| ResultBuffer | getApplicationDataBuffer () |
| Retrieves the application data from the packets. | |
| ResultBuffer | getApplicationDataBufferAtIndex (std::uint16_t index) |
| Retrieves the application data from a packet at the given index. | |
| std::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< std::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< std::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. | |
| std::uint16_t | m_sequenceCount { 0 } |
| Validator | m_validator {} |
| std::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 172 of file CCSDSManager.cpp.
| CCSDS::ResultBool CCSDS::Manager::addPacketFromBuffer | ( | const std::vector< std::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 185 of file CCSDSManager.cpp.
| void CCSDS::Manager::clear | ( | ) |
Clears the manager, removes all packets and template.
Definition at line 258 of file CCSDSManager.cpp.
| void CCSDS::Manager::clearPackets | ( | ) |
Clears the packets and sets the counter to 0.
Definition at line 264 of file CCSDSManager.cpp.
| CCSDS::ResultBuffer CCSDS::Manager::getApplicationDataBuffer | ( | ) |
Retrieves the application data from the packets.
Definition at line 142 of file CCSDSManager.cpp.
| CCSDS::ResultBuffer CCSDS::Manager::getApplicationDataBufferAtIndex | ( | std::uint16_t | index | ) |
Retrieves the application data from a packet at the given index.
| index | The index of the packet. |
Definition at line 158 of file CCSDSManager.cpp.
|
inline |
Checks if automatic updates are enabled.
Definition at line 175 of file CCSDSManager.h.
| uint16_t CCSDS::Manager::getDataFieldSize | ( | ) | const |
retrieves the set data field size (this includes the secondary header if present)
Definition at line 48 of file CCSDSManager.cpp.
| CCSDS::ResultBuffer CCSDS::Manager::getPacketBufferAtIndex | ( | std::uint16_t | index | ) |
Retrieves a packet at the specified index.
| index | The index of the packet to retrieve. |
Definition at line 115 of file CCSDSManager.cpp.
| std::vector< CCSDS::Packet > CCSDS::Manager::getPackets | ( | ) |
Retrieves all stored packets.
Definition at line 168 of file CCSDSManager.cpp.
| std::vector< std::uint8_t > CCSDS::Manager::getPacketsBuffer | ( | ) | const |
Retrieves a buffer containing all the stored packets sequentially.
Definition at line 127 of file CCSDSManager.cpp.
|
inline |
Returns a reference to the packets vector.
Definition at line 262 of file CCSDSManager.h.
| CCSDS::ResultBuffer CCSDS::Manager::getPacketTemplate | ( | ) |
Retrieves the packet template in serialized form.
Definition at line 109 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 182 of file CCSDSManager.h.
| uint16_t CCSDS::Manager::getTotalPackets | ( | ) | const |
Retrieves the total number of packets managed.
Definition at line 164 of file CCSDSManager.cpp.
|
inline |
Returns a reverence to the manager's Validator.
Definition at line 255 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 193 of file CCSDSManager.cpp.
| CCSDS::ResultBool CCSDS::Manager::load | ( | const std::vector< std::uint8_t > & | packetsBuffer | ) |
Load a packet or a series of packets from a buffer.
| packetsBuffer | The buffer holding packet data. |
Definition at line 201 of file CCSDSManager.cpp.
| CCSDS::ResultBool CCSDS::Manager::loadTemplateConfig | ( | const Config & | cfg | ) |
Loads a template packet from a configuration object.
| cfg | Configuration obj to load template from. |
Definition at line 35 of file CCSDSManager.cpp.
| CCSDS::ResultBool CCSDS::Manager::loadTemplateConfigFile | ( | const std::string & | configPath | ) |
Loads a template packet from a configuration file.
| configPath | path to the configuration file. |
Definition at line 26 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 229 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 242 of file CCSDSManager.cpp.
| CCSDS::ResultBool CCSDS::Manager::setApplicationData | ( | const std::vector< std::uint8_t > & | data | ) |
Sets the application data for the packet.
| data | The application data as a vector of bytes. |
Definition at line 52 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 98 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 105 of file CCSDSManager.cpp.
| void CCSDS::Manager::setDataFieldSize | ( | std::uint16_t | size | ) |
Sets the size of the data field.
| size | The new data field size in bytes. |
Definition at line 44 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 | ( | std::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 | std::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 236 of file CCSDSManager.cpp.
|
private |
Collection of stored packets.
Definition at line 270 of file CCSDSManager.h.
|
private |
Definition at line 271 of file CCSDSManager.h.
|
private |
bool indicating whether automatic sync pattern insertion is enabled (default: false).
Definition at line 269 of file CCSDSManager.h.
|
private |
Definition at line 274 of file CCSDSManager.h.
|
private |
Boolean to indicate if Template has been set or not.
Definition at line 266 of file CCSDSManager.h.
|
private |
The template packet used for generating new packets.
Definition at line 265 of file CCSDSManager.h.
|
private |
bool indicating whether automatic updates are enabled (default: true).
Definition at line 267 of file CCSDSManager.h.
|
private |
bool indicating whether automatic validation is enabled (default: true).
Definition at line 268 of file CCSDSManager.h.
|
private |
Definition at line 273 of file CCSDSManager.h.