19uint16_t
crc16(
const std::vector<std::uint8_t> &data,
20 std::uint16_t polynomial = 0x1021,
21 std::uint16_t initialValue = 0xFFFF,
22 std::uint16_t finalXorValue = 0x0000
34bool stringEndsWith(
const std::string& str,
const std::string& suffix);
73void printBufferData(
const std::vector<std::uint8_t> &buffer, std::int32_t limitBytes = 20);
std::string getBinaryString(std::uint32_t value, std::int32_t bits)
Converts a given value to its binary representation as a string, with spaces every 4 bits.
void printBufferData(const std::vector< std::uint8_t > &buffer, std::int32_t limitBytes=20)
Prints to console the HEX data from the bytes vector.
bool fileExists(const std::string &fileName)
filesystem check fore file existence prepared for both windows and linux.
void printPacket(CCSDS::Packet &packet)
Prints to console a CCSDS Packets, breaking it down to Primary header and Data field.
bool stringEndsWith(const std::string &str, const std::string &suffix)
Tests if str ends with suffix.
CCSDS::ResultBool printPrimaryHeader(CCSDS::Packet &packet)
Prints to console the primary header of a provided CCSDS packet.
uint16_t crc16(const std::vector< std::uint8_t > &data, std::uint16_t polynomial=0x1021, std::uint16_t initialValue=0xFFFF, std::uint16_t finalXorValue=0x0000)
Computes the CRC-16 checksum for a given data vector with configurable parameters.
void printData(CCSDS::DataField dataField)
Prints the data field details, including the secondary header and application data.
CCSDS::ResultBuffer readBinaryFile(const std::string &filename)
Read a specified binary file and return its contents as a buffer.
void printHeader(CCSDS::Header &header)
Prints the header fields and their binary or hexadecimal representations.
CCSDS::ResultBool writeBinaryFile(const std::vector< std::uint8_t > &data, const std::string &filename)
This function takes in a buffer of data and a file name.
std::string getBitsSpaces(std::int32_t num)
Generates a string of spaces for formatting binary outputs.
void printPackets(CCSDS::Manager &manager)
Prints to console a series of CCSDS Packets contained in the manager.
void printDataField(CCSDS::Packet &packet)
Prints the data field and the CRC-16 checksum of the packet.
Represents the data field of a CCSDS packet.
Manages CCSDS packets and their templates.
Represents a CCSDS (Consultative Committee for Space Data Systems) packet.
Encapsulates a result that can hold either a value or an Error.