// --------------------------------------------------------------
#ifndef _RADIO_SYMBOLIZER_HPP_
#define	_RADIO_SYMBOLIZER_HPP_

#include <radio/radio_types.h>
#include <radio/cpx.h>
#include "Formatter.hpp"


class Symbolizer : public Processor::Block
{
public:
	Symbolizer();
	virtual ~Symbolizer() = default;
	void setNumBitsPerSymbol(uint32_t nBitsPerSym);

	// Processor::Block
	void prepare() override;
	void process();

private:
	uint32_t m_nBitsPerSym;
	uint32_t m_symbolBitCount;
	symbol_t m_lastSymbol;
	symbol_t m_symbolMask;
	Processor::Buffer<uint8_t> *m_buf_in;
	Processor::Buffer<symbol_t> *m_buf_out;
	symbol_t differentialEncode(symbol_t symbol);
	void commit(symbol_t src);
	void assemble_and_commit(uint8_t src);
};

// --------------------------------------------------------------
#endif // _RADIO_SYMBOLIZER_HPP_
