diff --git a/src/capture/Capture.cpp b/src/capture/Capture.cpp index b734528..8c3fa53 100644 --- a/src/capture/Capture.cpp +++ b/src/capture/Capture.cpp @@ -70,7 +70,17 @@ std::unique_ptr Capture::factory_source(const std::string& type, c4::yml // SDRplay RSPduo if (type == VALID_TYPE[0]) { - return std::make_unique(type, fc, fs, path, &saveIq); + int agcSetPoint, bandwidthNumber, gainReduction, lnaState; + bool dabNotch, rfNotch; + config["agcSetPoint"] >> agcSetPoint; + config["bandwidthNumber"] >> bandwidthNumber; + config["gainReduction"] >> gainReduction; + config["lnaState"] >> lnaState; + config["dabNotch"] >> dabNotch; + config["rfNotch"] >> rfNotch; + return std::make_unique(type, fc, fs, path, &saveIq, + agcSetPoint, bandwidthNumber, gainReduction, lnaState, + dabNotch, rfNotch); } // Usrp else if (type == VALID_TYPE[1]) diff --git a/src/capture/rspduo/RspDuo.cpp b/src/capture/rspduo/RspDuo.cpp index d39b0ad..cce893c 100644 --- a/src/capture/rspduo/RspDuo.cpp +++ b/src/capture/rspduo/RspDuo.cpp @@ -14,13 +14,9 @@ // class static constants const double RspDuo::MAX_FREQUENCY_NR = 2000000000; -const int RspDuo::DEF_AGC_BANDWIDTH_NR = 50; // default agc bandwidth const int RspDuo::MIN_AGC_SET_POINT_NR = -72; // min agc set point -const int RspDuo::DEF_AGC_SET_POINT_NR = -60; // default agc set point const int RspDuo::MIN_GAIN_REDUCTION_NR = 20; // min gain reduction -const int RspDuo::DEF_GAIN_REDUCTION_NR = 40; // default gain reduction const int RspDuo::MAX_GAIN_REDUCTION_NR = 60; // max gain reduction -const int RspDuo::DEF_LNA_STATE_NR = 4; // default lna state const int RspDuo::MAX_LNA_STATE_NR = 9; // max lna state const int RspDuo::DEF_SAMPLE_RATE_NR = 2000000; // default sample rate @@ -47,7 +43,10 @@ IqData *buffer2; // constructor RspDuo::RspDuo(std::string _type, uint32_t _fc, - uint32_t _fs, std::string _path, bool *_saveIq) + uint32_t _fs, std::string _path, bool *_saveIq, + int _agcSetPoint, int _bandwidthNumber, + int _gainReduction, int _lnaState, + bool _dabNotch, bool _rfNotch) : Source(_type, _fc, _fs, _path, _saveIq) { std::unordered_map decimationMap = { @@ -60,14 +59,14 @@ RspDuo::RspDuo(std::string _type, uint32_t _fc, }; nDecimation = decimationMap[fs]; usb_bulk_fg = false; - agc_bandwidth_nr = DEF_AGC_BANDWIDTH_NR; - agc_set_point_nr = DEF_AGC_SET_POINT_NR; - gain_reduction_nr = DEF_GAIN_REDUCTION_NR; - lna_state_nr = DEF_LNA_STATE_NR; - rf_notch_fg = false; - dab_notch_fg = false; capture_fg = saveIq; saveIqFileLocal = &saveIqFile; + agc_bandwidth_nr = _bandwidthNumber; + agc_set_point_nr = _agcSetPoint; + gain_reduction_nr = _gainReduction; + lna_state_nr = _lnaState; + rf_notch_fg = _rfNotch; + dab_notch_fg = _dabNotch; } void RspDuo::start() diff --git a/src/capture/rspduo/RspDuo.h b/src/capture/rspduo/RspDuo.h index 164e601..0dedf10 100644 --- a/src/capture/rspduo/RspDuo.h +++ b/src/capture/rspduo/RspDuo.h @@ -50,20 +50,12 @@ private: /// @brief Maximum frequency (Hz). static const double MAX_FREQUENCY_NR; - /// @brief Default AGC bandwidth. - static const int DEF_AGC_BANDWIDTH_NR; /// @brief Minimum AGC set point. static const int MIN_AGC_SET_POINT_NR; - /// @brief Default AGC set point. - static const int DEF_AGC_SET_POINT_NR; /// @brief Minimum gain reduction. static const int MIN_GAIN_REDUCTION_NR; - /// @brief Default gain reduction. - static const int DEF_GAIN_REDUCTION_NR; /// @brief Maximum gain reduction. static const int MAX_GAIN_REDUCTION_NR; - /// @brief Default LNA state. - static const int DEF_LNA_STATE_NR; /// @brief Max LNA state. static const int MAX_LNA_STATE_NR; /// @brief Default sample rate. @@ -164,7 +156,9 @@ public: /// @param path Path to save IQ data. /// @return The object. RspDuo(std::string type, uint32_t fc, uint32_t fs, - std::string path, bool *saveIq); + std::string path, bool *saveIq, int agcSetPoint, + int bandwidthNumber, int gainReduction, + int lnaState, bool dabNotch, bool rfNotch); /// @brief Implement capture function on RSPduo. /// @param buffer1 Pointer to reference buffer.