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