mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-26 20:53:07 +00:00
389ff92cc1
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
60 lines
No EOL
1.5 KiB
C++
60 lines
No EOL
1.5 KiB
C++
#pragma once
|
|
#include "stdint.h"
|
|
#include "stdbool.h"
|
|
|
|
class ProtocolGeneric {
|
|
public:
|
|
/**
|
|
* @brief Get the encoded data size
|
|
*
|
|
* @return uint8_t size of encoded data in bytes
|
|
*/
|
|
virtual uint8_t get_encoded_data_size() = 0;
|
|
|
|
/**
|
|
* @brief Get the decoded data size
|
|
*
|
|
* @return uint8_t size of decoded data in bytes
|
|
*/
|
|
virtual uint8_t get_decoded_data_size() = 0;
|
|
|
|
/**
|
|
* @brief encode decoded data
|
|
*
|
|
* @param decoded_data
|
|
* @param decoded_data_size
|
|
* @param encoded_data
|
|
* @param encoded_data_size
|
|
*/
|
|
virtual void encode(
|
|
const uint8_t* decoded_data,
|
|
const uint8_t decoded_data_size,
|
|
uint8_t* encoded_data,
|
|
const uint8_t encoded_data_size) = 0;
|
|
|
|
/**
|
|
* @brief decode encoded data
|
|
*
|
|
* @param encoded_data
|
|
* @param encoded_data_size
|
|
* @param decoded_data
|
|
* @param decoded_data_size
|
|
*/
|
|
virtual void decode(
|
|
const uint8_t* encoded_data,
|
|
const uint8_t encoded_data_size,
|
|
uint8_t* decoded_data,
|
|
const uint8_t decoded_data_size) = 0;
|
|
|
|
/**
|
|
* @brief fast check that data can be correctly decoded
|
|
*
|
|
* @param encoded_data
|
|
* @param encoded_data_size
|
|
* @return true - can be correctly decoded
|
|
* @return false - cannot be correctly decoded
|
|
*/
|
|
virtual bool can_be_decoded(const uint8_t* encoded_data, const uint8_t encoded_data_size) = 0;
|
|
|
|
virtual ~ProtocolGeneric(){};
|
|
}; |