UHD  003.005.003-781-g91040b6f
include/uhd/stream.hpp
Go to the documentation of this file.
00001 //
00002 // Copyright 2011-2013 Ettus Research LLC
00003 //
00004 // This program is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef INCLUDED_UHD_STREAM_HPP
00019 #define INCLUDED_UHD_STREAM_HPP
00020 
00021 #include <uhd/config.hpp>
00022 #include <uhd/types/metadata.hpp>
00023 #include <uhd/types/device_addr.hpp>
00024 #include <uhd/types/stream_cmd.hpp>
00025 #include <uhd/types/ref_vector.hpp>
00026 #include <boost/utility.hpp>
00027 #include <boost/shared_ptr.hpp>
00028 #include <vector>
00029 #include <string>
00030 
00031 namespace uhd{
00032 
00040 struct UHD_API stream_args_t{
00041 
00043     stream_args_t(
00044         const std::string &cpu = "",
00045         const std::string &otw = ""
00046     ){
00047         cpu_format = cpu;
00048         otw_format = otw;
00049     }
00050 
00065     std::string cpu_format;
00066 
00077     std::string otw_format;
00078 
00108     device_addr_t args;
00109 
00116     std::vector<size_t> channels;
00117 };
00118 
00124 class UHD_API rx_streamer : boost::noncopyable{
00125 public:
00126     typedef boost::shared_ptr<rx_streamer> sptr;
00127 
00128     virtual ~rx_streamer(void);
00129 
00131     virtual size_t get_num_channels(void) const = 0;
00132 
00134     virtual size_t get_max_num_samps(void) const = 0;
00135 
00137     typedef ref_vector<void *> buffs_type;
00138 
00169     virtual size_t recv(
00170         const buffs_type &buffs,
00171         const size_t nsamps_per_buff,
00172         rx_metadata_t &metadata,
00173         const double timeout = 0.1,
00174         const bool one_packet = false
00175     ) = 0;
00176 
00188     virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0;
00189 };
00190 
00196 class UHD_API tx_streamer : boost::noncopyable{
00197 public:
00198     typedef boost::shared_ptr<tx_streamer> sptr;
00199 
00200     virtual ~tx_streamer(void);
00201 
00203     virtual size_t get_num_channels(void) const = 0;
00204 
00206     virtual size_t get_max_num_samps(void) const = 0;
00207 
00209     typedef ref_vector<const void *> buffs_type;
00210 
00232     virtual size_t send(
00233         const buffs_type &buffs,
00234         const size_t nsamps_per_buff,
00235         const tx_metadata_t &metadata,
00236         const double timeout = 0.1
00237     ) = 0;
00238 
00245     virtual bool recv_async_msg(
00246         async_metadata_t &async_metadata, double timeout = 0.1
00247     ) = 0;
00248 };
00249 
00250 } //namespace uhd
00251 
00252 #endif /* INCLUDED_UHD_STREAM_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines