diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/types/sensors.hpp | 19 | ||||
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 7 |
2 files changed, 14 insertions, 12 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 da52e6dce..3c8dd5fac 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -28,7 +28,6 @@ #include <uhd/types/sensors.hpp> #include <uhd/usrp/subdev_spec.hpp> #include <uhd/usrp/dboard_iface.hpp> -#include <boost/lexical_cast.hpp> //needed until deprecated routines removed #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include <vector> @@ -395,7 +394,7 @@ public: * \return true for locked */ UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){ - return this->get_rx_sensor("lo_locked", chan).value == "true"; + return this->get_rx_sensor("lo_locked", chan).to_bool(); } /*! @@ -419,7 +418,7 @@ public: * \throw exception if RSSI readback not supported */ UHD_DEPRECATED double read_rssi(size_t chan = 0){ - return boost::lexical_cast<double>(this->get_rx_sensor("rssi", chan).value); + return this->get_rx_sensor("rssi", chan).to_real(); } /*! @@ -593,7 +592,7 @@ public: * \return true for locked */ UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){ - return this->get_tx_sensor("lo_locked", chan).value == "true"; + return this->get_tx_sensor("lo_locked", chan).to_bool(); } /*! |