USRP Hardware Driver and USRP Manual  Version: 3.13.0.HEAD-0-gf114cfa0
UHD and USRP Manual
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 #ifndef INCLUDED_UHD_DEVICE_HPP
9 #define INCLUDED_UHD_DEVICE_HPP
10 
11 #include <uhd/config.hpp>
12 #include <uhd/stream.hpp>
13 #include <uhd/deprecated.hpp>
14 #include <uhd/property_tree.hpp>
16 #include <boost/utility.hpp>
17 #include <boost/shared_ptr.hpp>
18 #include <boost/function.hpp>
19 
20 namespace uhd{
21 
22 class property_tree; //forward declaration
23 
28 class UHD_API device : boost::noncopyable{
29 
30 public:
31  typedef boost::shared_ptr<device> sptr;
32  typedef boost::function<device_addrs_t(const device_addr_t &)> find_t;
33  typedef boost::function<sptr(const device_addr_t &)> make_t;
34 
37  ANY,
39  CLOCK
40  };
41  virtual ~device(void) = 0;
42 
50  static void register_device(
51  const find_t &find,
52  const make_t &make,
53  const device_filter_t filter
54  );
55 
66  static device_addrs_t find(const device_addr_t &hint, device_filter_t filter = ANY);
67 
82  static sptr make(const device_addr_t &hint, device_filter_t filter = ANY, size_t which = 0);
83 
89  virtual rx_streamer::sptr get_rx_stream(const stream_args_t &args) = 0;
90 
96  virtual tx_streamer::sptr get_tx_stream(const stream_args_t &args) = 0;
97 
104  virtual bool recv_async_msg(
105  async_metadata_t &async_metadata, double timeout = 0.1
106  ) = 0;
107 
109  uhd::property_tree::sptr get_tree(void) const;
110 
112  device_filter_t get_device_type() const;
113 
114 protected:
117 };
118 
119 } //namespace uhd
120 
121 #endif /* INCLUDED_UHD_DEVICE_HPP */
boost::shared_ptr< device > sptr
Definition: device.hpp:31
Definition: device.hpp:37
boost::shared_ptr< property_tree > sptr
Definition: property_tree.hpp:210
boost::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:172
Definition: build_info.hpp:14
device_filter_t
Device type, used as a filter in make.
Definition: device.hpp:36
std::vector< device_addr_t > device_addrs_t
A typedef for a vector of device addresses.
Definition: device_addr.hpp:85
uhd::property_tree::sptr _tree
Definition: device.hpp:115
boost::function< sptr(const device_addr_t &)> make_t
Definition: device.hpp:33
Definition: stream.hpp:58
#define UHD_API
Definition: config.h:63
Definition: metadata.hpp:159
Definition: device.hpp:28
boost::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:248
device_filter_t _type
Definition: device.hpp:116
Definition: device.hpp:38
boost::function< device_addrs_t(const device_addr_t &)> find_t
Definition: device.hpp:32
Definition: device_addr.hpp:38