127 template <
typename T>
253 [[nodiscard]]
ResultBool deserialize(
const std::vector<std::uint8_t> &data,
const std::string& headerType, std::int32_t headerSize = -1);
383 void setCrcConfig(
const std::uint16_t polynomial,
const std::uint16_t initialValue,
const std::uint16_t finalXorValue) {
m_CRC16Config = {polynomial, initialValue, finalXorValue};}
#define FORWARD_RESULT(result)
Macro to return a result as-is (for functions returning Result<T>).
Represents the data field of a CCSDS packet.
ResultBool RegisterSecondaryHeader()
Registers a new header type with its creation function.
Represents a CCSDS (Consultative Committee for Space Data Systems) packet.
ResultBool setDataFieldHeader(const std::vector< std::uint8_t > &data, const std::string &headerType)
Sets the data field header for the packet using a vector of bytes.
bool m_updateStatus
When setting data thus value should be set to false.
ResultBool deserialize(const std::vector< uint8_t > &headerData, const std::vector< uint8_t > &data)
Deserializes a CCSDS packet using separate header and data vectors.
std::vector< uint8_t > getPrimaryHeaderBytes()
Retrieves the primary header of the packet as a vector of bytes.
void setCrcConfig(const std::uint16_t polynomial, const std::uint16_t initialValue, const std::uint16_t finalXorValue)
Sets the crc configuration of the crc calculation.
void update()
Updates Primary headers data field size.
std::vector< uint8_t > getCRCVectorBytes()
Retrieves the CRC-16 checksum as a vector of bytes.
void setUpdatePacketEnable(bool enable)
needs to be called as soon as possible, probably also from constructor.
ResultBool setSequenceCount(std::uint16_t count)
Sets the sequence count for the packet.
ResultBool setPrimaryHeader(const std::vector< std::uint8_t > &data)
Sets the primary header using the provided vector of std::uint8_tdata.
bool getDataFieldHeaderFlag()
@ returns the data field header flag
void setDataFieldHeader(const std::shared_ptr< SecondaryHeaderAbstract > &header)
Sets the data field header using the provided SecondaryHeaderAbstract derived header.
std::uint16_t m_sequenceCounter
Header m_primaryHeader
6 bytes / 48 bits / 12 hex
std::uint64_t getPrimaryHeader64bit()
Retrieves the primary header of the packet.
DataField m_dataField
variable
ResultBool loadFromConfig(const Config &cfg)
Loads a packet from a configuration object, including secondary header if present.
std::uint16_t getCRC()
Computes and retrieves the CRC-16 checksum of the packet.
std::uint16_t getDataFieldMaximumSize() const
returns the maximum data field size
void setSequenceFlags(ESequenceFlag flags)
Sets the sequence flags for the packet's primary header.
std::vector< uint8_t > getFullDataFieldBytes()
Retrieves the full data field data.
std::vector< uint8_t > serialize()
Retrieves the full packet as a vector of bytes.
ResultBool loadFromConfigFile(const std::string &configPath)
Loads a packet from a configuration file, including secondary header if present.
ResultBool setApplicationData(const std::vector< std::uint8_t > &data)
Sets the application data for the packet.
std::uint16_t m_CRC16
Cyclic Redundancy check 16 bits.
std::vector< uint8_t > getDataFieldHeaderBytes()
Retrieves the secondary header data from the data field.
void setPrimaryHeader(PrimaryHeader data)
Sets the primary header using the provided PrimaryHeader object.
ResultBool deserialize(const std::vector< std::uint8_t > &data)
Deserializes a vector of bytes into a CCSDS packet.
std::uint16_t getFullPacketLength()
Retrieves the current size of the CCSDS Packet.
ResultBool RegisterSecondaryHeader()
Registers a new header type with the data field secondary header creation function.
Header & getPrimaryHeader()
returns the CCSDS packet's Primary Header.
ResultBool setDataFieldHeader(const std::vector< std::uint8_t > &data)
Sets the data field header using the provided vector of bytes.
std::vector< uint8_t > getApplicationDataBytes()
Retrieves the application data from the data field.
DataField & getDataField()
returns the CCSDS packet's DataField.
bool m_enableUpdatePacket
Enables primary header and secondary header update.
ResultBool deserialize(const std::vector< uint8_t > &data, std::uint16_t headerDataSizeBytes)
Deserializes a CCSDS packet using a vector and a header data size.
void setDataFieldSize(std::uint16_t size)
Sets the maximum data packet size for the CCSDS DataField.
CRC16Config m_CRC16Config
structure holding configuration of crc calculation.
void setCrcConfig(const CRC16Config crcConfig)
Sets the crc configuration of the crc calculation.
Encapsulates a result that can hold either a value or an Error.
Parses and stores config values from custom file format.
Contains definitions and classes for handling CCSDS headers.
ESequenceFlag
Represents the sequence flags used in CCSDS telemetry transfer frames.
Configuration structure for CRC16 calculation parameters.
std::uint16_t initialValue
std::uint16_t finalXorValue