diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
commit | e3483c7451d20b7ed1d8d4865e15751f18cdef78 (patch) | |
tree | f309a95a1b0ecd3dc3295ebc71ee5ad697c9f7a8 /include/usrp_uhd/device.hpp | |
parent | 5b42b774d9ac1e74fb2916bf58085fe19ecb6720 (diff) | |
download | uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.gz uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.bz2 uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.zip |
Added a usrp device abstration that creates usrp mboards.
Added a usrp mboard named test, its empty for now.
Diffstat (limited to 'include/usrp_uhd/device.hpp')
-rw-r--r-- | include/usrp_uhd/device.hpp | 37 |
1 files changed, 23 insertions, 14 deletions
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 <usrp_uhd/device_addr.hpp> +#include <usrp_uhd/props.hpp> #include <usrp_uhd/wax.hpp> +#include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <boost/function.hpp> #include <vector> -#include <sys/uio.h> +#include <boost/asio/buffer.hpp> 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<device> sptr; - typedef boost::function<bool(void *data, size_t len)> recv_hdlr_t; + + //argument types for send and recv raw methods + typedef std::vector<boost::asio::const_buffer> send_args_t; + typedef boost::function<bool(const boost::asio::const_buffer &)> 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<device_addr_t> discover(const device_addr_t& hint); + static std::vector<device_addr_t> 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<iovec> &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 |