diff options
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_sink.cc | 30 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_source.cc | 32 |
2 files changed, 56 insertions, 6 deletions
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index 99d8e03c3..ad3f4ffdf 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -67,6 +67,7 @@ public: } uhd::dict<std::string, std::string> get_usrp_info(size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API return _dev->get_usrp_tx_info(chan); #else @@ -83,17 +84,20 @@ public: } void set_samp_rate(double rate){ - _dev->set_tx_rate(rate); + BOOST_FOREACH(const size_t chan, _stream_args.channels) + { + _dev->set_tx_rate(rate, chan); + } _sample_rate = this->get_samp_rate(); } double get_samp_rate(void){ - return _dev->get_tx_rate(); + return _dev->get_tx_rate(_stream_args.channels[0]); } uhd::meta_range_t get_samp_rates(void){ #ifdef UHD_USRP_MULTI_USRP_GET_RATES_API - return _dev->get_tx_rates(); + return _dev->get_tx_rates(_stream_args.channels[0]); #else throw std::runtime_error("not implemented in this version"); #endif @@ -102,66 +106,82 @@ public: uhd::tune_result_t set_center_freq( const uhd::tune_request_t tune_request, size_t chan ){ + chan = _stream_args.channels[chan]; return _dev->set_tx_freq(tune_request, chan); } double get_center_freq(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_freq(chan); } uhd::freq_range_t get_freq_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_freq_range(chan); } void set_gain(double gain, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_tx_gain(gain, chan); } void set_gain(double gain, const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_tx_gain(gain, name, chan); } double get_gain(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_gain(chan); } double get_gain(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_gain(name, chan); } std::vector<std::string> get_gain_names(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_gain_names(chan); } uhd::gain_range_t get_gain_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_gain_range(chan); } uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_gain_range(name, chan); } void set_antenna(const std::string &ant, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_tx_antenna(ant, chan); } std::string get_antenna(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_antenna(chan); } std::vector<std::string> get_antennas(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_antennas(chan); } void set_bandwidth(double bandwidth, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_tx_bandwidth(bandwidth, chan); } double get_bandwidth(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_bandwidth(chan); } uhd::freq_range_t get_bandwidth_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_bandwidth_range(chan); } @@ -174,6 +194,7 @@ public: } void set_iq_balance(const std::complex<double> &correction, size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API return _dev->set_tx_iq_balance(correction, chan); #else @@ -182,10 +203,12 @@ public: } uhd::sensor_value_t get_sensor(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_sensor(name, chan); } std::vector<std::string> get_sensor_names(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_sensor_names(chan); } @@ -294,6 +317,7 @@ public: } uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_tx_dboard_iface(chan); } diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index c6c82d56c..efb74d717 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -74,6 +74,7 @@ public: } uhd::dict<std::string, std::string> get_usrp_info(size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API return _dev->get_usrp_rx_info(chan); #else @@ -90,18 +91,21 @@ public: } void set_samp_rate(double rate){ - _dev->set_rx_rate(rate); + BOOST_FOREACH(const size_t chan, _stream_args.channels) + { + _dev->set_rx_rate(rate, chan); + } _samp_rate = this->get_samp_rate(); _tag_now = true; } double get_samp_rate(void){ - return _dev->get_rx_rate(); + return _dev->get_rx_rate(_stream_args.channels[0]); } uhd::meta_range_t get_samp_rates(void){ #ifdef UHD_USRP_MULTI_USRP_GET_RATES_API - return _dev->get_rx_rates(); + return _dev->get_rx_rates(_stream_args.channels[0]); #else throw std::runtime_error("not implemented in this version"); #endif @@ -110,6 +114,7 @@ public: uhd::tune_result_t set_center_freq( const uhd::tune_request_t tune_request, size_t chan ){ + chan = _stream_args.channels[chan]; const uhd::tune_result_t res = _dev->set_rx_freq(tune_request, chan); _center_freq = this->get_center_freq(chan); _tag_now = true; @@ -117,66 +122,82 @@ public: } double get_center_freq(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_freq(chan); } uhd::freq_range_t get_freq_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_freq_range(chan); } void set_gain(double gain, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_rx_gain(gain, chan); } void set_gain(double gain, const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_rx_gain(gain, name, chan); } double get_gain(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_gain(chan); } double get_gain(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_gain(name, chan); } std::vector<std::string> get_gain_names(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_gain_names(chan); } uhd::gain_range_t get_gain_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_gain_range(chan); } uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_gain_range(name, chan); } void set_antenna(const std::string &ant, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_rx_antenna(ant, chan); } std::string get_antenna(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_antenna(chan); } std::vector<std::string> get_antennas(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_antennas(chan); } void set_bandwidth(double bandwidth, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->set_rx_bandwidth(bandwidth, chan); } double get_bandwidth(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_bandwidth(chan); } uhd::freq_range_t get_bandwidth_range(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_bandwidth_range(chan); } void set_auto_dc_offset(const bool enable, size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API return _dev->set_rx_dc_offset(enable, chan); #else @@ -185,6 +206,7 @@ public: } void set_dc_offset(const std::complex<double> &offset, size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API return _dev->set_rx_dc_offset(offset, chan); #else @@ -193,6 +215,7 @@ public: } void set_iq_balance(const std::complex<double> &correction, size_t chan){ + chan = _stream_args.channels[chan]; #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API return _dev->set_rx_iq_balance(correction, chan); #else @@ -201,10 +224,12 @@ public: } uhd::sensor_value_t get_sensor(const std::string &name, size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_sensor(name, chan); } std::vector<std::string> get_sensor_names(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_sensor_names(chan); } @@ -313,6 +338,7 @@ public: } uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan){ + chan = _stream_args.channels[chan]; return _dev->get_rx_dboard_iface(chan); } |