GNU Radio's OsmoSDR Package
osmosdr_source_c_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
4  *
5  * GNU Radio is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * GNU Radio is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GNU Radio; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 #ifndef INCLUDED_OSMOSDR_SOURCE_C_IMPL_H
21 #define INCLUDED_OSMOSDR_SOURCE_C_IMPL_H
22 
24 
25 #ifdef HAVE_IQBALANCE
26 #include <iqbalance_optimize_c.h>
27 #include <iqbalance_fix_cc.h>
28 #endif
29 
30 #include <osmosdr_src_iface.h>
31 
32 #include <map>
33 
35 {
36 public:
37  size_t get_num_channels( void );
38 
40  double set_sample_rate( double rate );
41  double get_sample_rate( void );
42 
43  osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
44  double set_center_freq( double freq, size_t chan = 0 );
45  double get_center_freq( size_t chan = 0 );
46  double set_freq_corr( double ppm, size_t chan = 0 );
47  double get_freq_corr( size_t chan = 0 );
48 
49  std::vector<std::string> get_gain_names( size_t chan = 0 );
50  osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
51  osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
52  bool set_gain_mode( bool automatic, size_t chan = 0 );
53  bool get_gain_mode( size_t chan = 0 );
54  double set_gain( double gain, size_t chan = 0 );
55  double set_gain( double gain, const std::string & name, size_t chan = 0 );
56  double get_gain( size_t chan = 0 );
57  double get_gain( const std::string & name, size_t chan = 0 );
58 
59  double set_if_gain( double gain, size_t chan = 0 );
60 
61  std::vector< std::string > get_antennas( size_t chan = 0 );
62  std::string set_antenna( const std::string & antenna, size_t chan = 0 );
63  std::string get_antenna( size_t chan = 0 );
64 
65  void set_iq_balance_mode( int mode, size_t chan = 0 );
66  void set_iq_balance( const std::complex<double> &correction, size_t chan = 0 );
67 
68 private:
69  osmosdr_source_c_impl (const std::string & args); // private constructor
70 
71  // The friend declaration allows osmosdr_make_source_c to
72  // access the private constructor.
73  friend osmosdr_source_c_sptr osmosdr_make_source_c (const std::string & args);
74 
75  double _sample_rate;
76  std::map< size_t, double > _center_freq;
77  std::map< size_t, double > _freq_corr;
78  std::map< size_t, bool > _gain_mode;
79  std::map< size_t, double > _gain;
80  std::map< size_t, double > _if_gain;
81  std::map< size_t, std::string > _antenna;
82  std::vector< osmosdr_src_iface * > _devs;
83 #ifdef HAVE_IQBALANCE
84  std::vector< iqbalance_fix_cc * > _iq_fix;
85  std::vector< iqbalance_optimize_c * > _iq_opt;
86  std::map< size_t, std::pair<float, float> > _vals;
87 #endif
88 };
89 
90 #endif /* INCLUDED_OSMOSDR_SOURCE_C_IMPL_H */