From e4b45cca1b99d92baab061d36b6c0ceaebdfe5b7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 11 Feb 2011 18:07:24 -0800 Subject: usrp: added get sensors api to multi usrp for rx/tx subdevs and mboard --- host/include/uhd/usrp/multi_usrp.hpp | 46 ++++++++++++++++++++++++++++++++++++ host/lib/usrp/multi_usrp.cpp | 24 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 60b757f50..28c1860d6 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -231,6 +232,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 get_mboard_sensor_names(size_t mboard = 0) = 0; + /******************************************************************* * RX methods ******************************************************************/ @@ -410,6 +426,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 get_rx_sensor_names(size_t chan = 0) = 0; + /******************************************************************* * TX methods ******************************************************************/ @@ -580,6 +611,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 get_tx_sensor_names(size_t chan = 0) = 0; }; }} diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 4bdb2bf2e..e4e70b594 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -214,6 +214,14 @@ public: return (*_dev)[DEVICE_PROP_MBOARD_NAMES].as().size(); } + sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard){ + return _mboard(mboard)[named_prop_t(MBOARD_PROP_SENSOR, name)].as(); + } + + std::vector get_mboard_sensor_names(size_t mboard){ + return _mboard(mboard)[MBOARD_PROP_SENSOR_NAMES].as(); + } + /******************************************************************* * RX methods ******************************************************************/ @@ -312,6 +320,14 @@ public: return _rx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as(); } + sensor_value_t get_rx_sensor(const std::string &name, size_t chan){ + return _rx_subdev(chan)[named_prop_t(SUBDEV_PROP_SENSOR, name)].as(); + } + + std::vector get_rx_sensor_names(size_t chan){ + return _rx_subdev(chan)[SUBDEV_PROP_SENSOR_NAMES].as(); + } + /******************************************************************* * TX methods ******************************************************************/ @@ -406,6 +422,14 @@ public: return _tx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as(); } + sensor_value_t get_tx_sensor(const std::string &name, size_t chan){ + return _tx_subdev(chan)[named_prop_t(SUBDEV_PROP_SENSOR, name)].as(); + } + + std::vector get_tx_sensor_names(size_t chan){ + return _tx_subdev(chan)[SUBDEV_PROP_SENSOR_NAMES].as(); + } + private: device::sptr _dev; -- cgit v1.2.3