USRP Hardware Driver and USRP Manual  Version: 3.14.1.HEAD-0-gbfb9c1c7
UHD and USRP Manual
stream.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011-2013 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_STREAM_HPP
9 #define INCLUDED_UHD_STREAM_HPP
10 
11 #include <uhd/config.hpp>
13 #include <uhd/types/metadata.hpp>
14 #include <uhd/types/ref_vector.hpp>
15 #include <uhd/types/stream_cmd.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/utility.hpp>
18 #include <string>
19 #include <vector>
20 
21 namespace uhd {
22 
59 {
61  stream_args_t(const std::string& cpu = "", const std::string& otw = "")
62  {
63  cpu_format = cpu;
64  otw_format = otw;
65  }
66 
83  std::string cpu_format;
84 
103  std::string otw_format;
104 
141 
161  std::vector<size_t> channels;
162 };
163 
169 class UHD_API rx_streamer : boost::noncopyable
170 {
171 public:
172  typedef boost::shared_ptr<rx_streamer> sptr;
173 
174  virtual ~rx_streamer(void);
175 
177  virtual size_t get_num_channels(void) const = 0;
178 
180  virtual size_t get_max_num_samps(void) const = 0;
181 
184 
219  virtual size_t recv(const buffs_type& buffs,
220  const size_t nsamps_per_buff,
221  rx_metadata_t& metadata,
222  const double timeout = 0.1,
223  const bool one_packet = false) = 0;
224 
236  virtual void issue_stream_cmd(const stream_cmd_t& stream_cmd) = 0;
237 };
238 
244 class UHD_API tx_streamer : boost::noncopyable
245 {
246 public:
247  typedef boost::shared_ptr<tx_streamer> sptr;
248 
249  virtual ~tx_streamer(void);
250 
252  virtual size_t get_num_channels(void) const = 0;
253 
255  virtual size_t get_max_num_samps(void) const = 0;
256 
259 
281  virtual size_t send(const buffs_type& buffs,
282  const size_t nsamps_per_buff,
283  const tx_metadata_t& metadata,
284  const double timeout = 0.1) = 0;
285 
292  virtual bool recv_async_msg(
293  async_metadata_t& async_metadata, double timeout = 0.1) = 0;
294 };
295 
296 } // namespace uhd
297 
298 #endif /* INCLUDED_UHD_STREAM_HPP */
Definition: stream_cmd.hpp:36
Definition: stream.hpp:169
Definition: stream.hpp:244
std::vector< size_t > channels
Definition: stream.hpp:161
boost::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:172
std::string otw_format
Definition: stream.hpp:103
ref_vector< void * > buffs_type
Typedef for a pointer to a single, or a collection of recv buffers.
Definition: stream.hpp:183
Definition: metadata.hpp:23
Definition: metadata.hpp:135
Definition: build_info.hpp:13
std::string cpu_format
Definition: stream.hpp:83
Definition: ref_vector.hpp:21
stream_args_t(const std::string &cpu="", const std::string &otw="")
Convenience constructor for streamer args.
Definition: stream.hpp:61
device_addr_t args
Definition: stream.hpp:140
Definition: stream.hpp:58
#define UHD_API
Definition: config.h:68
Definition: metadata.hpp:163
boost::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:247
ref_vector< const void * > buffs_type
Typedef for a pointer to a single, or a collection of send buffers.
Definition: stream.hpp:258
Definition: device_addr.hpp:38