diff options
| -rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 46 | ||||
| -rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 24 | 
2 files changed, 70 insertions, 0 deletions
| 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 <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> @@ -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<std::string> 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<std::string> 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<std::string> 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<prop_names_t>().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<sensor_value_t>(); +    } + +    std::vector<std::string> get_mboard_sensor_names(size_t mboard){ +        return _mboard(mboard)[MBOARD_PROP_SENSOR_NAMES].as<prop_names_t>(); +    } +      /*******************************************************************       * RX methods       ******************************************************************/ @@ -312,6 +320,14 @@ public:          return _rx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();      } +    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<sensor_value_t>(); +    } + +    std::vector<std::string> get_rx_sensor_names(size_t chan){ +        return _rx_subdev(chan)[SUBDEV_PROP_SENSOR_NAMES].as<prop_names_t>(); +    } +      /*******************************************************************       * TX methods       ******************************************************************/ @@ -406,6 +422,14 @@ public:          return _tx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();      } +    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<sensor_value_t>(); +    } + +    std::vector<std::string> get_tx_sensor_names(size_t chan){ +        return _tx_subdev(chan)[SUBDEV_PROP_SENSOR_NAMES].as<prop_names_t>(); +    } +  private:      device::sptr _dev; | 
