USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-gdca39145
UHD and USRP Manual
device.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011,2014 Ettus Research LLC
3 //
4 // SPDX-License-Identifier: GPL-3.0
5 //
6 
7 #ifndef INCLUDED_UHD_DEVICE_HPP
8 #define INCLUDED_UHD_DEVICE_HPP
9 
10 #include <uhd/config.hpp>
11 #include <uhd/stream.hpp>
12 #include <uhd/deprecated.hpp>
13 #include <uhd/property_tree.hpp>
15 #include <boost/utility.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/function.hpp>
18 
19 namespace uhd{
20 
21 class property_tree; //forward declaration
22 
27 class UHD_API device : boost::noncopyable{
28 
29 public:
30  typedef boost::shared_ptr<device> sptr;
31  typedef boost::function<device_addrs_t(const device_addr_t &)> find_t;
32  typedef boost::function<sptr(const device_addr_t &)> make_t;
33 
36  ANY,
38  CLOCK
39  };
40  virtual ~device(void) = 0;
41 
49  static void register_device(
50  const find_t &find,
51  const make_t &make,
52  const device_filter_t filter
53  );
54 
65  static device_addrs_t find(const device_addr_t &hint, device_filter_t filter = ANY);
66 
81  static sptr make(const device_addr_t &hint, device_filter_t filter = ANY, size_t which = 0);
82 
88  virtual rx_streamer::sptr get_rx_stream(const stream_args_t &args) = 0;
89 
95  virtual tx_streamer::sptr get_tx_stream(const stream_args_t &args) = 0;
96 
103  virtual bool recv_async_msg(
104  async_metadata_t &async_metadata, double timeout = 0.1
105  ) = 0;
106 
108  uhd::property_tree::sptr get_tree(void) const;
109 
111  device_filter_t get_device_type() const;
112 
113 protected:
116 };
117 
118 } //namespace uhd
119 
120 #endif /* INCLUDED_UHD_DEVICE_HPP */
boost::shared_ptr< device > sptr
Definition: device.hpp:30
Definition: device.hpp:36
boost::shared_ptr< property_tree > sptr
Definition: property_tree.hpp:209
boost::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:160
Definition: build_info.hpp:14
device_filter_t
Device type, used as a filter in make.
Definition: device.hpp:35
std::vector< device_addr_t > device_addrs_t
A typedef for a vector of device addresses.
Definition: device_addr.hpp:77
uhd::property_tree::sptr _tree
Definition: device.hpp:114
boost::function< sptr(const device_addr_t &)> make_t
Definition: device.hpp:32
Definition: stream.hpp:46
#define UHD_API
Definition: config.h:62
Definition: metadata.hpp:158
Definition: device.hpp:27
boost::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:236
device_filter_t _type
Definition: device.hpp:115
Definition: device.hpp:37
boost::function< device_addrs_t(const device_addr_t &)> find_t
Definition: device.hpp:31
Definition: device_addr.hpp:36