gr-baz Package
spectrumdisplayform.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009,2010,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;
29 #include <SpectrumGUIClass.h>
30 
31 #include <SpectrumGUIClass.h>
32 #include <FrequencyDisplayPlot.h>
33 #include <WaterfallDisplayPlot.h>
34 #include <TimeDomainDisplayPlot.h>
36 #include <QValidator>
37 #include <QTimer>
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, const uint64_t numFFTDataPoints,
49  const uint64_t numTimeDomainDataPoints );
50 
51  int GetAverageCount();
52  void SetAverageCount( const int newCount );
53  void Reset();
54  void AverageDataReset();
55  void ResizeBuffers( const uint64_t numFFTDataPoints,
56  const uint64_t numTimeDomainDataPoints );
57 
58 public slots:
59  void resizeEvent( QResizeEvent * e );
60  void customEvent( QEvent * e );
61  void AvgLineEdit_valueChanged( int valueString );
62  void MaxHoldCheckBox_toggled( bool newState );
63  void MinHoldCheckBox_toggled( bool newState );
66  void TabChanged(int index);
67 
68  void SetFrequencyRange( const double newCenterFrequency,
69  const double newStartFrequency,
70  const double newStopFrequency );
71  void closeEvent( QCloseEvent * e );
72  void WindowTypeChanged( int newItem );
73  void UseRFFrequenciesCB( bool useRFFlag );
78  void FFTComboBoxSelectedCB(const QString&);
79 
80  void ToggleTabFrequency(const bool state);
81  void ToggleTabWaterfall(const bool state);
82  void ToggleTabTime(const bool state);
83  void ToggleTabConstellation(const bool state);
84 
85  void SetTimeDomainAxis(double min, double max);
86  void SetConstellationAxis(double xmin, double xmax,
87  double ymin, double ymax);
88  void SetConstellationPenSize(int size);
89  void SetFrequencyAxis(double min, double max);
90  void SetUpdateTime(double t);
91 
92 private slots:
93  void newFrequencyData( const SpectrumUpdateEvent* );
94  void UpdateGuiTimer();
95 
96  void onFFTPlotPointSelected(const QPointF p);
97  void onWFallPlotPointSelected(const QPointF p);
98  void onTimePlotPointSelected(const QPointF p);
99  void onConstPlotPointSelected(const QPointF p);
100 
101 signals:
102  void plotPointSelected(const QPointF p, int type);
103 
104 private:
105  void _AverageHistory( const double * newBuffer );
106 
107  int _historyEntryCount;
108  int _historyEntry;
109  std::vector<double*>* _historyVector;
110  double* _averagedValues;
111  uint64_t _numRealDataPoints;
112  double* _realFFTDataPoints;
113  QIntValidator* _intValidator;
114  FrequencyDisplayPlot* _frequencyDisplayPlot;
115  WaterfallDisplayPlot* _waterfallDisplayPlot;
116  TimeDomainDisplayPlot* _timeDomainDisplayPlot;
117  ConstellationDisplayPlot* _constellationDisplayPlot;
118  SpectrumGUIClass* _system;
119  bool _systemSpecifiedFlag;
120  double _centerFrequency;
121  double _startFrequency;
122  double _noiseFloorAmplitude;
123  double _peakFrequency;
124  double _peakAmplitude;
125  double _stopFrequency;
126 
127  //SpectrumUpdateEvent _lastSpectrumEvent;
128 
129  // whether or not to use a particular display
130  int d_plot_fft;
131  int d_plot_waterfall;
132  int d_plot_time;
133  int d_plot_constellation;
134 
135  QTimer *displayTimer;
136  double d_update_time;
137 };
138 
139 #endif /* SPECTRUM_DISPLAY_FORM_H */