GNU Radio Manual and C++ API Reference  3.8.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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef SPECTRUM_DISPLAY_FORM_H
24 #define SPECTRUM_DISPLAY_FORM_H
25 
26 #include <spectrumdisplayform.ui.h>
27 
28 class SpectrumGUIClass;
30 
36 #include <QTimer>
37 #include <QValidator>
38 #include <vector>
39 
40 class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
41 {
42  Q_OBJECT
43 
44 public:
45  SpectrumDisplayForm(QWidget* parent = 0);
47 
48  void setSystem(SpectrumGUIClass* newSystem,
49  const uint64_t numFFTDataPoints,
50  const uint64_t numTimeDomainDataPoints);
51 
52  int getAverageCount();
53  void setAverageCount(const int newCount);
54  void reset();
55  void averageDataReset();
56  void resizeBuffers(const uint64_t numFFTDataPoints,
57  const uint64_t numTimeDomainDataPoints);
58 
59  // returns the frequency that was last double-clicked on by the user
60  float getClickedFreq() const;
61 
62  // checks if there was a double-click event; reset if there was
63  bool checkClicked();
64 
65 public slots:
66  void resizeEvent(QResizeEvent* e);
67  void customEvent(QEvent* e);
68  void avgLineEdit_valueChanged(int valueString);
69  void maxHoldCheckBox_toggled(bool newState);
70  void minHoldCheckBox_toggled(bool newState);
73  void tabChanged(int index);
74 
75  void setFrequencyRange(const double newCenterFrequency,
76  const double newStartFrequency,
77  const double newStopFrequency);
78  void closeEvent(QCloseEvent* e);
79  void windowTypeChanged(int newItem);
80  void useRFFrequenciesCB(bool useRFFlag);
81  void toggleRFFrequencies(bool en);
86  void fftComboBoxSelectedCB(const QString&);
87 
88  void toggleTabFrequency(const bool state);
89  void toggleTabWaterfall(const bool state);
90  void toggleTabTime(const bool state);
91  void toggleTabConstellation(const bool state);
92 
93  void setTimeDomainAxis(double min, double max);
94  void setConstellationAxis(double xmin, double xmax, double ymin, double ymax);
95  void setConstellationPenSize(int size);
96  void setFrequencyAxis(double min, double max);
97  void setUpdateTime(double t);
98 
99 private slots:
100  void newFrequencyData(const SpectrumUpdateEvent*);
101  void updateGuiTimer();
102 
103  void onFFTPlotPointSelected(const QPointF p);
104  void onWFallPlotPointSelected(const QPointF p);
105  void onTimePlotPointSelected(const QPointF p);
106  void onConstPlotPointSelected(const QPointF p);
107 
108 signals:
109  void plotPointSelected(const QPointF p, int type);
110 
111 private:
112  void _averageHistory(const double* newBuffer);
113 
114  int _historyEntryCount;
115  int _historyEntry;
116  std::vector<double*>* _historyVector;
117  double* _averagedValues;
118  uint64_t _numRealDataPoints;
119  double* _realFFTDataPoints;
120  QIntValidator* _intValidator;
121  FrequencyDisplayPlot* _frequencyDisplayPlot;
122  WaterfallDisplayPlot* _waterfallDisplayPlot;
123  TimeDomainDisplayPlot* _timeDomainDisplayPlot;
124  ConstellationDisplayPlot* _constellationDisplayPlot;
125  SpectrumGUIClass* _system;
126  bool _systemSpecifiedFlag;
127  double _centerFrequency;
128  double _startFrequency;
129  double _noiseFloorAmplitude;
130  double _peakFrequency;
131  double _peakAmplitude;
132  double _stopFrequency;
133 
134  double d_units;
135  bool d_clicked;
136  double d_clicked_freq;
137 
138  // SpectrumUpdateEvent _lastSpectrumEvent;
139 
140  // whether or not to use a particular display
141  int d_plot_fft;
142  int d_plot_waterfall;
143  int d_plot_time;
144  int d_plot_constellation;
145 
146  QTimer* displayTimer;
147  double d_update_time;
148 };
149 
150 #endif /* SPECTRUM_DISPLAY_FORM_H */
QWidget for displaying waterfall (spectrogram) plots.
Definition: WaterfallDisplayPlot.h:44
void toggleRFFrequencies(bool en)
void waterfallIntensityColorTypeChanged(int)
float min(float a, float b)
void waterfallMaximumIntensityChangedCB(double)
void tabChanged(int index)
Definition: spectrumdisplayform.h:40
void setConstellationAxis(double xmin, double xmax, double ymin, double ymax)
void minHoldResetBtn_clicked()
void resizeEvent(QResizeEvent *e)
void toggleTabTime(const bool state)
void setConstellationPenSize(int size)
void resizeBuffers(const uint64_t numFFTDataPoints, const uint64_t numTimeDomainDataPoints)
void useRFFrequenciesCB(bool useRFFlag)
void setFrequencyAxis(double min, double max)
void toggleTabConstellation(const bool state)
void fftComboBoxSelectedCB(const QString &)
void windowTypeChanged(int newItem)
void waterfallAutoScaleBtnCB()
void setFrequencyRange(const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency)
void avgLineEdit_valueChanged(int valueString)
void setAverageCount(const int newCount)
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:35
void setTimeDomainAxis(double min, double max)
Definition: spectrumUpdateEvents.h:40
void closeEvent(QCloseEvent *e)
void maxHoldCheckBox_toggled(bool newState)
void plotPointSelected(const QPointF p, int type)
void toggleTabFrequency(const bool state)
void maxHoldResetBtn_clicked()
void waterfallMinimumIntensityChangedCB(double)
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:36
QWidget for displaying constellaton (I&Q) plots.
Definition: ConstellationDisplayPlot.h:35
void toggleTabWaterfall(const bool state)
void customEvent(QEvent *e)
QWidget class for controlling plotting.
Definition: SpectrumGUIClass.h:46
float getClickedFreq() const
SpectrumDisplayForm(QWidget *parent=0)
void setUpdateTime(double t)
void setSystem(SpectrumGUIClass *newSystem, const uint64_t numFFTDataPoints, const uint64_t numTimeDomainDataPoints)
void minHoldCheckBox_toggled(bool newState)