#pragma once #include "module.h" #include #include #include #include "common/dsp/agc.h" #include "common/dsp/fir.h" #include "common/dsp/costas_loop.h" #include "common/dsp/clock_recovery_mm.h" #include "common/dsp/file_source.h" #include "common/dsp/dc_blocker.h" #include "common/dsp/rational_resampler.h" #include "common/dsp/snr_estimator.h" #include "common/widgets/constellation.h" #include "common/widgets/snr_plot.h" class BPSKDemodModule : public ProcessingModule { protected: std::shared_ptr file_source; std::shared_ptr dcb; std::shared_ptr res; std::shared_ptr agc; std::shared_ptr rrc; std::shared_ptr pll; std::shared_ptr rec; const float d_agc_rate; const int d_samplerate; const int d_symbolrate; const float d_rrc_alpha; const int d_rrc_taps; const float d_loop_bw; /*const*/ int d_buffer_size; const bool d_dc_block; const int MAX_SPS = 3; // Maximum sample per symbol the demodulator will accept before resampling the input bool resample = false; int8_t *sym_buffer; int8_t clamp(float x) { if (x < -128.0) return -127; if (x > 127.0) return 127; return x; } std::ofstream data_out; std::atomic filesize; std::atomic progress; M2M4SNREstimator snr_estimator; float snr, peak_snr; // UI Stuff widgets::ConstellationViewer constellation; widgets::SNRPlotViewer snr_plot; public: BPSKDemodModule(std::string input_file, std::string output_file_hint, std::map parameters); ~BPSKDemodModule(); void init(); void stop(); void process(); void drawUI(bool window); std::vector getInputTypes(); std::vector getOutputTypes(); public: static std::string getID(); virtual std::string getIDM() { return getID(); }; static std::vector getParameters(); static std::shared_ptr getInstance(std::string input_file, std::string output_file_hint, std::map parameters); };