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/usrp1 | |
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/usrp1')
-rw-r--r-- | Transceiver52M/device/usrp1/USRPDevice.cpp | 11 | ||||
-rw-r--r-- | Transceiver52M/device/usrp1/USRPDevice.h | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp index 07ba1c9..7a31c97 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.cpp +++ b/Transceiver52M/device/usrp1/USRPDevice.cpp @@ -58,11 +58,14 @@ const dboardConfigType dboardConfig = TXA_RXB; const double USRPDevice::masterClockRate = 52.0e6; -USRPDevice::USRPDevice(size_t tx_sps) +USRPDevice::USRPDevice(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): + RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths) { LOG(INFO) << "creating USRP device..."; - this->tx_sps = tx_sps; decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) tx_sps)); actualSampleRate = masterClockRate/decimRate; rxGain = 0; @@ -648,9 +651,9 @@ bool USRPDevice::setRxFreq(double wFreq) { return true;}; #endif 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 USRPDevice(tx_sps); + return new USRPDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths); } diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h index ff5b273..451b5a9 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.h +++ b/Transceiver52M/device/usrp1/USRPDevice.h @@ -95,7 +95,9 @@ private: public: /** Object constructor */ - USRPDevice(size_t tx_sps); + USRPDevice(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); /** Instantiate the USRP */ int open(const std::string &, int, bool); |