From e3483c7451d20b7ed1d8d4865e15751f18cdef78 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 21 Jan 2010 15:30:34 -0800 Subject: Added a usrp device abstration that creates usrp mboards. Added a usrp mboard named test, its empty for now. --- include/usrp_uhd/device.hpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'include/usrp_uhd/device.hpp') diff --git a/include/usrp_uhd/device.hpp b/include/usrp_uhd/device.hpp index 9d70b9ac3..ad2d3b368 100644 --- a/include/usrp_uhd/device.hpp +++ b/include/usrp_uhd/device.hpp @@ -6,11 +6,13 @@ #define INCLUDED_USRP_UHD_DEVICE_HPP #include +#include #include +#include #include #include #include -#include +#include namespace usrp_uhd{ @@ -18,11 +20,14 @@ namespace usrp_uhd{ * The usrp device interface represents the usrp hardware. * The api allows for discovery, configuration, and streaming. */ -class device{ +class device : boost::noncopyable, public wax::obj{ public: typedef boost::shared_ptr sptr; - typedef boost::function recv_hdlr_t; + + //argument types for send and recv raw methods + typedef std::vector send_args_t; + typedef boost::function recv_args_t; /*! * \brief Discover usrp devices attached to the host. @@ -33,7 +38,7 @@ public: * \param hint a partially (or fully) filled in device address * \return a vector of device addresses for all usrps on the system */ - static std::vector discover(const device_addr_t& hint); + static std::vector discover(const device_addr_t & hint); /*! * \brief Create a new usrp device from the device address hint. @@ -46,27 +51,31 @@ public: * \param which which address to use when multiple are discovered * \return a shared pointer to a new device instance */ - static sptr make(const device_addr_t& hint, size_t which = 0); + static sptr make(const device_addr_t & hint, size_t which = 0); + + /*! + * Constructor: Called in derived classes. + */ + device(void); /*! * Deconstructor: called automatically by the shared pointer. */ - ~device(void); + virtual ~device(void); + + /*! + * Get the device address for this board. + */ + device_addr_t get_device_addr(void); //the io interface - void send_raw(const std::vector &iovs); - void recv_raw(const recv_hdlr_t &recv_hdlr); + virtual void send_raw(const send_args_t &) = 0; + virtual void recv_raw(const recv_args_t &) = 0; //connect dsps and subdevs void connect(const wax::type &src, const wax::type &sink); - //the properties interface - wax::proxy props(void); - private: - device(const device_addr_t& hint); - - wax::type d_mboard; }; } //namespace usrp_uhd -- cgit v1.2.3