Manages the decomposition and manipulation of CCSDS primary headers.
More...
#include <CCSDSHeader.h>
Manages the decomposition and manipulation of CCSDS primary headers.
Definition at line 80 of file CCSDSHeader.h.
◆ Header()
CCSDS::Header::Header |
( |
| ) |
|
|
default |
◆ deserialize()
Sets the header data from a 64-bit integer representation.
Decomposes the 64-bit input data into various header fields, including the version number, type, data field header flag, APID, sequence flags, sequence count, and data length.
- Note
- returns an error code if the provided data exceeds maximum available value (max 6 bytes i.e. elements).
- Parameters
-
data | reference to an uint8_t vector. |
- Returns
- ResultBool.
Definition at line 4 of file CCSDSHeader.cpp.
4 {
6
7 uint64_t headerData = 0;
8 for (int i = 0; i < 6; ++i) {
9 headerData |= static_cast<uint64_t>(data[i]) << (40 - i * 8);
10 }
12 return true;
13}
#define RET_IF_ERR_MSG(condition, errorCode, message)
Macro to return an error with an error message if a condition is met.
#define FORWARD_RESULT(result)
Macro to return a result as-is (for functions returning Result<T>).
@ INVALID_HEADER_DATA
Header data is invalid.
◆ getAPID()
uint16_t CCSDS::Header::getAPID |
( |
| ) |
const |
|
inline |
◆ getDataFieldHeaderFlag()
uint8_t CCSDS::Header::getDataFieldHeaderFlag |
( |
| ) |
const |
|
inline |
◆ getDataLength()
uint16_t CCSDS::Header::getDataLength |
( |
| ) |
const |
|
inline |
◆ getFullHeader()
uint64_t CCSDS::Header::getFullHeader |
( |
| ) |
|
|
inline |
Computes and retrieves the full header as a 64-bit value.
Combines individual header fields into a single 64-bit representation.
- Note
- if data has not been set it is initialized as all 0s.
- Returns
- The full header as a 64-bit integer.
Definition at line 108 of file CCSDSHeader.h.
◆ getSequenceCount()
uint16_t CCSDS::Header::getSequenceCount |
( |
| ) |
const |
|
inline |
◆ getSequenceFlags()
uint8_t CCSDS::Header::getSequenceFlags |
( |
| ) |
const |
|
inline |
◆ getType()
uint8_t CCSDS::Header::getType |
( |
| ) |
const |
|
inline |
◆ getVersionNumber()
uint8_t CCSDS::Header::getVersionNumber |
( |
| ) |
const |
|
inline |
◆ serialize()
std::vector< uint8_t > CCSDS::Header::serialize |
( |
| ) |
|
decomposes the Primary header class and returns it as a vector of bytes.
- Note
- if data has not been set it is initialized as all 0s.
- Returns
- std::vector<uint8_t>
Definition at line 35 of file CCSDSHeader.cpp.
35 {
39
40 std::vector data{
47 };
48 return data;
49}
◆ setAPID()
void CCSDS::Header::setAPID |
( |
const uint16_t & |
value | ) |
|
|
inline |
◆ setData() [1/2]
Sets the header data from a PrimaryHeader
structure.
Assigns values from a PrimaryHeader
structure to the internal header fields. Combines certain fields into their packed representations for efficient storage.
- Parameters
-
- Returns
- none.
Definition at line 51 of file CCSDSHeader.cpp.
51 {
53 m_type = data.type & 0x0001;
55 m_APID = data.APID & 0x07FF;
59
63}
◆ setData() [2/2]
Sets the header data from a 64-bit integer representation.
Decomposes the 64-bit input data into various header fields, including the version number, type, data field header flag, APID, sequence flags, sequence count, and data length.
- Note
- returns an error code if the provided data exceeds maximum available value (max 6 bytes).
- Parameters
-
data | The 64-bit integer representing the header data. |
- Returns
- ResultBool.
Definition at line 15 of file CCSDSHeader.cpp.
15 {
17 "Input data exceeds expected bit size for version or size.");
18
22
23
28
29
32 return true;
33}
◆ setDataFieldHeaderFlag()
void CCSDS::Header::setDataFieldHeaderFlag |
( |
const uint8_t & |
value | ) |
|
|
inline |
◆ setDataLength()
void CCSDS::Header::setDataLength |
( |
const uint16_t & |
value | ) |
|
|
inline |
◆ setSequenceCount()
void CCSDS::Header::setSequenceCount |
( |
const uint16_t & |
value | ) |
|
|
inline |
◆ setSequenceFlags()
void CCSDS::Header::setSequenceFlags |
( |
const uint8_t & |
value | ) |
|
|
inline |
◆ setType()
void CCSDS::Header::setType |
( |
const uint8_t & |
value | ) |
|
|
inline |
◆ setVersionNumber()
void CCSDS::Header::setVersionNumber |
( |
const uint8_t & |
value | ) |
|
|
inline |
◆ m_APID
uint16_t CCSDS::Header::m_APID {} |
|
private |
11 bit last of packet identification
Definition at line 169 of file CCSDSHeader.h.
◆ m_dataFieldHeaderFlag
uint8_t CCSDS::Header::m_dataFieldHeaderFlag {} |
|
private |
1 bit third of packet identification
Definition at line 168 of file CCSDSHeader.h.
◆ m_dataLength
uint16_t CCSDS::Header::m_dataLength {} |
|
private |
◆ m_packetIdentificationAndVersion
uint16_t CCSDS::Header::m_packetIdentificationAndVersion {} |
|
private |
packet id and version 16 bit 4 hex
Definition at line 176 of file CCSDSHeader.h.
◆ m_packetSequenceControl
uint16_t CCSDS::Header::m_packetSequenceControl {} |
|
private |
packet sequence control 16 bit 4 hex
Definition at line 177 of file CCSDSHeader.h.
◆ m_sequenceCount
uint16_t CCSDS::Header::m_sequenceCount {} |
|
private |
◆ m_sequenceFlags
2 bit first of sequence control / ESequenceFlag enum.
Definition at line 172 of file CCSDSHeader.h.
@ UNSEGMENTED
11 Complete packet in a single frame.
◆ m_type
uint8_t CCSDS::Header::m_type {} |
|
private |
1 bit second of packet identification
Definition at line 167 of file CCSDSHeader.h.
◆ m_versionNumber
uint8_t CCSDS::Header::m_versionNumber {} |
|
private |
3 bit first of packet identification
Definition at line 164 of file CCSDSHeader.h.
The documentation for this class was generated from the following files: