diff options
author | Josh Blum <josh@joshknows.com> | 2010-02-18 17:48:14 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-02-18 17:48:14 -0800 |
commit | 6fdaccea1fba15b754945d9be7da0ed4a3861633 (patch) | |
tree | a5822f02409cc2d69f0566b4ea6e787b0d8ca43d /host/include | |
parent | b4e5df4080b276ff1bf7cf896bd60630cdaab652 (diff) | |
download | uhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.tar.gz uhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.tar.bz2 uhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.zip |
Added special case for empty dboard slot (none id 0xffff)
Added error handling in the dboard base classes for mishandling the none id.
Added better to string function for the dboard ids.
Added get methods for dboard classes to get their ids.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/usrp/dboard/base.hpp | 6 | ||||
-rw-r--r-- | host/include/uhd/usrp/dboard/id.hpp | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/host/include/uhd/usrp/dboard/base.hpp b/host/include/uhd/usrp/dboard/base.hpp index 845e2f669..111820a8b 100644 --- a/host/include/uhd/usrp/dboard/base.hpp +++ b/host/include/uhd/usrp/dboard/base.hpp @@ -22,6 +22,7 @@ #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <boost/tuple/tuple.hpp> +#include <uhd/usrp/dboard/id.hpp> #include <uhd/usrp/dboard/interface.hpp> namespace uhd{ namespace usrp{ namespace dboard{ @@ -36,7 +37,7 @@ public: //the constructor args consist of a subdev name and an interface //derived classes should pass the args into the base class ctor //but should not have to deal with the internals of the args - typedef boost::tuple<std::string, interface::sptr> ctor_args_t; + typedef boost::tuple<std::string, interface::sptr, dboard_id_t, dboard_id_t> ctor_args_t; //structors base(ctor_args_t const&); @@ -51,10 +52,13 @@ public: protected: std::string get_subdev_name(void); interface::sptr get_interface(void); + dboard_id_t get_rx_id(void); + dboard_id_t get_tx_id(void); private: std::string _subdev_name; interface::sptr _dboard_interface; + dboard_id_t _rx_id, _tx_id; }; /*! diff --git a/host/include/uhd/usrp/dboard/id.hpp b/host/include/uhd/usrp/dboard/id.hpp index 98c0acc3a..a890ee096 100644 --- a/host/include/uhd/usrp/dboard/id.hpp +++ b/host/include/uhd/usrp/dboard/id.hpp @@ -15,7 +15,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <iostream> +#include <string> #ifndef INCLUDED_UHD_USRP_DBOARD_ID_HPP #define INCLUDED_UHD_USRP_DBOARD_ID_HPP @@ -28,8 +28,10 @@ enum dboard_id_t{ ID_BASIC_RX = 0x0001 }; -}}} //namespace +struct id{ + static std::string to_string(const dboard_id_t &id); +}; -std::ostream& operator<<(std::ostream &, const uhd::usrp::dboard::dboard_id_t &); +}}} //namespace #endif /* INCLUDED_UHD_USRP_DBOARD_ID_HPP */ |