GNU Radio 3.4.2 C++ API
|
00001 /* 00002 * Copyright 2010-2011 Free Software Foundation, Inc. 00003 * 00004 * This file is part of GNU Radio 00005 * 00006 * GNU Radio is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3, or (at your option) 00009 * any later version. 00010 * 00011 * GNU Radio is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with GNU Radio; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef INCLUDED_GR_UHD_USRP_SINK_H 00023 #define INCLUDED_GR_UHD_USRP_SINK_H 00024 00025 #include <gr_uhd_api.h> 00026 #include <gr_sync_block.h> 00027 #include <uhd/usrp/multi_usrp.hpp> 00028 00029 class uhd_usrp_sink; 00030 00031 /*! 00032 * \brief Make a new USRP sink block. 00033 * 00034 * The USRP sink block reads a stream and transmits the samples. 00035 * The sink block also provides API calls for transmitter settings. 00036 * 00037 * TX Stream tagging: 00038 * 00039 * The following tag keys will be consumed by the work function: 00040 * - pmt::pmt_string_to_symbol("tx_sob") 00041 * - pmt::pmt_string_to_symbol("tx_eob") 00042 * - pmt::pmt_string_to_symbol("tx_time") 00043 * 00044 * The sob and eob (start and end of burst) tag values are pmt booleans. 00045 * When present, burst tags should be set to true (pmt::PMT_T). 00046 * 00047 * The timstamp tag value is a pmt tuple of the following: 00048 * (uint64 seconds, and double fractional seconds). 00049 * 00050 * See the UHD manual for more detailed documentation: 00051 * http://code.ettus.com/redmine/ettus/projects/uhd/wiki 00052 * 00053 * \param device_addr the address to identify the hardware 00054 * \param io_type the desired input data type 00055 * \param num_channels number of stream from the device 00056 * \return a new USRP sink block object 00057 */ 00058 GR_UHD_API boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( 00059 const uhd::device_addr_t &device_addr, 00060 const uhd::io_type_t &io_type, 00061 size_t num_channels 00062 ); 00063 00064 class GR_UHD_API uhd_usrp_sink : virtual public gr_sync_block{ 00065 public: 00066 00067 /*! 00068 * Set the subdevice specification. 00069 * \param spec the subdev spec markup string 00070 * \param mboard the motherboard index 0 to M-1 00071 */ 00072 virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0; 00073 00074 /*! 00075 * Set the sample rate for the usrp device. 00076 * \param rate a new rate in Sps 00077 */ 00078 virtual void set_samp_rate(double rate) = 0; 00079 00080 /*! 00081 * Get the sample rate for the usrp device. 00082 * This is the actual sample rate and may differ from the rate set. 00083 * \return the actual rate in Sps 00084 */ 00085 virtual double get_samp_rate(void) = 0; 00086 00087 /*! 00088 * Tune the usrp device to the desired center frequency. 00089 * \param tune_request the tune request instructions 00090 * \param chan the channel index 0 to N-1 00091 * \return a tune result with the actual frequencies 00092 */ 00093 virtual uhd::tune_result_t set_center_freq( 00094 const uhd::tune_request_t tune_request, size_t chan = 0 00095 ) = 0; 00096 00097 /*! 00098 * Tune the usrp device to the desired center frequency. 00099 * This is a wrapper around set center freq so that in this case, 00100 * the user can pass a single frequency in the call through swig. 00101 * \param freq the desired frequency in Hz 00102 * \param chan the channel index 0 to N-1 00103 * \return a tune result with the actual frequencies 00104 */ 00105 uhd::tune_result_t set_center_freq(double freq, size_t chan = 0){ 00106 return set_center_freq(uhd::tune_request_t(freq), chan); 00107 } 00108 00109 /*! 00110 * Get the center frequency. 00111 * \param chan the channel index 0 to N-1 00112 * \return the frequency in Hz 00113 */ 00114 virtual double get_center_freq(size_t chan = 0) = 0; 00115 00116 /*! 00117 * Get the tunable frequency range. 00118 * \param chan the channel index 0 to N-1 00119 * \return the frequency range in Hz 00120 */ 00121 virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0; 00122 00123 /*! 00124 * Set the gain for the dboard. 00125 * \param gain the gain in dB 00126 * \param chan the channel index 0 to N-1 00127 */ 00128 virtual void set_gain(double gain, size_t chan = 0) = 0; 00129 00130 /*! 00131 * Set the named gain on the dboard. 00132 * \param gain the gain in dB 00133 * \param name the name of the gain stage 00134 * \param chan the channel index 0 to N-1 00135 */ 00136 virtual void set_gain(double gain, const std::string &name, size_t chan = 0) = 0; 00137 00138 /*! 00139 * Get the actual dboard gain setting. 00140 * \param chan the channel index 0 to N-1 00141 * \return the actual gain in dB 00142 */ 00143 virtual double get_gain(size_t chan = 0) = 0; 00144 00145 /*! 00146 * Get the actual dboard gain setting of named stage. 00147 * \param name the name of the gain stage 00148 * \param chan the channel index 0 to N-1 00149 * \return the actual gain in dB 00150 */ 00151 virtual double get_gain(const std::string &name, size_t chan = 0) = 0; 00152 00153 /*! 00154 * Get the actual dboard gain setting of named stage. 00155 * \param chan the channel index 0 to N-1 00156 * \return the actual gain in dB 00157 */ 00158 virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0; 00159 00160 /*! 00161 * Get the settable gain range. 00162 * \param chan the channel index 0 to N-1 00163 * \return the gain range in dB 00164 */ 00165 virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0; 00166 00167 /*! 00168 * Get the settable gain range. 00169 * \param name the name of the gain stage 00170 * \param chan the channel index 0 to N-1 00171 * \return the gain range in dB 00172 */ 00173 virtual uhd::gain_range_t get_gain_range(const std::string &name, size_t chan = 0) = 0; 00174 00175 /*! 00176 * Set the antenna to use. 00177 * \param ant the antenna string 00178 * \param chan the channel index 0 to N-1 00179 */ 00180 virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0; 00181 00182 /*! 00183 * Get the antenna in use. 00184 * \param chan the channel index 0 to N-1 00185 * \return the antenna string 00186 */ 00187 virtual std::string get_antenna(size_t chan = 0) = 0; 00188 00189 /*! 00190 * Get a list of possible antennas. 00191 * \param chan the channel index 0 to N-1 00192 * \return a vector of antenna strings 00193 */ 00194 virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0; 00195 00196 /*! 00197 * Set the subdevice bandpass filter. 00198 * \param chan the channel index 0 to N-1 00199 * \param bandwidth the filter bandwidth in Hz 00200 */ 00201 virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0; 00202 00203 /*! 00204 * Get a daughterboard sensor value. 00205 * \param name the name of the sensor 00206 * \param chan the channel index 0 to N-1 00207 * \return a sensor value object 00208 */ 00209 virtual uhd::sensor_value_t get_dboard_sensor(const std::string &name, size_t chan = 0) = 0; 00210 00211 /*! 00212 * Get a list of possible daughterboard sensor names. 00213 * \param chan the channel index 0 to N-1 00214 * \return a vector of sensor names 00215 */ 00216 virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0; 00217 00218 /*! 00219 * Get a motherboard sensor value. 00220 * \param name the name of the sensor 00221 * \param mboard the motherboard index 0 to M-1 00222 * \return a sensor value object 00223 */ 00224 virtual uhd::sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0; 00225 00226 /*! 00227 * Get a list of possible motherboard sensor names. 00228 * \param mboard the motherboard index 0 to M-1 00229 * \return a vector of sensor names 00230 */ 00231 virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0; 00232 00233 /*! 00234 * Set the clock configuration. 00235 * \param clock_config the new configuration 00236 * \param mboard the motherboard index 0 to M-1 00237 */ 00238 virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0; 00239 00240 /*! 00241 * Get the master clock rate. 00242 * \param mboard the motherboard index 0 to M-1 00243 * \return the clock rate in Hz 00244 */ 00245 virtual double get_clock_rate(size_t mboard = 0) = 0; 00246 00247 /*! 00248 * Set the master clock rate. 00249 * \param rate the new rate in Hz 00250 * \param mboard the motherboard index 0 to M-1 00251 */ 00252 virtual void set_clock_rate(double rate, size_t mboard = 0) = 0; 00253 00254 /*! 00255 * Get the current time registers. 00256 * \param mboard the motherboard index 0 to M-1 00257 * \return the current usrp time 00258 */ 00259 virtual uhd::time_spec_t get_time_now(size_t mboard = 0) = 0; 00260 00261 /*! 00262 * Get the time when the last pps pulse occured. 00263 * \param mboard the motherboard index 0 to M-1 00264 * \return the current usrp time 00265 */ 00266 virtual uhd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0; 00267 00268 /*! 00269 * Sets the time registers immediately. 00270 * \param time_spec the new time 00271 * \param mboard the motherboard index 0 to M-1 00272 */ 00273 virtual void set_time_now(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; 00274 00275 /*! 00276 * Set the time registers at the next pps. 00277 * \param time_spec the new time 00278 */ 00279 virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0; 00280 00281 /*! 00282 * Sync the time registers with an unknown pps edge. 00283 * \param time_spec the new time 00284 */ 00285 virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0; 00286 00287 /*! 00288 * Get access to the underlying uhd dboard iface object. 00289 * \return the dboard_iface object 00290 */ 00291 virtual uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0; 00292 00293 /*! 00294 * Get access to the underlying uhd device object. 00295 * \return the multi usrp device object 00296 */ 00297 virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0; 00298 }; 00299 00300 #endif /* INCLUDED_GR_UHD_USRP_SINK_H */