GNU Radio Manual and C++ API Reference  3.10.1.0
The Free & Open Software Radio Ecosystem
spectrumdisplayform.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008-2011 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 SPECTRUM_DISPLAY_FORM_H
12 #define SPECTRUM_DISPLAY_FORM_H
13 
14 #include <spectrumdisplayform.ui.h>
15 
16 class SpectrumGUIClass;
18 
24 #include <QTimer>
25 #include <QValidator>
26 #include <vector>
27 
28 class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
29 {
30  Q_OBJECT
31 
32 public:
33  SpectrumDisplayForm(QWidget* parent = 0);
35 
36  // Disable copy/move because of QT raw pointers.
41 
42  void setSystem(SpectrumGUIClass* newSystem,
43  const uint64_t numFFTDataPoints,
44  const uint64_t numTimeDomainDataPoints);
45 
47  void setAverageCount(const int newCount);
48  void reset();
50  void resizeBuffers(const uint64_t numFFTDataPoints,
51  const uint64_t numTimeDomainDataPoints);
52 
53  // returns the frequency that was last double-clicked on by the user
54  float getClickedFreq() const;
55 
56  // checks if there was a double-click event; reset if there was
57  bool checkClicked();
58 
59 public slots:
60  void resizeEvent(QResizeEvent* e) override;
61  void customEvent(QEvent* e) override;
62  void avgLineEdit_valueChanged(int valueString);
63  void maxHoldCheckBox_toggled(bool newState);
64  void minHoldCheckBox_toggled(bool newState);
67  void tabChanged(int index);
68 
69  void setFrequencyRange(const double newCenterFrequency,
70  const double newStartFrequency,
71  const double newStopFrequency);
72  void closeEvent(QCloseEvent* e) override;
73  void windowTypeChanged(int newItem);
74  void useRFFrequenciesCB(bool useRFFlag);
75  void toggleRFFrequencies(bool en);
80  void fftComboBoxSelectedCB(const QString&);
81 
82  void toggleTabFrequency(const bool state);
83  void toggleTabWaterfall(const bool state);
84  void toggleTabTime(const bool state);
85  void toggleTabConstellation(const bool state);
86 
87  void setTimeDomainAxis(double min, double max);
88  void setConstellationAxis(double xmin, double xmax, double ymin, double ymax);
89  void setConstellationPenSize(int size);
90  void setFrequencyAxis(double min, double max);
91  void setUpdateTime(double t);
92 
93 private slots:
94  void newFrequencyData(const SpectrumUpdateEvent*);
95  void updateGuiTimer();
96 
97  void onFFTPlotPointSelected(const QPointF p);
98  void onWFallPlotPointSelected(const QPointF p);
99  void onTimePlotPointSelected(const QPointF p);
100  void onConstPlotPointSelected(const QPointF p);
101 
102 signals:
103  void plotPointSelected(const QPointF p, int type);
104 
105 private:
106  void _averageHistory(const std::vector<double>& newBuffer);
107 
108  int _historyEntryCount = 0;
109  int _historyEntry = 0;
110  std::deque<std::vector<double>> _historyVector;
111  std::vector<double> _averagedValues;
112  std::vector<double> _realFFTDataPoints;
113  QIntValidator _intValidator;
114  FrequencyDisplayPlot* _frequencyDisplayPlot;
115  WaterfallDisplayPlot* _waterfallDisplayPlot;
116  TimeDomainDisplayPlot* _timeDomainDisplayPlot;
117  ConstellationDisplayPlot* _constellationDisplayPlot;
118  SpectrumGUIClass* _system;
119  bool _systemSpecifiedFlag = false;
120  double _centerFrequency;
121  double _startFrequency;
122  double _noiseFloorAmplitude;
123  double _peakFrequency = 0;
124  double _peakAmplitude;
125  double _stopFrequency;
126 
127  double d_units;
128  bool d_clicked = false;
129  double d_clicked_freq = 0;
130 
131  // SpectrumUpdateEvent _lastSpectrumEvent;
132 
133  // whether or not to use a particular display
134  int d_plot_fft;
135  int d_plot_waterfall;
136  int d_plot_time;
137  int d_plot_constellation;
138 
139  QTimer displayTimer;
140  double d_update_time;
141 };
142 
143 #endif /* SPECTRUM_DISPLAY_FORM_H */
QWidget for displaying constellaton (I&Q) plots.
Definition: ConstellationDisplayPlot.h:24
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:24
Definition: spectrumdisplayform.h:29
void closeEvent(QCloseEvent *e) override
void setConstellationAxis(double xmin, double xmax, double ymin, double ymax)
void waterfallMinimumIntensityChangedCB(double)
void toggleRFFrequencies(bool en)
SpectrumDisplayForm(SpectrumDisplayForm &&)=delete
~SpectrumDisplayForm() override
void waterfallAutoScaleBtnCB()
void useRFFrequenciesCB(bool useRFFlag)
void tabChanged(int index)
void toggleTabWaterfall(const bool state)
void resizeBuffers(const uint64_t numFFTDataPoints, const uint64_t numTimeDomainDataPoints)
SpectrumDisplayForm & operator=(const SpectrumDisplayForm &)=delete
void setSystem(SpectrumGUIClass *newSystem, const uint64_t numFFTDataPoints, const uint64_t numTimeDomainDataPoints)
void fftComboBoxSelectedCB(const QString &)
void setFrequencyAxis(double min, double max)
void maxHoldCheckBox_toggled(bool newState)
void setUpdateTime(double t)
void maxHoldResetBtn_clicked()
void setAverageCount(const int newCount)
void toggleTabTime(const bool state)
void toggleTabConstellation(const bool state)
void avgLineEdit_valueChanged(int valueString)
void customEvent(QEvent *e) override
void waterfallMaximumIntensityChangedCB(double)
void waterfallIntensityColorTypeChanged(int)
void toggleTabFrequency(const bool state)
void setFrequencyRange(const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency)
void windowTypeChanged(int newItem)
void setConstellationPenSize(int size)
void minHoldCheckBox_toggled(bool newState)
SpectrumDisplayForm & operator=(SpectrumDisplayForm &&)=delete
float getClickedFreq() const
void plotPointSelected(const QPointF p, int type)
void setTimeDomainAxis(double min, double max)
void minHoldResetBtn_clicked()
SpectrumDisplayForm(QWidget *parent=0)
void resizeEvent(QResizeEvent *e) override
SpectrumDisplayForm(const SpectrumDisplayForm &)=delete
QWidget class for controlling plotting.
Definition: SpectrumGUIClass.h:35
Definition: spectrumUpdateEvents.h:30
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:25
QWidget for displaying waterfall (spectrogram) plots.
Definition: WaterfallDisplayPlot.h:35
float min(float a, float b)