CCSDSPack
C++ Library for CCSDS Space Packet manipulation. i.e. generation, extraction, analisys and more
|
#include <CCSDSPacket.h>
#include <CCSDSManager.h>
#include <string>
#include <cstdint>
#include <vector>
Go to the source code of this file.
Classes | |
class | Config |
Parses and stores config values from custom file format. More... | |
Functions | |
uint16_t | crc16 (const std::vector< uint8_t > &data, uint16_t polynomial=0x1021, uint16_t initialValue=0xFFFF, uint16_t finalXorValue=0x0000) |
Computes the CRC-16 checksum for a given data vector with configurable parameters. | |
void | printPacket (CCSDS::Packet &packet) |
Prints to console a CCSDS Packets, breaking it down to Primary header and Data field. | |
void | printPackets (CCSDS::Manager &manager) |
Prints to console a series of CCSDS Packets contained in the manager. | |
std::string | getBinaryString (uint32_t value, int bits) |
Converts a given value to its binary representation as a string, with spaces every 4 bits. | |
std::string | getBitsSpaces (int num) |
Generates a string of spaces for formatting binary outputs. | |
void | printBufferData (const std::vector< uint8_t > &buffer, int limitBytes=20) |
Prints to console the HEX data from the bytes vector. | |
void | printData (CCSDS::DataField dataField) |
Prints the data field details, including the secondary header and application data. | |
void | printHeader (CCSDS::Header &header) |
Prints the header fields and their binary or hexadecimal representations. | |
CCSDS::ResultBool | printPrimaryHeader (CCSDS::Packet &packet) |
Prints to console the primary header of a provided CCSDS packet. | |
void | printDataField (CCSDS::Packet &packet) |
Prints the data field and the CRC-16 checksum of the packet. | |
CCSDS::ResultBool | writeBinaryFile (const std::vector< uint8_t > &data, const std::string &filename) |
This function takes in a buffer of data and a file name. | |
CCSDS::ResultBuffer | readBinaryFile (const std::string &filename) |
Read a specified binary file and return its contents as a buffer. | |
bool | fileExists (const std::string &fileName) |
filesystem check fore file existence prepared for both windows and linux. | |
bool | stringEndsWith (const std::string &str, const std::string &suffix) |
Tests if str ends with suffix. | |
uint16_t crc16 | ( | const std::vector< uint8_t > & | data, |
uint16_t | polynomial = 0x1021 , |
||
uint16_t | initialValue = 0xFFFF , |
||
uint16_t | finalXorValue = 0x0000 |
||
) |
Computes the CRC-16 checksum for a given data vector with configurable parameters.
data | A vector of bytes to compute the checksum for. |
polynomial | The polynomial used for the CRC calculation (default: CCSDS CRC-16 polynomial 0x1021). |
initialValue | The initial value of the CRC register (default: 0xFFFF). |
finalXorValue | The final XOR value applied to the CRC result (default: 0x0000). |
Definition at line 147 of file CCSDSUtils.cpp.
bool fileExists | ( | const std::string & | fileName | ) |
filesystem check fore file existence prepared for both windows and linux.
fileName | std::string |
Definition at line 226 of file CCSDSUtils.cpp.
std::string getBinaryString | ( | uint32_t | value, |
int | bits | ||
) |
Converts a given value to its binary representation as a string, with spaces every 4 bits.
value | The 32-bit integer value to convert. |
bits | The number of significant bits to include in the binary string. |
Definition at line 11 of file CCSDSUtils.cpp.
std::string getBitsSpaces | ( | int | num | ) |
Generates a string of spaces for formatting binary outputs.
num | The number of spaces required. |
num
. Definition at line 27 of file CCSDSUtils.cpp.
void printBufferData | ( | const std::vector< uint8_t > & | buffer, |
int | limitBytes = 20 |
||
) |
Prints to console the HEX data from the bytes vector.
buffer | |
limitBytes |
Definition at line 37 of file CCSDSUtils.cpp.
void printData | ( | CCSDS::DataField | dataField | ) |
Prints the data field details, including the secondary header and application data.
Outputs information about the presence of a secondary header and the content of both the secondary header and the application data in hexadecimal format.
Definition at line 55 of file CCSDSUtils.cpp.
void printDataField | ( | CCSDS::Packet & | packet | ) |
Prints the data field and the CRC-16 checksum of the packet.
Outputs the content of the data field and the CRC-16 checksum in hexadecimal format to the standard output.
Definition at line 138 of file CCSDSUtils.cpp.
void printHeader | ( | CCSDS::Header & | header | ) |
Prints the header fields and their binary or hexadecimal representations.
Outputs all relevant header fields, including the full primary header, version number, type, data field header flag, APID, sequence flags, sequence count, and data length. Each field is displayed with appropriate formatting and spacing.
Definition at line 77 of file CCSDSUtils.cpp.
void printPacket | ( | CCSDS::Packet & | packet | ) |
Prints to console a CCSDS Packets, breaking it down to Primary header and Data field.
packet |
Definition at line 168 of file CCSDSUtils.cpp.
void printPackets | ( | CCSDS::Manager & | manager | ) |
Prints to console a series of CCSDS Packets contained in the manager.
manager |
Definition at line 173 of file CCSDSUtils.cpp.
CCSDS::ResultBool printPrimaryHeader | ( | CCSDS::Packet & | packet | ) |
Prints to console the primary header of a provided CCSDS packet.
packet |
Definition at line 131 of file CCSDSUtils.cpp.
CCSDS::ResultBuffer readBinaryFile | ( | const std::string & | filename | ) |
Read a specified binary file and return its contents as a buffer.
filename |
Definition at line 208 of file CCSDSUtils.cpp.
bool stringEndsWith | ( | const std::string & | str, |
const std::string & | suffix | ||
) |
Tests if str ends with suffix.
equivalent to endsWith(str) in c++20
str | string |
suffix | string |
Definition at line 234 of file CCSDSUtils.cpp.
CCSDS::ResultBool writeBinaryFile | ( | const std::vector< uint8_t > & | data, |
const std::string & | filename | ||
) |
This function takes in a buffer of data and a file name.
and writes the data in binary form to the file.
data | vector of uint8_t |
filename | string |
Definition at line 194 of file CCSDSUtils.cpp.