210 [[nodiscard]]
ResultBool load(
const std::vector<Packet>& packets);
217 [[nodiscard]]
ResultBool load(
const std::vector<std::uint8_t>& packetsBuffer);
Defines the Validator class for CCSDS packet validation.
Manages CCSDS packets and their templates.
bool m_templateIsSet
Boolean to indicate if Template has been set or not.
ResultBool loadTemplateConfigFile(const std::string &configPath)
Loads a template packet from a configuration file.
ResultBool setPacketTemplate(Packet packet)
Sets a new packet template.
std::vector< Packet > getPackets()
Retrieves all stored packets.
ResultBuffer getPacketTemplate()
Retrieves the packet template in serialized form.
void setSyncPatternEnable(bool enable)
enable sync pattern utilization both in serialization, deserialization, read and write.
std::vector< Packet > m_packets
Collection of stored packets.
std::uint16_t getDataFieldSize() const
retrieves the set data field size (this includes the secondary header if present)
bool m_validateEnable
bool indicating whether automatic validation is enabled (default: true).
ResultBool readTemplate(const std::string &filename)
Load a template packet from a binary or configuration file.
std::vector< Packet > & getPacketsReference()
Returns a reference to the packets vector.
void setSyncPattern(std::uint32_t syncPattern)
set sync pattern that should indicate the start of a CCSDS packet.
ResultBool load(const std::vector< Packet > &packets)
Load a vector of packets.
ResultBool addPacket(Packet packet)
Adds a new packet to the list.
std::uint32_t getSyncPattern() const
returns the currently set sync pattern.
bool m_syncPattEnable
bool indicating whether automatic sync pattern insertion is enabled (default: false).
std::uint16_t getTotalPackets() const
Retrieves the total number of packets managed.
Packet getTemplate()
Retrieves the packet template.
ResultBuffer getApplicationDataBuffer()
Retrieves the application data from the packets.
std::uint32_t m_syncPattern
ResultBool loadTemplateConfig(const Config &cfg)
Loads a template packet from a configuration object.
ResultBool read(const std::string &binaryFile)
Load a packet or a series of packets from a binary file.
void clearPackets()
Clears the packets and sets the counter to 0.
Packet m_templatePacket
The template packet used for generating new packets.
std::vector< std::uint8_t > getPacketsBuffer() const
Retrieves a buffer containing all the stored packets sequentially.
ResultBool addPacketFromBuffer(const std::vector< std::uint8_t > &packetBuffer)
Adds a new packet to the list.
void setAutoUpdateEnable(bool enable)
Enables or disables automatic updates for packets.
Manager(Packet packet)
Constructs a Manager with a given packet template.
void setDataFieldSize(std::uint16_t size)
Sets the size of the data field.
bool getSyncPatternEnable() const
returns the current settings of the sync pattern enable
bool getAutoUpdateEnable() const
Checks if automatic updates are enabled.
ResultBool setApplicationData(const std::vector< std::uint8_t > &data)
Sets the application data for the packet.
void clear()
Clears the manager, removes all packets and template.
bool m_updateEnable
bool indicating whether automatic updates are enabled (default: true).
void setAutoValidateEnable(bool enable)
Enables or disables automatic validation of packets.
ResultBuffer getApplicationDataBufferAtIndex(std::uint16_t index)
Retrieves the application data from a packet at the given index.
Validator & getValidatorReference()
Returns a reverence to the manager's Validator.
ResultBool write(const std::string &binaryFile) const
Write a packet or a series of packets to a binary file.
ResultBuffer getPacketBufferAtIndex(std::uint16_t index)
Retrieves a packet at the specified index.
std::uint16_t m_sequenceCount
Manager()=default
Default constructor.
Represents a CCSDS (Consultative Committee for Space Data Systems) packet.
void setUpdatePacketEnable(bool enable)
needs to be called as soon as possible, probably also from constructor.
Encapsulates a result that can hold either a value or an Error.
Handles validation of CCSDS packets.
void configure(bool validatePacketCoherence, bool validateSequenceCount, bool validateAgainstTemplate)
Configures validation options.
void setTemplatePacket(const Packet &templatePacket)
Sets the template packet for validation.
Parses and stores config values from custom file format.
Contains definitions and classes for handling CCSDS headers.