USRP Hardware Driver and USRP Manual: device.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.9.0.makepkg-0-g9ec1f582 UHD and USRP Manual |

Loading...
Searching...
No Matches
device.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2011,2014 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#pragma once
9
10#include <uhd/config.hpp>
11#include <uhd/property_tree.hpp>
12#include <uhd/stream.hpp>
13#include <uhd/types/device_addr.hpp>
14#include <uhd/utils/noncopyable.hpp>
15#include <cstddef>
16#include <functional>
17#include <memory>
18
19namespace uhd {
20struct async_metadata_t;
21
26 class UHD_API device : uhd::noncopyable
27{
28public:
29 typedef std::shared_ptr<device> sptr;
30 typedef std::function<device_addrs_t(const device_addr_t&)> find_t;
31 typedef std::function<sptr(const device_addr_t&)> make_t;
32
34 enum device_filter_t { ANY, USRP, CLOCK };
35 virtual ~device(void) = 0;
36
44 static void register_device(
45 const find_t& find, const make_t& make, const device_filter_t filter);
46
57 static device_addrs_t find(const device_addr_t& hint, device_filter_t filter = ANY);
58
73 static sptr make(
74 const device_addr_t& hint, device_filter_t filter = ANY, size_t which = 0);
75
85 virtual rx_streamer::sptr get_rx_stream(const stream_args_t& args) = 0;
86
96 virtual tx_streamer::sptr get_tx_stream(const stream_args_t& args) = 0;
97
108 virtual bool recv_async_msg(
109 async_metadata_t& async_metadata, double timeout = 0.1) = 0;
110
112 uhd::property_tree::sptr get_tree(void) const;
113
115 device_filter_t get_device_type() const;
116
117protected:
118 uhd::property_tree::sptr _tree;
119 device_filter_t _type;
120};
121
122} // 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