GNU Radio 3.6.5.1 C++ API
qtgui_sink_f.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009,2011 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
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)
10  * any later version.
11  *
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.
16  *
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.
21  */
22 
23 #ifndef INCLUDED_QTGUI_SINK_F_H
24 #define INCLUDED_QTGUI_SINK_F_H
25 
26 #include <Python.h>
27 #include <gr_qtgui_api.h>
28 #include <gr_block.h>
29 #include <gr_firdes.h>
30 #include <gri_fft.h>
31 #include <qapplication.h>
32 #include "SpectrumGUIClass.h"
33 
34 class qtgui_sink_f;
36 
37 GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
38  double fc=0, double bw=1.0,
39  const std::string &name="Spectrum Display",
40  bool plotfreq=true, bool plotwaterfall=true,
41  bool plottime=true, bool plotconst=false,
42  QWidget *parent=NULL);
43 
44 /*!
45  * \brief A graphical sink to display freq, spec, and time.
46  * \ingroup instrumentation_blk
47  * \ingroup qtgui_blk
48  *
49  * \details
50  * This is a QT-based graphical sink the takes a float stream and
51  * plots it. The default action is to plot the signal as a PSD (FFT),
52  * spectrogram (waterfall), and time domain plots. The plots may be
53  * turned off by setting the appropriate boolean value in the
54  * constructor to False.
55  */
56 
58 {
59 private:
60  friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
61  double fc, double bw,
62  const std::string &name,
63  bool plotfreq, bool plotwaterfall,
64  bool plottime, bool plotconst,
65  QWidget *parent);
66  qtgui_sink_f (int fftsize, int wintype,
67  double fc, double bw,
68  const std::string &name,
69  bool plotfreq, bool plotwaterfall,
70  bool plottime, bool plotconst,
71  QWidget *parent);
72 
73  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
74 
75  void initialize();
76 
77  int d_fftsize;
78  gr_firdes::win_type d_wintype;
79  std::vector<float> d_window;
80  double d_center_freq;
81  double d_bandwidth;
82  std::string d_name;
83 
84  bool d_shift;
85  gri_fft_complex *d_fft;
86 
87  int d_index;
88  float *d_residbuf;
89 
90  bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
91 
92  double d_update_time;
93 
94  QWidget *d_parent;
95  SpectrumGUIClass *d_main_gui;
96 
97  void windowreset();
98  void buildwindow();
99  void fftresize();
100  void fft(const float *data_in, int size);
101 
102 public:
103  ~qtgui_sink_f();
104  void exec_();
105  QWidget* qwidget();
106  PyObject* pyqwidget();
107 
108  void set_frequency_range(const double centerfreq,
109  const double bandwidth);
110 
111  void set_time_domain_axis(double min, double max);
112  void set_constellation_axis(double xmin, double xmax,
113  double ymin, double ymax);
114  void set_constellation_pen_size(int size);
115  void set_frequency_axis(double min, double max);
116 
117  void set_update_time(double t);
118 
119  QApplication *d_qApplication;
120 
121  int general_work (int noutput_items,
122  gr_vector_int &ninput_items,
123  gr_vector_const_void_star &input_items,
124  gr_vector_void_star &output_items);
125 };
126 
127 #endif /* INCLUDED_QTGUI_SINK_F_H */