GNU Radio's IIO Package
fmcomms2_source.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_SOURCE_H
24#define INCLUDED_IIO_FMCOMMS2_SOURCE_H
25
26#include <iio/api.h>
27#include <gnuradio/hier_block2.h>
28#include <gnuradio/sync_block.h>
29
30#include "device_source.h"
31
32namespace gr {
33 namespace iio {
34
35 /*!
36 * \brief <+description of block+>
37 * \ingroup iio
38 *
39 */
40 class IIO_API fmcomms2_source : virtual public gr::sync_block
41 {
42 public:
43 typedef std::shared_ptr<fmcomms2_source> sptr;
44
45 /*!
46 * \brief Return a shared_ptr to a new instance of iio::device.
47 *
48 * To avoid accidental use of raw pointers, iio::device's
49 * constructor is in a private implementation
50 * class. iio::device::make is the public interface for
51 * creating new instances.
52 */
53 static sptr make(const std::string &uri, unsigned long long frequency,
54 unsigned long samplerate,
55 unsigned long bandwidth,
56 bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
57 unsigned long buffer_size, bool quadrature, bool rfdc,
58 bool bbdc, const char *gain1, double gain1_value,
59 const char *gain2, double gain2_value,
60 const char *rf_port_select, const char *filter = "",
61 bool auto_filter = true);
62
63 static sptr make_from(struct iio_context *ctx,
64 unsigned long long frequency, unsigned long samplerate,
65 unsigned long bandwidth,
66 bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en,
67 unsigned long buffer_size, bool quadrature, bool rfdc,
68 bool bbdc, const char *gain1, double gain1_value,
69 const char *gain2, double gain2_value,
70 const char *rf_port_select, const char *filter = "",
71 bool auto_filter = true);
72
73 virtual void set_params(unsigned long long frequency,
74 unsigned long samplerate, unsigned long bandwidth,
75 bool quadrature, bool rfdc, bool bbdc,
76 const char *gain1, double gain1_value,
77 const char *gain2, double gain2_value,
78 const char *rf_port_select,
79 const char *filter = "", bool auto_filter = true) = 0;
80 };
81
82 class IIO_API fmcomms2_source_f32c : virtual public gr::hier_block2
83 {
84 public:
85 typedef std::shared_ptr<fmcomms2_source_f32c> sptr;
86
87 static sptr make(const std::string &uri,
88 unsigned long long frequency, unsigned long samplerate,
89 unsigned long bandwidth,
90 bool rx1_en, bool rx2_en,
91 unsigned long buffer_size, bool quadrature, bool rfdc,
92 bool bbdc, const char *gain1, double gain1_value,
93 const char *gain2, double gain2_value,
94 const char *rf_port_select, const char *filter = "",
95 bool auto_filter = true)
96 {
98 frequency, samplerate,
99 bandwidth, rx1_en, rx1_en, rx2_en,
100 rx2_en, buffer_size, quadrature,
101 rfdc, bbdc, gain1, gain1_value,
102 gain2, gain2_value, rf_port_select,
103 filter, auto_filter);
104
105 return gnuradio::get_initial_sptr(
106 new fmcomms2_source_f32c(rx1_en, rx2_en, block));
107 }
108
109 void set_params(unsigned long long frequency,
110 unsigned long samplerate, unsigned long bandwidth,
111 bool quadrature, bool rfdc, bool bbdc,
112 const char *gain1, double gain1_value,
113 const char *gain2, double gain2_value,
114 const char *rf_port_select,
115 const char *filter = "", bool auto_filter = true)
116 {
117 fmcomms2_block->set_params(frequency, samplerate, bandwidth,
118 quadrature, rfdc, bbdc, gain1, gain1_value,
119 gain2, gain2_value, rf_port_select, filter,
120 auto_filter);
121 }
122 private:
123 fmcomms2_source::sptr fmcomms2_block;
124
125 protected:
126 explicit fmcomms2_source_f32c(bool rx1_en, bool rx2_en,
128 };
129
130 } // namespace iio
131} // namespace gr
132
133#endif /* INCLUDED_IIO_FMCOMMS2_SOURCE_H */
134
#define IIO_API
Definition api.h:19
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 quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *rf_port_select, const char *filter="", bool auto_filter=true)
Definition fmcomms2_source.h:87
fmcomms2_source_f32c(bool rx1_en, bool rx2_en, fmcomms2_source::sptr block)
std::shared_ptr< fmcomms2_source_f32c > sptr
Definition fmcomms2_source.h:85
void set_params(unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *rf_port_select, const char *filter="", bool auto_filter=true)
Definition fmcomms2_source.h:109
<+description of block+>
Definition fmcomms2_source.h:41
std::shared_ptr< fmcomms2_source > sptr
Definition fmcomms2_source.h:43
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 quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *rf_port_select, const char *filter="", bool auto_filter=true)
Return a shared_ptr to a new instance of iio::device.
virtual void set_params(unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *rf_port_select, const char *filter="", bool auto_filter=true)=0
static sptr make_from(struct iio_context *ctx, 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 quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *rf_port_select, const char *filter="", bool auto_filter=true)
Definition attr_sink.h:30
Definition attr_sink.h:29