summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-10-20 16:20:36 -0700
committerJosh Blum <josh@joshknows.com>2010-10-20 16:20:36 -0700
commit8e341caadf19db645635e3e7e1a26e6b00e64c70 (patch)
treec6ff90b0b773a860a95cbc0503a39ed3196473d1 /host/lib
parent26aef3bae98aae5364deb40a62b52ba65b9aa16a (diff)
downloaduhd-8e341caadf19db645635e3e7e1a26e6b00e64c70.tar.gz
uhd-8e341caadf19db645635e3e7e1a26e6b00e64c70.tar.bz2
uhd-8e341caadf19db645635e3e7e1a26e6b00e64c70.zip
usrp: added gain element access by gain name to multi and single wrappers
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/multi_usrp.cpp34
-rw-r--r--host/lib/usrp/single_usrp.cpp34
2 files changed, 44 insertions, 24 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 027530f31..443b91594 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -35,6 +35,8 @@
using namespace uhd;
using namespace uhd::usrp;
+const std::string multi_usrp::ALL_GAINS = "";
+
/***********************************************************************
* Simple USRP Implementation
**********************************************************************/
@@ -228,16 +230,20 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp(chan/rx_cpm()));
}
- void set_rx_gain(float gain, size_t chan){
- return _rx_gain_group(chan)->set_value(gain);
+ void set_rx_gain(float gain, const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_rx_gain(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_value(name);
}
- float get_rx_gain(size_t chan){
- return _rx_gain_group(chan)->get_value();
+ gain_range_t get_rx_gain_range(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_range(name);
}
- gain_range_t get_rx_gain_range(size_t chan){
- return _rx_gain_group(chan)->get_range();
+ std::vector<std::string> get_rx_gain_names(size_t chan){
+ return _rx_gain_group(chan)->get_names();
}
void set_rx_antenna(const std::string &ant, size_t chan){
@@ -328,16 +334,20 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp(chan/tx_cpm()));
}
- void set_tx_gain(float gain, size_t chan){
- return _tx_gain_group(chan)->set_value(gain);
+ void set_tx_gain(float gain, const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_tx_gain(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_value(name);
}
- float get_tx_gain(size_t chan){
- return _tx_gain_group(chan)->get_value();
+ gain_range_t get_tx_gain_range(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_range(name);
}
- gain_range_t get_tx_gain_range(size_t chan){
- return _tx_gain_group(chan)->get_range();
+ std::vector<std::string> get_tx_gain_names(size_t chan){
+ return _tx_gain_group(chan)->get_names();
}
void set_tx_antenna(const std::string &ant, size_t chan){
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index 2faa1280c..5e57849b8 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -33,6 +33,8 @@
using namespace uhd;
using namespace uhd::usrp;
+const std::string single_usrp::ALL_GAINS = "";
+
/***********************************************************************
* Simple USRP Implementation
**********************************************************************/
@@ -164,16 +166,20 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp());
}
- void set_rx_gain(float gain, size_t chan){
- return _rx_gain_group(chan)->set_value(gain);
+ void set_rx_gain(float gain, const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_rx_gain(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_value(name);
}
- float get_rx_gain(size_t chan){
- return _rx_gain_group(chan)->get_value();
+ gain_range_t get_rx_gain_range(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_range(name);
}
- gain_range_t get_rx_gain_range(size_t chan){
- return _rx_gain_group(chan)->get_range();
+ std::vector<std::string> get_rx_gain_names(size_t chan){
+ return _rx_gain_group(chan)->get_names();
}
void set_rx_antenna(const std::string &ant, size_t chan){
@@ -252,16 +258,20 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp());
}
- void set_tx_gain(float gain, size_t chan){
- return _tx_gain_group(chan)->set_value(gain);
+ void set_tx_gain(float gain, const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_tx_gain(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_value(name);
}
- float get_tx_gain(size_t chan){
- return _tx_gain_group(chan)->get_value();
+ gain_range_t get_tx_gain_range(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_range(name);
}
- gain_range_t get_tx_gain_range(size_t chan){
- return _tx_gain_group(chan)->get_range();
+ std::vector<std::string> get_tx_gain_names(size_t chan){
+ return _tx_gain_group(chan)->get_names();
}
void set_tx_antenna(const std::string &ant, size_t chan){