UHD  003.002.000
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
device.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 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/config.hpp>
23 #include <uhd/types/metadata.hpp>
24 #include <uhd/types/io_type.hpp>
25 #include <uhd/types/ref_vector.hpp>
26 #include <uhd/wax.hpp>
27 #include <boost/utility.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/function.hpp>
30 
31 namespace uhd{
32 
33 class property_tree; //forward declaration
34 
39 class UHD_API device : boost::noncopyable, public wax::obj{
40 
41 public:
42  typedef boost::shared_ptr<device> sptr;
43  typedef boost::function<device_addrs_t(const device_addr_t &)> find_t;
44  typedef boost::function<sptr(const device_addr_t &)> make_t;
45 
52  static void register_device(
53  const find_t &find,
54  const make_t &make
55  );
56 
66  static device_addrs_t find(const device_addr_t &hint);
67 
79  static sptr make(const device_addr_t &hint, size_t which = 0);
80 
86  SEND_MODE_FULL_BUFF = 0,
88  SEND_MODE_ONE_PACKET = 1
89  };
90 
96  RECV_MODE_FULL_BUFF = 0,
98  RECV_MODE_ONE_PACKET = 1
99  };
100 
103 
106 
131  virtual size_t send(
132  const send_buffs_type &buffs,
133  size_t nsamps_per_buff,
134  const tx_metadata_t &metadata,
135  const io_type_t &io_type,
136  send_mode_t send_mode,
137  double timeout = 0.1
138  ) = 0;
139 
171  virtual size_t recv(
172  const recv_buffs_type &buffs,
173  size_t nsamps_per_buff,
174  rx_metadata_t &metadata,
175  const io_type_t &io_type,
176  recv_mode_t recv_mode,
177  double timeout = 0.1
178  ) = 0;
179 
184  virtual size_t get_max_send_samps_per_packet(void) const = 0;
185 
190  virtual size_t get_max_recv_samps_per_packet(void) const = 0;
191 
198  virtual bool recv_async_msg(
199  async_metadata_t &async_metadata, double timeout = 0.1
200  ) = 0;
201 
203  virtual boost::shared_ptr<property_tree> get_tree(void) const = 0;
204 
205 };
206 
207 } //namespace uhd
208 
209 #endif /* INCLUDED_UHD_DEVICE_HPP */
send_mode_t
Definition: device.hpp:84
recv_mode_t
Definition: device.hpp:94
boost::shared_ptr< device > sptr
Definition: device.hpp:42
Definition: metadata.hpp:31
Definition: metadata.hpp:96
#define UHD_API
Definition: config.hpp:76
Definition: convert.hpp:28
Definition: ref_vector.hpp:30
ref_vector< void * > recv_buffs_type
Typedef for a pointer to a single, or a collection of recv buffers.
Definition: device.hpp:105
Definition: wax.hpp:64
std::vector< device_addr_t > device_addrs_t
A typedef for a vector of device addresses.
Definition: device_addr.hpp:88
boost::function< sptr(const device_addr_t &)> make_t
Definition: device.hpp:44
ref_vector< const void * > send_buffs_type
Typedef for a pointer to a single, or a collection of send buffers.
Definition: device.hpp:102
Definition: metadata.hpp:123
Definition: io_type.hpp:29
Definition: device.hpp:39
boost::function< device_addrs_t(const device_addr_t &)> find_t
Definition: device.hpp:43
Definition: device_addr.hpp:47