From eae0bec99bca5efa1e86faa03132ec5e8aca5fe5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 20 Apr 2010 12:05:33 -0700 Subject: Created args string contructor for device address. Using the args string for the find devices app. Added documentation to simple usrp. --- host/lib/usrp/simple_usrp.cpp | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp/simple_usrp.cpp') diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp index 11ee3a798..321d66a4a 100644 --- a/host/lib/usrp/simple_usrp.cpp +++ b/host/lib/usrp/simple_usrp.cpp @@ -42,14 +42,14 @@ public: _tx_dsp = _mboard[MBOARD_PROP_TX_DSP]; //extract rx subdevice - wax::obj rx_dboard = _mboard[MBOARD_PROP_RX_DBOARD]; - std::string rx_subdev_in_use = rx_dboard[DBOARD_PROP_USED_SUBDEVS].as().at(0); - _rx_subdev = rx_dboard[named_prop_t(DBOARD_PROP_SUBDEV, rx_subdev_in_use)]; + _rx_dboard = _mboard[MBOARD_PROP_RX_DBOARD]; + std::string rx_subdev_in_use = _rx_dboard[DBOARD_PROP_USED_SUBDEVS].as().at(0); + _rx_subdev = _rx_dboard[named_prop_t(DBOARD_PROP_SUBDEV, rx_subdev_in_use)]; //extract tx subdevice - wax::obj tx_dboard = _mboard[MBOARD_PROP_TX_DBOARD]; - std::string tx_subdev_in_use = tx_dboard[DBOARD_PROP_USED_SUBDEVS].as().at(0); - _tx_subdev = tx_dboard[named_prop_t(DBOARD_PROP_SUBDEV, tx_subdev_in_use)]; + _tx_dboard = _mboard[MBOARD_PROP_TX_DBOARD]; + std::string tx_subdev_in_use = _tx_dboard[DBOARD_PROP_USED_SUBDEVS].as().at(0); + _tx_subdev = _tx_dboard[named_prop_t(DBOARD_PROP_SUBDEV, tx_subdev_in_use)]; } ~simple_usrp_impl(void){ @@ -61,7 +61,26 @@ public: } std::string get_name(void){ - return _mboard[MBOARD_PROP_NAME].as(); + return str(boost::format( + "Simple USRP:\n" + " Device: %s\n" + " Mboard: %s\n" + " RX DSP: %s\n" + " RX Dboard: %s\n" + " RX Subdev: %s\n" + " TX DSP: %s\n" + " TX Dboard: %s\n" + " TX Subdev: %s\n" + ) + % (*_dev)[DEVICE_PROP_NAME].as() + % _mboard[MBOARD_PROP_NAME].as() + % _rx_dsp[DSP_PROP_NAME].as() + % _rx_dboard[DBOARD_PROP_NAME].as() + % _rx_subdev[SUBDEV_PROP_NAME].as() + % _tx_dsp[DSP_PROP_NAME].as() + % _tx_dboard[DBOARD_PROP_NAME].as() + % _tx_subdev[SUBDEV_PROP_NAME].as() + ); } /******************************************************************* @@ -174,6 +193,8 @@ private: wax::obj _mboard; wax::obj _rx_dsp; wax::obj _tx_dsp; + wax::obj _rx_dboard; + wax::obj _tx_dboard; wax::obj _rx_subdev; wax::obj _tx_subdev; }; @@ -181,6 +202,6 @@ private: /*********************************************************************** * The Make Function **********************************************************************/ -simple_usrp::sptr simple_usrp::make(const std::string &args){ - return sptr(new simple_usrp_impl(device_addr_t::from_args_str(args))); +simple_usrp::sptr simple_usrp::make(const device_addr_t &dev_addr){ + return sptr(new simple_usrp_impl(dev_addr)); } -- cgit v1.2.3 From a62ff5290ab931a8c57f743e54e030c07964e568 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 26 Apr 2010 18:13:09 -0700 Subject: added simple usrp api to read rssi and get LO lock status --- host/include/uhd/usrp/simple_usrp.hpp | 11 +++++++++++ host/lib/usrp/simple_usrp.cpp | 12 ++++++++++++ 2 files changed, 23 insertions(+) (limited to 'host/lib/usrp/simple_usrp.cpp') diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp index e3f181ec3..c4142b4e6 100644 --- a/host/include/uhd/usrp/simple_usrp.hpp +++ b/host/include/uhd/usrp/simple_usrp.hpp @@ -98,6 +98,13 @@ public: */ virtual void set_clock_config(const clock_config_t &clock_config) = 0; + /*! + * Read the RSSI value from a usrp device. + * Or throw if the dboard does not support an RSSI readback. + * \return the rssi in dB + */ + virtual float read_rssi(void) = 0; + /******************************************************************* * RX methods ******************************************************************/ @@ -115,6 +122,8 @@ public: virtual std::string get_rx_antenna(void) = 0; virtual std::vector get_rx_antennas(void) = 0; + virtual bool get_rx_lo_locked(void) = 0; + /******************************************************************* * TX methods ******************************************************************/ @@ -131,6 +140,8 @@ public: virtual void set_tx_antenna(const std::string &ant) = 0; virtual std::string get_tx_antenna(void) = 0; virtual std::vector get_tx_antennas(void) = 0; + + virtual bool get_tx_lo_locked(void) = 0; }; }} diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp index 321d66a4a..a8c104485 100644 --- a/host/lib/usrp/simple_usrp.cpp +++ b/host/lib/usrp/simple_usrp.cpp @@ -102,6 +102,10 @@ public: _mboard[MBOARD_PROP_CLOCK_CONFIG] = clock_config; } + float read_rssi(void){ + return _rx_subdev[SUBDEV_PROP_RSSI].as(); + } + /******************************************************************* * RX methods ******************************************************************/ @@ -145,6 +149,10 @@ public: return _rx_subdev[SUBDEV_PROP_ANTENNA_NAMES].as(); } + bool get_rx_lo_locked(void){ + return _rx_subdev[SUBDEV_PROP_LO_LOCKED].as(); + } + /******************************************************************* * TX methods ******************************************************************/ @@ -188,6 +196,10 @@ public: return _tx_subdev[SUBDEV_PROP_ANTENNA_NAMES].as(); } + bool get_tx_lo_locked(void){ + return _tx_subdev[SUBDEV_PROP_LO_LOCKED].as(); + } + private: device::sptr _dev; wax::obj _mboard; -- cgit v1.2.3