aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-17 18:55:13 -0800
committerJosh Blum <josh@joshknows.com>2011-02-17 18:55:13 -0800
commitdd75aa585afb9e59fcbb61507ad1a44fa4a00d38 (patch)
treebe25749e4aac04e7832375254440e70f41ff7511 /host/include
parent1628434a32321f8af6355f5eb828e8b06da52b90 (diff)
parent4613f454c781d258d6d9b210ff1b9043a2125981 (diff)
downloaduhd-dd75aa585afb9e59fcbb61507ad1a44fa4a00d38.tar.gz
uhd-dd75aa585afb9e59fcbb61507ad1a44fa4a00d38.tar.bz2
uhd-dd75aa585afb9e59fcbb61507ad1a44fa4a00d38.zip
Merge branch 'sensors' into usrp2_dual_dsp
Conflicts: host/include/uhd/usrp/dsp_props.hpp host/include/uhd/usrp/mboard_props.hpp
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/types/sensors.hpp19
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp58
2 files changed, 66 insertions, 11 deletions
diff --git a/host/include/uhd/types/sensors.hpp b/host/include/uhd/types/sensors.hpp
index 6f003bb40..b6215367f 100644
--- a/host/include/uhd/types/sensors.hpp
+++ b/host/include/uhd/types/sensors.hpp
@@ -37,12 +37,6 @@ namespace uhd{
*/
struct UHD_API sensor_value_t{
- //! typedef for the signed integer type
- typedef signed int_type;
-
- //! typedef for the real number type
- typedef double real_type;
-
/*!
* Create a sensor value from a boolean.
* \param name the name of the sensor
@@ -66,7 +60,7 @@ namespace uhd{
*/
sensor_value_t(
const std::string &name,
- int_type value,
+ signed value,
const std::string &unit,
const std::string &formatter = "%d"
);
@@ -80,7 +74,7 @@ namespace uhd{
*/
sensor_value_t(
const std::string &name,
- real_type value,
+ double value,
const std::string &unit,
const std::string &formatter = "%f"
);
@@ -97,6 +91,15 @@ namespace uhd{
const std::string &unit
);
+ //! convert the sensor value to a boolean
+ bool to_bool(void) const;
+
+ //! convert the sensor value to an integer
+ signed to_int(void) const;
+
+ //! convert the sensor value to real number
+ double to_real(void) const;
+
//! The name of the sensor value
const std::string name;
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 9215652a6..e2b26f5fb 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -25,6 +25,7 @@
#include <uhd/types/clock_config.hpp>
#include <uhd/types/tune_request.hpp>
#include <uhd/types/tune_result.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_iface.hpp>
#include <boost/shared_ptr.hpp>
@@ -235,6 +236,21 @@ public:
*/
virtual size_t get_num_mboards(void) = 0;
+ /*!
+ * Get a motherboard sensor value.
+ * \param name the name of the sensor
+ * \param mboard the motherboard index 0 to M-1
+ * \return a sensor value object
+ */
+ virtual sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0;
+
+ /*!
+ * Get a list of possible motherboard sensor names.
+ * \param mboard the motherboard index 0 to M-1
+ * \return a vector of sensor names
+ */
+ virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
+
/*******************************************************************
* RX methods
******************************************************************/
@@ -383,7 +399,9 @@ public:
* \param chan the channel index 0 to N-1
* \return true for locked
*/
- virtual bool get_rx_lo_locked(size_t chan = 0) = 0;
+ UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){
+ return this->get_rx_sensor("lo_locked", chan).to_bool();
+ }
/*!
* Set the RX bandwidth on the subdevice.
@@ -405,7 +423,9 @@ public:
* \return the rssi in dB
* \throw exception if RSSI readback not supported
*/
- virtual double read_rssi(size_t chan = 0) = 0;
+ UHD_DEPRECATED double read_rssi(size_t chan = 0){
+ return this->get_rx_sensor("rssi", chan).to_real();
+ }
/*!
* Get the dboard interface object for the RX subdevice.
@@ -416,6 +436,21 @@ public:
*/
virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
+ /*!
+ * Get an RX subdevice sensor value.
+ * \param name the name of the sensor
+ * \param chan the channel index 0 to N-1
+ * \return a sensor value object
+ */
+ virtual sensor_value_t get_rx_sensor(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
+ * Get a list of possible RX subdevice sensor names.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of sensor names
+ */
+ virtual std::vector<std::string> get_rx_sensor_names(size_t chan = 0) = 0;
+
/*******************************************************************
* TX methods
******************************************************************/
@@ -564,7 +599,9 @@ public:
* \param chan the channel index 0 to N-1
* \return true for locked
*/
- virtual bool get_tx_lo_locked(size_t chan = 0) = 0;
+ UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){
+ return this->get_tx_sensor("lo_locked", chan).to_bool();
+ }
/*!
* Set the TX bandwidth on the subdevice.
@@ -588,6 +625,21 @@ public:
* \return the dboard interface sptr
*/
virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
+
+ /*!
+ * Get an TX subdevice sensor value.
+ * \param name the name of the sensor
+ * \param chan the channel index 0 to N-1
+ * \return a sensor value object
+ */
+ virtual sensor_value_t get_tx_sensor(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
+ * Get a list of possible TX subdevice sensor names.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of sensor names
+ */
+ virtual std::vector<std::string> get_tx_sensor_names(size_t chan = 0) = 0;
};
}}