git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@1079 b431acfa-c32f-4a4a-93f1-934dc6c82436
84 lines
1.7 KiB
C++
84 lines
1.7 KiB
C++
// --------------------------------------------------------------
|
|
#ifndef _RADIO_FRAME_HPP_
|
|
#define _RADIO_FRAME_HPP_
|
|
|
|
#include <cstdint>
|
|
#include <radio/radio_types.h>
|
|
#include <radio/cpx.h>
|
|
#include <cpp/radio/processor/src/Block.hpp>
|
|
|
|
#include "FrameDefs.hpp"
|
|
#include "Symbolizer.hpp"
|
|
#include "Formatter.hpp"
|
|
#include "DeSymbolizer.hpp"
|
|
#include "DeFormatter.hpp"
|
|
|
|
class FrameReceiver : public Processor::Block
|
|
{
|
|
public:
|
|
FrameReceiver()
|
|
: Processor::Block(1, 1)
|
|
, m_desymbolizer()
|
|
, m_deformatter()
|
|
, m_framesCount(0)
|
|
, m_byteCount(0)
|
|
, m_buf_symbol_in(nullptr)
|
|
, m_buf_byte_out(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
~FrameReceiver()
|
|
{
|
|
}
|
|
|
|
frame_statistics_t getStats()
|
|
{
|
|
return m_deformatter.getStats();
|
|
}
|
|
|
|
void resetStats()
|
|
{
|
|
m_deformatter.resetStats();
|
|
}
|
|
|
|
void setNumBitsPerSymbol(uint32_t nBitsPerSym)
|
|
{
|
|
m_desymbolizer.setNumBitsPerSymbol(nBitsPerSym);
|
|
m_deformatter.resetStats();
|
|
}
|
|
|
|
void prepare()
|
|
{
|
|
m_buf_symbol_in = buffer_in<symbol_t>();
|
|
// m_buf_byte_out = buffer_out<uint8_t>();
|
|
m_buf_byte_in.resize(m_buf_symbol_in->capacity());
|
|
|
|
m_desymbolizer.buffer_in_add(m_buf_symbol_in);
|
|
m_desymbolizer.buffer_out_add(&m_buf_byte_in);
|
|
m_desymbolizer.prepare();
|
|
|
|
m_deformatter.buffer_in_add(&m_buf_byte_in);
|
|
m_deformatter.buffer_out_add(m_buf_byte_out);
|
|
m_deformatter.prepare();
|
|
}
|
|
|
|
void process()
|
|
{
|
|
m_desymbolizer.process();
|
|
m_deformatter.process();
|
|
}
|
|
|
|
private:
|
|
DeSymbolizer m_desymbolizer;
|
|
DeFormatter m_deformatter;
|
|
uint32_t m_framesCount;
|
|
uint32_t m_byteCount;
|
|
Processor::Buffer<symbol_t> *m_buf_symbol_in;
|
|
Processor::Buffer<uint8_t> *m_buf_byte_out;
|
|
Processor::Buffer<uint8_t> m_buf_byte_in;
|
|
};
|
|
|
|
// --------------------------------------------------------------
|
|
#endif // _RADIO_FRAME_HPP_
|