Loading...
Searching...
No Matches
device.hpp
Go to the documentation of this file.
//
// Copyright 2010-2011,2014 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/property_tree.hpp>
#include <uhd/stream.hpp>
#include <uhd/types/device_addr.hpp>
#include <uhd/utils/noncopyable.hpp>
#include <cstddef>
#include <functional>
#include <memory>
namespace uhd {
struct async_metadata_t;
class UHD_API device : uhd::noncopyable
{
public:
typedef std::shared_ptr<device> sptr;
typedef std::function<device_addrs_t(const device_addr_t&)> find_t;
typedef std::function<sptr(const device_addr_t&)> make_t;
enum device_filter_t { ANY, USRP, CLOCK };
virtual ~device(void) = 0;
static void register_device(
const find_t& find, const make_t& make, const device_filter_t filter);
static device_addrs_t find(const device_addr_t& hint, device_filter_t filter = ANY);
static sptr make(
const device_addr_t& hint, device_filter_t filter = ANY, size_t which = 0);
virtual rx_streamer::sptr get_rx_stream(const stream_args_t& args) = 0;
virtual tx_streamer::sptr get_tx_stream(const stream_args_t& args) = 0;
virtual bool recv_async_msg(
async_metadata_t& async_metadata, double timeout = 0.1) = 0;
uhd::property_tree::sptr get_tree(void) const;
device_filter_t get_device_type() const;
protected:
uhd::property_tree::sptr _tree;
device_filter_t _type;
};
} // namespace uhd
uhd::device_addr_t
Definition device_addr.hpp:39
uhd::device
Definition device.hpp:27
uhd::device::_type
device_filter_t _type
Definition device.hpp:119
uhd::device::get_rx_stream
virtual rx_streamer::sptr get_rx_stream(const stream_args_t &args)=0
Make a new receive streamer from the streamer arguments.
uhd::device::recv_async_msg
virtual bool recv_async_msg(async_metadata_t &async_metadata, double timeout=0.1)=0
uhd::device::find
static device_addrs_t find(const device_addr_t &hint, device_filter_t filter=ANY)
Find devices attached to the host.
uhd::device::find_t
std::function< device_addrs_t(const device_addr_t &)> find_t
Definition device.hpp:30
uhd::device::get_tree
uhd::property_tree::sptr get_tree(void) const
Get access to the underlying property structure.
uhd::device::_tree
uhd::property_tree::sptr _tree
Definition device.hpp:118
uhd::device::get_tx_stream
virtual tx_streamer::sptr get_tx_stream(const stream_args_t &args)=0
Make a new transmit streamer from the streamer arguments.
uhd::device::sptr
std::shared_ptr< device > sptr
Definition device.hpp:29
uhd::device::make
static sptr make(const device_addr_t &hint, device_filter_t filter=ANY, size_t which=0)
Create a new device from the device address hint.
uhd::device::~device
virtual ~device(void)=0
uhd::device::register_device
static void register_device(const find_t &find, const make_t &make, const device_filter_t filter)
uhd::device::make_t
std::function< sptr(const device_addr_t &)> make_t
Definition device.hpp:31
uhd::device::device_filter_t
device_filter_t
Device type, used as a filter in make.
Definition device.hpp:34
uhd::device::CLOCK
@ CLOCK
Definition device.hpp:34
uhd::device::USRP
@ USRP
Definition device.hpp:34
uhd::device::ANY
@ ANY
Definition device.hpp:34
uhd::device::get_device_type
device_filter_t get_device_type() const
Get device type.
uhd::property_tree::sptr
std::shared_ptr< property_tree > sptr
Definition property_tree.hpp:224
uhd::rx_streamer::sptr
std::shared_ptr< rx_streamer > sptr
Definition stream.hpp:172
uhd::tx_streamer::sptr
std::shared_ptr< tx_streamer > sptr
Definition stream.hpp:325
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
device_addr.hpp
uhd
Definition build_info.hpp:12
uhd::noncopyable
boost::noncopyable noncopyable
Definition noncopyable.hpp:45
uhd::device_addrs_t
std::vector< device_addr_t > device_addrs_t
A typedef for a vector of device addresses.
Definition device_addr.hpp:94
noncopyable.hpp
property_tree.hpp
stream.hpp
uhd::async_metadata_t
Definition metadata.hpp:203
uhd::stream_args_t
Definition stream.hpp:51