UHD 003.001.000
|
00001 // 00002 // Copyright 2010-2011 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_DEVICE_HPP 00019 #define INCLUDED_UHD_DEVICE_HPP 00020 00021 #include <uhd/config.hpp> 00022 #include <uhd/types/device_addr.hpp> 00023 #include <uhd/types/metadata.hpp> 00024 #include <uhd/types/io_type.hpp> 00025 #include <uhd/types/ref_vector.hpp> 00026 #include <uhd/wax.hpp> 00027 #include <boost/utility.hpp> 00028 #include <boost/shared_ptr.hpp> 00029 #include <boost/function.hpp> 00030 00031 namespace uhd{ 00032 00037 class UHD_API device : boost::noncopyable, public wax::obj{ 00038 00039 public: 00040 typedef boost::shared_ptr<device> sptr; 00041 typedef boost::function<device_addrs_t(const device_addr_t &)> find_t; 00042 typedef boost::function<sptr(const device_addr_t &)> make_t; 00043 00050 static void register_device( 00051 const find_t &find, 00052 const make_t &make 00053 ); 00054 00064 static device_addrs_t find(const device_addr_t &hint); 00065 00077 static sptr make(const device_addr_t &hint, size_t which = 0); 00078 00082 enum send_mode_t{ 00084 SEND_MODE_FULL_BUFF = 0, 00086 SEND_MODE_ONE_PACKET = 1 00087 }; 00088 00092 enum recv_mode_t{ 00094 RECV_MODE_FULL_BUFF = 0, 00096 RECV_MODE_ONE_PACKET = 1 00097 }; 00098 00100 typedef ref_vector<const void *> send_buffs_type; 00101 00103 typedef ref_vector<void *> recv_buffs_type; 00104 00129 virtual size_t send( 00130 const send_buffs_type &buffs, 00131 size_t nsamps_per_buff, 00132 const tx_metadata_t &metadata, 00133 const io_type_t &io_type, 00134 send_mode_t send_mode, 00135 double timeout = 0.1 00136 ) = 0; 00137 00169 virtual size_t recv( 00170 const recv_buffs_type &buffs, 00171 size_t nsamps_per_buff, 00172 rx_metadata_t &metadata, 00173 const io_type_t &io_type, 00174 recv_mode_t recv_mode, 00175 double timeout = 0.1 00176 ) = 0; 00177 00182 virtual size_t get_max_send_samps_per_packet(void) const = 0; 00183 00188 virtual size_t get_max_recv_samps_per_packet(void) const = 0; 00189 00196 virtual bool recv_async_msg( 00197 async_metadata_t &async_metadata, double timeout = 0.1 00198 ) = 0; 00199 00200 }; 00201 00202 } //namespace uhd 00203 00204 #endif /* INCLUDED_UHD_DEVICE_HPP */