GNU Radio's IIO Package
fmcomms2_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 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_FMCOMMS2_SINK_H
24 #define INCLUDED_IIO_FMCOMMS2_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 fmcomms2_sink : virtual public gr::sync_block
36  {
37  public:
38  typedef std::shared_ptr<fmcomms2_sink> sptr;
39 
40  static sptr make(const std::string &uri, unsigned long long frequency,
41  unsigned long samplerate,
42  unsigned long bandwidth,
43  bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
44  unsigned long buffer_size, bool cyclic,
45  const char *rf_port_select, double attenuation1,
46  double attenuation2, const char *filter = "",
47  bool auto_filter = true);
48 
49  static sptr make_from(struct iio_context *ctx,
50  unsigned long long frequency, unsigned long samplerate,
51  unsigned long bandwidth,
52  bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
53  unsigned long buffer_size, bool cyclic,
54  const char *rf_port_select, double attenuation1,
55  double attenuation2, const char *filter = "",
56  bool auto_filter = true);
57 
58  virtual void set_params(unsigned long long frequency,
59  unsigned long samplerate, unsigned long bandwidth,
60  const char *rf_port_select, double attenuation1,
61  double attenuation2, const char *filter = "",
62  bool auto_filter = true) = 0;
63  };
64 
65  class IIO_API fmcomms2_sink_f32c : virtual public gr::hier_block2
66  {
67  public:
68  typedef std::shared_ptr<fmcomms2_sink_f32c> sptr;
69 
70  static sptr make(const std::string &uri, unsigned long long frequency,
71  unsigned long samplerate,
72  unsigned long bandwidth, bool rx1_en, bool rx2_en,
73  unsigned long buffer_size, bool cyclic,
74  const char *rf_port_select, double attenuation1,
75  double attenuation2, const char *filter = "",
76  bool auto_filter = true)
77  {
78  fmcomms2_sink::sptr block = fmcomms2_sink::make(uri, frequency,
79  samplerate, bandwidth, rx1_en,
80  rx1_en, rx2_en, rx2_en, buffer_size, cyclic,
81  rf_port_select, attenuation1, attenuation2,
82  filter, auto_filter);
83 
84  return gnuradio::get_initial_sptr(
85  new fmcomms2_sink_f32c(rx1_en, rx2_en, block));
86  }
87 
88  void set_params(unsigned long long frequency,
89  unsigned long samplerate, unsigned long bandwidth,
90  const char *rf_port_select, double attenuation1,
91  double attenuation2, const char *filter = "",
92  bool auto_filter = true)
93  {
94  fmcomms2_block->set_params(frequency, samplerate, bandwidth,
95  rf_port_select, attenuation1, attenuation2,
96  filter, auto_filter);
97  }
98 
99  private:
100  fmcomms2_sink::sptr fmcomms2_block;
101 
102  protected:
103  explicit fmcomms2_sink_f32c(bool rx1_en, bool rx2_en,
104  fmcomms2_sink::sptr block);
105  };
106 
107  } // namespace iio
108 } // namespace gr
109 
110 #endif /* INCLUDED_IIO_FMCOMMS2_SINK_H */
111 
#define IIO_API
Definition: api.h:19
Definition: fmcomms2_sink.h:35
Definition: fmcomms2_sink.h:65
static sptr make(const std::string &uri, unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool rx1_en, bool rx2_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, const char *filter="", bool auto_filter=true)
Definition: fmcomms2_sink.h:70
void set_params(unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, const char *rf_port_select, double attenuation1, double attenuation2, const char *filter="", bool auto_filter=true)
Definition: fmcomms2_sink.h:88
std::shared_ptr< fmcomms2_sink > sptr
Definition: fmcomms2_sink.h:38
Definition: attr_sink.h:29
std::shared_ptr< fmcomms2_sink_f32c > sptr
Definition: fmcomms2_sink.h:68
static sptr make(const std::string &uri, unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, const char *filter="", bool auto_filter=true)