GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
sink_f.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009,2011,2012,2014 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 #ifdef ENABLE_PYTHON
27 #include <Python.h>
28 #endif
29 
30 #include <gnuradio/block.h>
31 #include <gnuradio/qtgui/api.h>
32 #include <qapplication.h>
33 #include <qwt_symbol.h>
34 
35 
36 namespace gr {
37 namespace qtgui {
38 
39 /*!
40  * \brief A graphical sink to display freq, spec, and time.
41  * \ingroup instrumentation_blk
42  * \ingroup qtgui_blk
43  *
44  * \details
45  * This is a QT-based graphical sink the takes a float stream and
46  * plots it. The default action is to plot the signal as a PSD (FFT),
47  * spectrogram (waterfall), and time domain plots. The plots may be
48  * turned off by setting the appropriate boolean value in the
49  * constructor to False.
50  *
51  * Message Ports:
52  *
53  * - freq (input):
54  * Receives a PMT pair: (intern("freq"), double(frequency).
55  * This is used to retune the center frequency of the
56  * display's x-axis.
57  *
58  * - freq (output):
59  * Produces a PMT pair with (intern("freq"), double(frequency).
60  * When a user double-clicks on the display, the block
61  * produces and emits a message containing the frequency of
62  * where on the x-axis the user clicked. This value can be
63  * used by other blocks to update their frequency setting.
64  *
65  * To perform click-to-tune behavior, this output 'freq'
66  * port can be redirected to this block's input 'freq' port
67  * to catch the message and update the center frequency of
68  * the display.
69  */
70 class QTGUI_API sink_f : virtual public block
71 {
72 public:
73  // gr::qtgui::sink_f::sptr
74  typedef boost::shared_ptr<sink_f> sptr;
75 
76  /*!
77  * \brief Build a floating point qtgui sink.
78  *
79  * \param fftsize size of the FFT to compute and display
80  * \param wintype type of window to apply (see gnuradio/filter/firdes.h)
81  * \param fc center frequency of signal (use for x-axis labels)
82  * \param bw bandwidth of signal (used to set x-axis labels)
83  * \param name title for the plot
84  * \param plotfreq Toggle frequency plot on/off
85  * \param plotwaterfall Toggle waterfall plot on/off
86  * \param plottime Toggle time plot on/off
87  * \param plotconst Toggle constellation plot on/off
88  * \param parent a QWidget parent object, if any
89  */
90  static sptr make(int fftsize,
91  int wintype,
92  double fc,
93  double bw,
94  const std::string& name,
95  bool plotfreq,
96  bool plotwaterfall,
97  bool plottime,
98  bool plotconst,
99  QWidget* parent = NULL);
100 
101  virtual void exec_() = 0;
102  virtual QWidget* qwidget() = 0;
103 
104 #ifdef ENABLE_PYTHON
105  virtual PyObject* pyqwidget() = 0;
106 #else
107  virtual void* pyqwidget() = 0;
108 #endif
109 
110  virtual void set_fft_size(const int fftsize) = 0;
111  virtual int fft_size() const = 0;
112 
113  virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0;
114  virtual void set_fft_power_db(double min, double max) = 0;
115  virtual void enable_rf_freq(bool en) = 0;
116 
117  // void set_time_domain_axis(double min, double max);
118  // void set_constellation_axis(double xmin, double xmax,
119  // double ymin, double ymax);
120  // void set_constellation_pen_size(int size);
121 
122  virtual void set_update_time(double t) = 0;
123 
124  QApplication* d_qApplication;
125 };
126 
127 } /* namespace qtgui */
128 } /* namespace gr */
129 
130 #endif /* INCLUDED_QTGUI_SINK_F_H */
float min(float a, float b)
boost::shared_ptr< sink_f > sptr
Definition: sink_f.h:74
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
QApplication * d_qApplication
Definition: sink_f.h:124
A graphical sink to display freq, spec, and time.
Definition: sink_f.h:70
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71