gr-baz Package
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 qtgui_blk
47  *
48  * This is a QT-based graphical sink the takes a float stream and
49  * plots it. The default action is to plot the signal as a PSD (FFT),
50  * spectrogram (waterfall), and time domain plots. The plots may be
51  * turned off by setting the appropriate boolean value in the
52  * constructor to False.
53  */
54 
56 {
57 private:
58  friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
59  double fc, double bw,
60  const std::string &name,
61  bool plotfreq, bool plotwaterfall,
62  bool plottime, bool plotconst,
63  QWidget *parent);
64  qtgui_sink_f (int fftsize, int wintype,
65  double fc, double bw,
66  const std::string &name,
67  bool plotfreq, bool plotwaterfall,
68  bool plottime, bool plotconst,
69  QWidget *parent);
70 
71  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
72 
73  void initialize();
74 
75  int d_fftsize;
76  gr_firdes::win_type d_wintype;
77  std::vector<float> d_window;
78  double d_center_freq;
79  double d_bandwidth;
80  std::string d_name;
81 
82  bool d_shift;
83  gri_fft_complex *d_fft;
84 
85  int d_index;
86  float *d_residbuf;
87 
88  bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
89 
90  double d_update_time;
91 
92  QWidget *d_parent;
93  SpectrumGUIClass *d_main_gui;
94 
95  void windowreset();
96  void buildwindow();
97  void fftresize();
98  void fft(const float *data_in, int size);
99 
100 public:
101  ~qtgui_sink_f();
102  void exec_();
103  QWidget* qwidget();
104  PyObject* pyqwidget();
105 
106  void set_frequency_range(const double centerfreq,
107  const double bandwidth);
108 
109  void set_time_domain_axis(double min, double max);
110  void set_constellation_axis(double xmin, double xmax,
111  double ymin, double ymax);
112  void set_constellation_pen_size(int size);
113  void set_frequency_axis(double min, double max);
114 
115  void set_update_time(double t);
116 
117  QApplication *d_qApplication;
118 
119  int general_work (int noutput_items,
120  gr_vector_int &ninput_items,
121  gr_vector_const_void_star &input_items,
122  gr_vector_void_star &output_items);
123 };
124 
125 #endif /* INCLUDED_QTGUI_SINK_F_H */