GNU Radio Manual and C++ API Reference  g36a1379
The Free & Open Software Radio Ecosystem
fosphor_display.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Ettus Research
4  * Copyright 2020 Ettus Research, LLC. A National Instruments Brand
5  *
6  * SPDX-License-Identifier: GPL-3.0-or-later
7  */
8 
9 #ifndef INCLUDED_QTGUI_FOSPHOR_DISPLAY_H
10 #define INCLUDED_QTGUI_FOSPHOR_DISPLAY_H
11 
12 #ifdef ENABLE_PYTHON
13 #include <Python.h>
14 #endif
15 
16 #include <gnuradio/block.h>
17 #include <gnuradio/qtgui/api.h>
18 #include <qapplication.h>
19 #include <string>
20 
21 namespace gr {
22 namespace qtgui {
23 
24 /*! FFT Histogram/Waterfall display widget for fosphor display
25  *
26  * This block can consume one or two inputs, each vectors of unsigned 8-bit
27  * numbers. The vector length is \p fft_bins for both inputs.
28  *
29  * The histogram display is a 2D display widget which does not only plot the
30  * current (average) FFT, but also the max-hold values for the FFT, and a
31  * histogram of the FFT (also averaged over time). For every FFT bin, it plots
32  * a histogram of power level distributions.
33  *
34  * The first input contains the histogram data for the FFT histogram. It expects
35  * data in the following order:
36  * - \p pwr_bins vectors of length \p fft_bins containing the histogram data for
37  * each FFT bin.
38  * - One vector of length \p fft_bins containing the max values.
39  * - One vector of length \p fft_bins containing the average values. After this
40  * vector, we expect an end-of-frame tag. This means end-of-frame tags on this
41  * input should be repeating every \p pwr_bins + 2 vectors.
42  *
43  * Averaging over time must be done by the upstream blocks. This block only does
44  * the display, none of the calculations.
45  *
46  * The second input contains FFT data for a waterfall display. It is simply a
47  * concatenation of FFT magnitude vectors (8-bit integers).
48  *
49  *
50  * \ingroup qtgui_blk
51  */
52 class QTGUI_API fosphor_display : virtual public gr::block
53 {
54 public:
55  typedef std::shared_ptr<fosphor_display> sptr;
56 
57  /*! Create an instance of a fosphor display
58  *
59  * \param fft_bins Number of FFT bins. This is also the vector length of the
60  * inputs, and the x-axis dimension on both the histogram
61  * plot and the waterfall plot (if enabled).
62  * \param pwr_bins The number of power bins histograms per FFT bin. This is
63  * also the y-axis dimension of the histogram plot. This
64  * must match the input provided (see block description).
65  * \param wf_lines The depth of the waterfall plot history (or the y-axis
66  * dimension of waterfall plot).
67  * \param parent The QWidget parent, if any.
68  *
69  * \brief Return a shared_ptr to a new instance of ettus::fosphor_display
70  */
71  static sptr make(const int fft_bins = 256,
72  const int pwr_bins = 64,
73  const int wf_lines = 512,
74  QWidget* parent = nullptr);
75 
76  /*** Block API ***********************************************************/
77  virtual void set_frequency_range(const double center_freq,
78  const double samp_rate) = 0;
79  virtual void set_waterfall(bool enabled) = 0;
80  virtual void set_grid(bool enabled) = 0;
81  virtual void set_palette(const std::string& name) = 0;
82  virtual void set_frame_rate(int fps) = 0;
83 
84  /*** QT GUI Widget stuff *************************************************/
85  virtual void exec_() = 0;
86  virtual QWidget* qwidget() = 0;
87 
88  QApplication* d_qApplication;
89 };
90 
91 } // namespace qtgui
92 } // namespace gr
93 
94 #endif /* INCLUDED_QTGUI_FOSPHOR_DISPLAY_H */
QApplication * d_qApplication
Definition: fosphor_display.h:88
std::shared_ptr< fosphor_display > sptr
Definition: fosphor_display.h:55
Definition: fosphor_display.h:52
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: gnuradio-runtime/include/gnuradio/block.h:62