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