GNU Radio's IIO Package
fmcomms5_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Analog Devices Inc.
4  * Author: Paul Cercueil <paul.cercueil@analog.com>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this software; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 
23 #ifndef INCLUDED_IIO_FMCOMMS5_SINK_H
24 #define INCLUDED_IIO_FMCOMMS5_SINK_H
25 
26 #include <iio/api.h>
27 #include <gnuradio/hier_block2.h>
28 #include <gnuradio/sync_block.h>
29 
30 #include "device_sink.h"
31 
32 namespace gr {
33  namespace iio {
34 
35  class IIO_API fmcomms5_sink : virtual public gr::sync_block
36  {
37  public:
38  typedef std::shared_ptr<fmcomms5_sink> sptr;
39 
40  static sptr make(const std::string &uri, unsigned long long frequency1,
41  unsigned long long frequency2,
42  unsigned long samplerate,
43  unsigned long bandwidth,
44  bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
45  bool ch5_en, bool ch6_en, bool ch7_en, bool ch8_en,
46  unsigned long buffer_size, bool cyclic,
47  const char *rf_port_select,
48  double attenuation1, double attenuation2,
49  double attenuation3, double attenuation4,
50  const char *filter = "");
51 
52  static sptr make_from(struct iio_context *ctx,
53  unsigned long long frequency1,
54  unsigned long long frequency2, unsigned long samplerate,
55  unsigned long bandwidth,
56  bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
57  bool ch5_en, bool ch6_en, bool ch7_en, bool ch8_en,
58  unsigned long buffer_size, bool cyclic,
59  const char *rf_port_select,
60  double attenuation1, double attenuation2,
61  double attenuation3, double attenuation4,
62  const char *filter = "");
63 
64  virtual void set_params(unsigned long long frequency1,
65  unsigned long long frequency2,
66  unsigned long samplerate, unsigned long bandwidth,
67  const char *rf_port_select,
68  double attenuation1, double attenuation2,
69  double attenuation3, double attenuation4) = 0;
70  };
71 
72  class IIO_API fmcomms5_sink_f32c : virtual public gr::hier_block2
73  {
74  public:
75  typedef std::shared_ptr<fmcomms5_sink_f32c> sptr;
76 
77  static sptr make(const std::string &uri, unsigned long long frequency1,
78  unsigned long long frequency2,
79  unsigned long samplerate,
80  unsigned long bandwidth, bool rx1_en, bool rx2_en,
81  bool rx3_en, bool rx4_en,
82  unsigned long buffer_size, bool cyclic,
83  const char *rf_port_select, double attenuation1,
84  double attenuation2, double attenuation3,
85  double attenuation4, const char *filter = "")
86  {
87  fmcomms5_sink::sptr block = fmcomms5_sink::make(uri, frequency1,
88  frequency2, samplerate, bandwidth, rx1_en,
89  rx1_en, rx2_en, rx2_en, rx3_en, rx3_en,
90  rx4_en, rx4_en, buffer_size, cyclic,
91  rf_port_select, attenuation1, attenuation2,
92  attenuation3, attenuation4,
93  filter);
94 
95  return gnuradio::get_initial_sptr(
96  new fmcomms5_sink_f32c(rx1_en, rx2_en, rx3_en, rx4_en, block));
97  }
98 
99  void set_params(unsigned long long frequency1,
100  unsigned long long frequency2,
101  unsigned long samplerate, unsigned long bandwidth,
102  const char *rf_port_select, double attenuation1,
103  double attenuation2, double attenuation3, double attenuation4)
104  {
105  fmcomms5_block->set_params(frequency1, frequency2,
106  samplerate, bandwidth,
107  rf_port_select, attenuation1, attenuation2,
108  attenuation3, attenuation4);
109  }
110 
111  private:
112  fmcomms5_sink::sptr fmcomms5_block;
113 
114  protected:
115  explicit fmcomms5_sink_f32c(bool rx1_en, bool rx2_en,
116  bool rx3_en, bool rx4_en, fmcomms5_sink::sptr block);
117  };
118 
119  } // namespace iio
120 } // namespace gr
121 
122 #endif /* INCLUDED_IIO_FMCOMMS5_SINK_H */
#define IIO_API
Definition: api.h:19
static sptr make(const std::string &uri, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool rx1_en, bool rx2_en, bool rx3_en, bool rx4_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter="")
Definition: fmcomms5_sink.h:77
void set_params(unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4)
Definition: fmcomms5_sink.h:99
std::shared_ptr< fmcomms5_sink > sptr
Definition: fmcomms5_sink.h:38
Definition: fmcomms5_sink.h:72
std::shared_ptr< fmcomms5_sink_f32c > sptr
Definition: fmcomms5_sink.h:75
static sptr make(const std::string &uri, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en, bool ch5_en, bool ch6_en, bool ch7_en, bool ch8_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter="")
Definition: attr_sink.h:29
Definition: fmcomms5_sink.h:35