3 // Copyright 2008,2009 Free Software Foundation, Inc.
5 // This file is part of GNU Radio
7 // GNU Radio is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3, or (at your option)
12 // GNU Radio is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with GNU Radio; see the file COPYING. If not, write to
19 // the Free Software Foundation, Inc., 51 Franklin Street,
20 // Boston, MA 02110-1301, USA.
28 %include <gr_shared_ptr.i>
30 class usrp_tune_result
33 usrp_tune_result(double baseband=0, double dxc=0,
34 double residual=0, bool inv=0);
52 db_base(boost::shared_ptr<usrp_basic> usrp, int which);
59 std::string side_and_name();
60 int which() { return d_which; }
62 bool bypass_adc_buffers(bool bypass);
63 bool set_atr_mask(int v);
64 bool set_atr_txval(int v);
65 bool set_atr_rxval(int v);
66 bool set_atr_tx_delay(int v);
67 bool set_atr_rx_delay(int v);
68 bool set_lo_offset(double offset);
69 double lo_offset() { return d_lo_offset; }
71 virtual float gain_min() = 0;
72 virtual float gain_max() = 0;
73 virtual float gain_db_per_step() = 0;
74 virtual double freq_min() = 0;
75 virtual double freq_max() = 0;
76 virtual struct freq_result_t set_freq(double target_freq) = 0;
77 virtual bool set_gain(float gain) = 0;
78 virtual bool is_quadrature() = 0;
79 virtual bool i_and_q_swapped();
80 virtual bool spectrum_inverted();
81 virtual bool set_enable(bool on);
82 virtual bool set_auto_tr(bool on);
83 virtual bool select_rx_antenna(int which_antenna);
84 virtual bool select_rx_antenna(const std::string &antenna);
85 virtual bool set_bw(float bw);
88 // Create templates for db's, vectors of db's, and vector of vectors of db's
89 typedef boost::shared_ptr<db_base> db_base_sptr;
90 %template(db_base_sptr) boost::shared_ptr<db_base>;
91 %template(db_base_sptr_vector) std::vector<db_base_sptr>;
92 %template(db_base_sptr_vector_vector) std::vector<std::vector<db_base_sptr> >;
94 // Set better class name in Python
95 // Enable freq_range and gain_range from public methods of class not implemented in C++
96 // And create a dummy wrapper for backwards compatability with some of the example code
98 db_base_sptr.__repr__ = lambda self: "<db_base::%s>" % (self.name(),)
99 db_base_sptr.freq_range = lambda self: (self.freq_min(), self.freq_max(), 1)
100 db_base_sptr.gain_range = lambda self: (self.gain_min(), self.gain_max(), self.gain_db_per_step())