USRP Hardware Driver and USRP Manual  Version: 003.010.001.HEAD-0-gc705922a
UHD and USRP Manual
stream.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011-2013 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_STREAM_HPP
19 #define INCLUDED_UHD_STREAM_HPP
20 
21 #include <uhd/config.hpp>
22 #include <uhd/types/metadata.hpp>
24 #include <uhd/types/stream_cmd.hpp>
25 #include <uhd/types/ref_vector.hpp>
26 #include <boost/utility.hpp>
27 #include <boost/shared_ptr.hpp>
28 #include <vector>
29 #include <string>
30 
31 namespace uhd{
32 
58 
61  const std::string &cpu = "",
62  const std::string &otw = ""
63  ){
64  cpu_format = cpu;
65  otw_format = otw;
66  }
67 
84  std::string cpu_format;
85 
104  std::string otw_format;
105 
141 
161  std::vector<size_t> channels;
162 };
163 
169 class UHD_API rx_streamer : boost::noncopyable{
170 public:
171  typedef boost::shared_ptr<rx_streamer> sptr;
172 
173  virtual ~rx_streamer(void);
174 
176  virtual size_t get_num_channels(void) const = 0;
177 
179  virtual size_t get_max_num_samps(void) const = 0;
180 
183 
218  virtual size_t recv(
219  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
224  ) = 0;
225 
237  virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0;
238 };
239 
245 class UHD_API tx_streamer : boost::noncopyable{
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(
282  const buffs_type &buffs,
283  const size_t nsamps_per_buff,
284  const tx_metadata_t &metadata,
285  const double timeout = 0.1
286  ) = 0;
287 
294  virtual bool recv_async_msg(
295  async_metadata_t &async_metadata, double timeout = 0.1
296  ) = 0;
297 };
298 
299 } //namespace uhd
300 
301 #endif /* INCLUDED_UHD_STREAM_HPP */
Definition: stream_cmd.hpp:46
Definition: stream.hpp:169
Definition: stream.hpp:245
std::vector< size_t > channels
Definition: stream.hpp:161
boost::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:171
std::string otw_format
Definition: stream.hpp:104
Definition: metadata.hpp:33
Definition: metadata.hpp:142
Definition: build_info.hpp:25
std::string cpu_format
Definition: stream.hpp:84
Definition: ref_vector.hpp:31
ref_vector< void * > buffs_type
Typedef for a pointer to a single, or a collection of recv buffers.
Definition: stream.hpp:182
stream_args_t(const std::string &cpu="", const std::string &otw="")
Convenience constructor for streamer args.
Definition: stream.hpp:60
size_t send(const send_buffs_type &buffs, size_t nsamps_per_buff, const tx_metadata_t &metadata, const io_type_t &io_type, send_mode_t send_mode, double timeout=0.1)
Definition: device_deprecated.ipp:74
device_addr_t args
Definition: stream.hpp:140
ref_vector< const void * > buffs_type
Typedef for a pointer to a single, or a collection of send buffers.
Definition: stream.hpp:258
Definition: stream.hpp:57
#define UHD_API
Definition: config.h:73
Definition: metadata.hpp:169
boost::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:247
size_t recv(const recv_buffs_type &buffs, size_t nsamps_per_buff, rx_metadata_t &metadata, const io_type_t &io_type, recv_mode_t recv_mode, double timeout=0.1)
Definition: device_deprecated.ipp:130
virtual bool recv_async_msg(async_metadata_t &async_metadata, double timeout=0.1)=0
Definition: device_addr.hpp:47