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