GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
SpectrumGUIClass.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_GUI_CLASS_HPP
24 #define SPECTRUM_GUI_CLASS_HPP
25 
27 #include <gnuradio/thread/thread.h>
28 #include <qapplication.h>
29 #include <qlabel.h>
30 #include <qslider.h>
31 #include <qwidget.h>
32 
35 
36 #include <cmath>
37 
38 #include <complex>
39 #include <string>
40 #include <vector>
41 
42 /*!
43  * \brief QWidget class for controlling plotting.
44  * \ingroup qtgui_blk
45  */
47 {
48 public:
49  SpectrumGUIClass(const uint64_t maxDataSize,
50  const uint64_t fftSize,
51  const double newCenterFrequency,
52  const double newStartFrequency,
53  const double newStopFrequency);
55  void reset();
56 
57  void openSpectrumWindow(QWidget*,
58  const bool frequency = true,
59  const bool waterfall = true,
60  const bool time = true,
61  const bool constellation = true);
62  void setDisplayTitle(const std::string);
63 
64  bool getWindowOpenFlag();
65  void setWindowOpenFlag(const bool);
66 
67  void setFrequencyRange(const double, const double, const double);
68  double getStartFrequency();
69  double getStopFrequency();
70  double getCenterFrequency();
71 
72  void updateWindow(const bool,
73  const float*,
74  const uint64_t,
75  const float*,
76  const uint64_t,
77  const float*,
78  const uint64_t,
80  const bool);
81 
82  float getPowerValue();
83  void setPowerValue(const float);
84 
85  int getWindowType();
86  void setWindowType(const int);
87 
88  int getFFTSize();
89  int getFFTSizeIndex();
90  void setFFTSize(const int);
91 
94 
95  unsigned int getPendingGUIUpdateEvents();
99 
100  static const long MAX_FFT_SIZE;
101  static const long MIN_FFT_SIZE;
102 
103  QWidget* qwidget();
104 
105  void setTimeDomainAxis(double min, double max);
106  void setConstellationAxis(double xmin, double xmax, double ymin, double ymax);
107  void setConstellationPenSize(int size);
108  void setFrequencyAxis(double min, double max);
109 
110  void setUpdateTime(double t);
111 
112  void enableRFFreq(bool en);
113 
114  bool checkClicked();
115  float getClickedFreq();
116 
117 protected:
118 private:
119  gr::thread::mutex d_mutex;
120  int64_t _dataPoints;
121  std::string _title;
122  double _centerFrequency;
123  double _startFrequency;
124  double _stopFrequency;
125  float _powerValue;
126  bool _windowOpennedFlag;
127  int _windowType;
128  int64_t _lastDataPointCount;
129  int _fftSize;
130  gr::high_res_timer_type _lastGUIUpdateTime;
131  unsigned int _pendingGUIUpdateEventsCount;
132  int _droppedEntriesCount;
133  bool _fftBuffersCreatedFlag;
134  double _updateTime;
135 
136  SpectrumDisplayForm* _spectrumDisplayForm;
137 
138  float* _fftPoints;
139  double* _realTimeDomainPoints;
140  double* _imagTimeDomainPoints;
141 };
142 
143 #endif /* SPECTRUM_GUI_CLASS_HPP */
void setWindowOpenFlag(const bool)
gr::high_res_timer_type getLastGUIUpdateTime()
float getPowerValue()
double getStopFrequency()
float min(float a, float b)
void setTimeDomainAxis(double min, double max)
void decrementPendingGUIUpdateEvents()
void setWindowType(const int)
Definition: spectrumdisplayform.h:40
double getCenterFrequency()
QWidget * qwidget()
unsigned int getPendingGUIUpdateEvents()
void setFrequencyRange(const double, const double, const double)
void openSpectrumWindow(QWidget *, const bool frequency=true, const bool waterfall=true, const bool time=true, const bool constellation=true)
double getStartFrequency()
void incrementPendingGUIUpdateEvents()
float getClickedFreq()
void setLastGUIUpdateTime(const gr::high_res_timer_type)
void setFFTSize(const int)
void setDisplayTitle(const std::string)
void setUpdateTime(double t)
static const long MIN_FFT_SIZE
Definition: SpectrumGUIClass.h:101
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
void setConstellationPenSize(int size)
void setPowerValue(const float)
bool getWindowOpenFlag()
void enableRFFreq(bool en)
SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency)
QWidget class for controlling plotting.
Definition: SpectrumGUIClass.h:46
boost::mutex mutex
Definition: thread.h:48
static const long MAX_FFT_SIZE
Definition: SpectrumGUIClass.h:100
void setFrequencyAxis(double min, double max)
void setConstellationAxis(double xmin, double xmax, double ymin, double ymax)
void updateWindow(const bool, const float *, const uint64_t, const float *, const uint64_t, const float *, const uint64_t, const gr::high_res_timer_type, const bool)
void resetPendingGUIUpdateEvents()