diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-12 16:01:01 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-12 16:01:01 -0800 |
commit | 2147c5f61c2eb6ef1a68419d7b1041a54cbb14a2 (patch) | |
tree | 48dbcb58924a3c547979cb4a95a5de35278aeec1 /host/include | |
parent | daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5 (diff) | |
download | uhd-2147c5f61c2eb6ef1a68419d7b1041a54cbb14a2.tar.gz uhd-2147c5f61c2eb6ef1a68419d7b1041a54cbb14a2.tar.bz2 uhd-2147c5f61c2eb6ef1a68419d7b1041a54cbb14a2.zip |
Removed freq min and max and gain min, max, and step...
replaced it with gain and freq range tuples.
This simplifies the api calls and subdev properties.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/gain_handler.hpp | 14 | ||||
-rw-r--r-- | host/include/uhd/props.hpp | 13 | ||||
-rw-r--r-- | host/include/uhd/simple_device.hpp | 14 | ||||
-rw-r--r-- | host/include/uhd/utils.hpp | 5 |
4 files changed, 17 insertions, 29 deletions
diff --git a/host/include/uhd/gain_handler.hpp b/host/include/uhd/gain_handler.hpp index fade86f53..2d3f8a3f4 100644 --- a/host/include/uhd/gain_handler.hpp +++ b/host/include/uhd/gain_handler.hpp @@ -32,13 +32,9 @@ public: /*! * A set of properties for dealing with gains. */ - struct gain_props_t{ - wax::obj gain_val_prop; - wax::obj gain_min_prop; - wax::obj gain_max_prop; - wax::obj gain_step_prop; - wax::obj gain_names_prop; - gain_props_t(void); //default constructor + struct props_t{ + wax::obj value, range, names; + props_t(void); //default constructor }; /*! @@ -47,12 +43,12 @@ public: * It is up to the caller to provide an "is_equal" function that * can tell weather two properties (in a wax obj) are equal. * \param link a link to the wax obj with properties - * \param gain_props a struct of properties keys + * \param props a struct of properties keys * \param is_equal the function that tests for equal properties */ static sptr make( const wax::obj &link, - const gain_props_t &gain_props, + const props_t &props, is_equal_t is_equal ); diff --git a/host/include/uhd/props.hpp b/host/include/uhd/props.hpp index dea2baf52..f2ba1769f 100644 --- a/host/include/uhd/props.hpp +++ b/host/include/uhd/props.hpp @@ -30,6 +30,12 @@ namespace uhd{ typedef float gain_t; typedef double freq_t; + //gain range tuple (min, max, step) + typedef boost::tuple<gain_t, gain_t, gain_t> gain_range_t; + + //freq range tuple (min, max) + typedef boost::tuple<freq_t, freq_t> freq_range_t; + //scalar types (have not used yet, dont uncomment until needed) //typedef int int_scalar_t; //typedef float real_scalar_t; @@ -143,13 +149,10 @@ namespace uhd{ SUBDEV_PROP_NAME, //ro, std::string SUBDEV_PROP_OTHERS, //ro, prop_names_t SUBDEV_PROP_GAIN, //rw, gain_t - SUBDEV_PROP_GAIN_MAX, //ro, gain_t - SUBDEV_PROP_GAIN_MIN, //ro, gain_t - SUBDEV_PROP_GAIN_STEP, //ro, gain_t + SUBDEV_PROP_GAIN_RANGE, //ro, gain_range_t SUBDEV_PROP_GAIN_NAMES, //ro, prop_names_t SUBDEV_PROP_FREQ, //rw, freq_t - SUBDEV_PROP_FREQ_MAX, //ro, freq_t - SUBDEV_PROP_FREQ_MIN, //ro, freq_t + SUBDEV_PROP_FREQ_RANGE, //ro, freq_range_t SUBDEV_PROP_ANTENNA, //rw, std::string SUBDEV_PROP_ANTENNA_NAMES, //ro, prop_names_t SUBDEV_PROP_ENABLED, //rw, bool diff --git a/host/include/uhd/simple_device.hpp b/host/include/uhd/simple_device.hpp index 69f13a8b5..c43155ff2 100644 --- a/host/include/uhd/simple_device.hpp +++ b/host/include/uhd/simple_device.hpp @@ -71,14 +71,11 @@ public: virtual std::vector<double> get_rx_rates(void) = 0; virtual tune_result_t set_rx_freq(double freq) = 0; - virtual double get_rx_freq_min(void) = 0; - virtual double get_rx_freq_max(void) = 0; + virtual std::vector<double> get_rx_freq_range(void) = 0; virtual void set_rx_gain(float gain) = 0; virtual float get_rx_gain(void) = 0; - virtual float get_rx_gain_min(void) = 0; - virtual float get_rx_gain_max(void) = 0; - virtual float get_rx_gain_step(void) = 0; + virtual std::vector<float> get_rx_gain_range(void) = 0; virtual void set_rx_antenna(const std::string &ant) = 0; virtual std::string get_rx_antenna(void) = 0; @@ -92,14 +89,11 @@ public: virtual std::vector<double> get_tx_rates(void) = 0; virtual tune_result_t set_tx_freq(double freq) = 0; - virtual double get_tx_freq_min(void) = 0; - virtual double get_tx_freq_max(void) = 0; + virtual std::vector<double> get_tx_freq_range(void) = 0; virtual void set_tx_gain(float gain) = 0; virtual float get_tx_gain(void) = 0; - virtual float get_tx_gain_min(void) = 0; - virtual float get_tx_gain_max(void) = 0; - virtual float get_tx_gain_step(void) = 0; + virtual std::vector<float> get_tx_gain_range(void) = 0; virtual void set_tx_antenna(const std::string &ant) = 0; virtual std::string get_tx_antenna(void) = 0; diff --git a/host/include/uhd/utils.hpp b/host/include/uhd/utils.hpp index 5d6a18b3a..2f6e4fd87 100644 --- a/host/include/uhd/utils.hpp +++ b/host/include/uhd/utils.hpp @@ -70,11 +70,6 @@ namespace std{ return has(iterable.begin(), iterable.end(), elem); } - template<class T> - T sum(const T &a, const T &b){ - return a + b; - } - template<typename T> T signum(T n){ if (n < 0) return -1; if (n > 0) return 1; |