diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-06-13 23:21:57 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-06-14 12:38:04 +0200 |
commit | 61707e8b23564e3a3b1123f231e428cae0759cc7 (patch) | |
tree | 82e3a5dfe9ca71e069979ca6a8f9bfe32d7b3cfe /Transceiver52M/device/lms | |
parent | ce70ba529cfd5c32e5c9f2652affb36d6a8d1b09 (diff) |
radioDevice: better encapsulation in base class
It's not good style to have the derived classes initialize members
inherited from the base class using "this->foo = bar". Rather, let's
make the base class have a constructor, and call that constructor to
initialize the members of the base class.
While doing this
* rename 'offset' to 'lo_offset' to avoid confusion with timestamp offset
* move 'InterfaceType' into the base class
* move 'chans' into the base class
* move 'rx_sps' into the base class
* mark base class members as 'protected'
Change-Id: Ib885675a7612a392aa7f75fca81269ddcff2f6ab
Diffstat (limited to 'Transceiver52M/device/lms')
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.cpp | 13 | ||||
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.h | 3 |
2 files changed, 6 insertions, 10 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index 68d4b97..c4d5f96 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -40,17 +40,14 @@ constexpr double LMSDevice::masterClockRate; #define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */ #define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED) -LMSDevice::LMSDevice(size_t tx_sps, size_t chans, +LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset, const std::vector<std::string>& tx_paths, const std::vector<std::string>& rx_paths): - m_lms_dev(NULL), chans(chans) + RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths), + m_lms_dev(NULL) { LOG(INFO) << "creating LMS device..."; - this->tx_sps = tx_sps; - this->tx_paths = tx_paths; - this->rx_paths = rx_paths; - m_lms_stream_rx.resize(chans); m_lms_stream_tx.resize(chans); @@ -624,9 +621,9 @@ bool LMSDevice::setRxFreq(double wFreq, size_t chan) } RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps, - InterfaceType iface, size_t chans, double offset, + InterfaceType iface, size_t chans, double lo_offset, const std::vector < std::string > &tx_paths, const std::vector < std::string > &rx_paths) { - return new LMSDevice(tx_sps, chans, tx_paths, rx_paths); + return new LMSDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths); } diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h index 0fe4c15..349efbb 100644 --- a/Transceiver52M/device/lms/LMSDevice.h +++ b/Transceiver52M/device/lms/LMSDevice.h @@ -46,7 +46,6 @@ private: std::vector<uint32_t> m_last_tx_underruns; std::vector<uint32_t> m_last_tx_overruns; - size_t chans; double actualSampleRate; ///< the actual USRP sampling rate unsigned long long samplesRead; ///< number of samples read from LMS @@ -65,7 +64,7 @@ private: public: /** Object constructor */ - LMSDevice(size_t tx_sps, size_t chans, + LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset, const std::vector<std::string>& tx_paths, const std::vector<std::string>& rx_paths); |