USRP Hardware Driver and USRP Manual  Version: 4.1.0.4-3
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 #pragma once
9 
10 #include <uhd/config.hpp>
12 #include <uhd/types/metadata.hpp>
13 #include <uhd/types/ref_vector.hpp>
14 #include <uhd/types/stream_cmd.hpp>
16 #include <boost/utility.hpp>
17 #include <memory>
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 
170 {
171 public:
172  typedef std::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 
222  virtual size_t recv(const buffs_type& buffs,
223  const size_t nsamps_per_buff,
224  rx_metadata_t& metadata,
225  const double timeout = 0.1,
226  const bool one_packet = false) = 0;
227 
239  virtual void issue_stream_cmd(const stream_cmd_t& stream_cmd) = 0;
240 };
241 
248 {
249 public:
250  typedef std::shared_ptr<tx_streamer> sptr;
251 
252  virtual ~tx_streamer(void);
253 
255  virtual size_t get_num_channels(void) const = 0;
256 
258  virtual size_t get_max_num_samps(void) const = 0;
259 
262 
291  virtual size_t send(const buffs_type& buffs,
292  const size_t nsamps_per_buff,
293  const tx_metadata_t& metadata,
294  const double timeout = 0.1) = 0;
295 
302  virtual bool recv_async_msg(
303  async_metadata_t& async_metadata, double timeout = 0.1) = 0;
304 };
305 
306 } // namespace uhd
Definition: device_addr.hpp:38
Definition: ref_vector.hpp:22
Definition: stream.hpp:170
ref_vector< void * > buffs_type
Typedef for a pointer to a single, or a collection of recv buffers.
Definition: stream.hpp:183
std::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:172
virtual ~rx_streamer(void)
virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd)=0
virtual size_t get_num_channels(void) const =0
Get the number of channels associated with this streamer.
virtual size_t get_max_num_samps(void) const =0
Get the max number of samples per buffer per packet.
virtual size_t recv(const buffs_type &buffs, const size_t nsamps_per_buff, rx_metadata_t &metadata, const double timeout=0.1, const bool one_packet=false)=0
Definition: stream.hpp:248
virtual ~tx_streamer(void)
virtual bool recv_async_msg(async_metadata_t &async_metadata, double timeout=0.1)=0
std::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:250
ref_vector< const void * > buffs_type
Typedef for a pointer to a single, or a collection of send buffers.
Definition: stream.hpp:261
virtual size_t get_max_num_samps(void) const =0
Get the max number of samples per buffer per packet.
virtual size_t send(const buffs_type &buffs, const size_t nsamps_per_buff, const tx_metadata_t &metadata, const double timeout=0.1)=0
virtual size_t get_num_channels(void) const =0
Get the number of channels associated with this streamer.
#define UHD_API
Definition: config.h:70
Definition: build_info.hpp:12
boost::noncopyable noncopyable
Definition: noncopyable.hpp:45
Definition: metadata.hpp:203
Definition: metadata.hpp:23
Definition: stream.hpp:59
std::string otw_format
Definition: stream.hpp:103
device_addr_t args
Definition: stream.hpp:140
std::string cpu_format
Definition: stream.hpp:83
stream_args_t(const std::string &cpu="", const std::string &otw="")
Convenience constructor for streamer args.
Definition: stream.hpp:61
std::vector< size_t > channels
Definition: stream.hpp:161
Definition: stream_cmd.hpp:40
Definition: metadata.hpp:163