root / host / include / uhd / device.hpp @ 5715b2c4
History | View | Annotate | Download (3.27 KB)
| 1 |
//
|
|---|---|
| 2 |
// Copyright 2010 Ettus Research LLC
|
| 3 |
//
|
| 4 |
// This program is free software: you can redistribute it and/or modify
|
| 5 |
// it under the terms of the GNU General Public License as published by
|
| 6 |
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
// (at your option) any later version.
|
| 8 |
//
|
| 9 |
// This program is distributed in the hope that it will be useful,
|
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
// GNU General Public License for more details.
|
| 13 |
//
|
| 14 |
// You should have received a copy of the GNU General Public License
|
| 15 |
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 16 |
//
|
| 17 |
|
| 18 |
#ifndef INCLUDED_UHD_DEVICE_HPP
|
| 19 |
#define INCLUDED_UHD_DEVICE_HPP
|
| 20 |
|
| 21 |
#include <uhd/device_addr.hpp> |
| 22 |
#include <uhd/props.hpp> |
| 23 |
#include <uhd/metadata.hpp> |
| 24 |
#include <uhd/wax.hpp> |
| 25 |
#include <boost/utility.hpp> |
| 26 |
#include <boost/shared_ptr.hpp> |
| 27 |
#include <boost/function.hpp> |
| 28 |
#include <boost/asio/buffer.hpp> |
| 29 |
|
| 30 |
namespace uhd{
|
| 31 |
|
| 32 |
/*!
|
| 33 |
* The usrp device interface represents the usrp hardware.
|
| 34 |
* The api allows for discovery, configuration, and streaming.
|
| 35 |
*/
|
| 36 |
class device : boost::noncopyable, public wax::obj{ |
| 37 |
|
| 38 |
public:
|
| 39 |
typedef boost::shared_ptr<device> sptr;
|
| 40 |
|
| 41 |
/*!
|
| 42 |
* \brief Discover usrp devices attached to the host.
|
| 43 |
*
|
| 44 |
* The hint device address should be used to narrow down the search
|
| 45 |
* to particular transport types and/or transport arguments.
|
| 46 |
*
|
| 47 |
* \param hint a partially (or fully) filled in device address
|
| 48 |
* \return a vector of device addresses for all usrps on the system
|
| 49 |
*/
|
| 50 |
static device_addrs_t discover(const device_addr_t &hint); |
| 51 |
|
| 52 |
/*!
|
| 53 |
* \brief Create a new usrp device from the device address hint.
|
| 54 |
*
|
| 55 |
* The make routine will call discover and pick one of the results.
|
| 56 |
* By default, the first result will be used to create a new device.
|
| 57 |
* Use the which parameter as an index into the list of results.
|
| 58 |
*
|
| 59 |
* \param hint a partially (or fully) filled in device address
|
| 60 |
* \param which which address to use when multiple are discovered
|
| 61 |
* \return a shared pointer to a new device instance
|
| 62 |
*/
|
| 63 |
static sptr make(const device_addr_t &hint, size_t which = 0); |
| 64 |
|
| 65 |
/*!
|
| 66 |
* Get the device address for this board.
|
| 67 |
*/
|
| 68 |
device_addr_t get_device_addr(void);
|
| 69 |
|
| 70 |
/*!
|
| 71 |
* Send a buffer containing IF data with its metadata.
|
| 72 |
*
|
| 73 |
* \param buff a buffer pointing to some read-only memory
|
| 74 |
* \param metadata data describing the buffer's contents
|
| 75 |
* \param the type of data loaded in the buffer (32fc, 16sc)
|
| 76 |
* \return the number of samples sent
|
| 77 |
*/
|
| 78 |
virtual size_t send(
|
| 79 |
const boost::asio::const_buffer &buff,
|
| 80 |
const metadata_t &metadata,
|
| 81 |
const std::string &type = "32fc" |
| 82 |
) = 0;
|
| 83 |
|
| 84 |
/*!
|
| 85 |
* Receive a buffer containing IF data and its metadata.
|
| 86 |
*
|
| 87 |
* \param buff the buffer to fill with IF data
|
| 88 |
* \param metadata data to fill describing the buffer
|
| 89 |
* \param the type of data to fill into the buffer (32fc, 16sc)
|
| 90 |
* \return the number of samples received
|
| 91 |
*/
|
| 92 |
virtual size_t recv(
|
| 93 |
const boost::asio::mutable_buffer &buff,
|
| 94 |
metadata_t &metadata, |
| 95 |
const std::string &type = "32fc" |
| 96 |
) = 0;
|
| 97 |
}; |
| 98 |
|
| 99 |
} //namespace uhd
|
| 100 |
|
| 101 |
#endif /* INCLUDED_UHD_DEVICE_HPP */ |