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 */
SpectrumGUIClass::getClickedFreq
float getClickedFreq()
SpectrumGUIClass::MIN_FFT_SIZE
static const long MIN_FFT_SIZE
Definition: SpectrumGUIClass.h:101
SpectrumGUIClass::setDisplayTitle
void setDisplayTitle(const std::string)
SpectrumGUIClass::setUpdateTime
void setUpdateTime(double t)
SpectrumGUIClass::reset
void reset()
SpectrumGUIClass::setPowerValue
void setPowerValue(const float)
SpectrumGUIClass::~SpectrumGUIClass
~SpectrumGUIClass()
SpectrumGUIClass::enableRFFreq
void enableRFFreq(bool en)
gr::trellis::min
float min(float a, float b)
SpectrumGUIClass::setConstellationPenSize
void setConstellationPenSize(int size)
SpectrumGUIClass::getWindowOpenFlag
bool getWindowOpenFlag()
SpectrumGUIClass::SpectrumGUIClass
SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency)
SpectrumGUIClass::updateWindow
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)
SpectrumGUIClass::setFrequencyAxis
void setFrequencyAxis(double min, double max)
SpectrumGUIClass::MAX_FFT_SIZE
static const long MAX_FFT_SIZE
Definition: SpectrumGUIClass.h:100
SpectrumGUIClass::setConstellationAxis
void setConstellationAxis(double xmin, double xmax, double ymin, double ymax)
spectrumdisplayform.h
SpectrumGUIClass::getWindowType
int getWindowType()
SpectrumGUIClass::setWindowOpenFlag
void setWindowOpenFlag(const bool)
SpectrumGUIClass::resetPendingGUIUpdateEvents
void resetPendingGUIUpdateEvents()
gr::thread::mutex
boost::mutex mutex
Definition: thread.h:48
SpectrumGUIClass::getLastGUIUpdateTime
gr::high_res_timer_type getLastGUIUpdateTime()
SpectrumGUIClass::getPowerValue
float getPowerValue()
SpectrumGUIClass::getStopFrequency
double getStopFrequency()
SpectrumGUIClass::setTimeDomainAxis
void setTimeDomainAxis(double min, double max)
SpectrumGUIClass::decrementPendingGUIUpdateEvents
void decrementPendingGUIUpdateEvents()
spectrumUpdateEvents.h
SpectrumGUIClass::setWindowType
void setWindowType(const int)
gr::high_res_timer_type
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
SpectrumGUIClass
QWidget class for controlling plotting.
Definition: SpectrumGUIClass.h:46
SpectrumGUIClass::getCenterFrequency
double getCenterFrequency()
SpectrumGUIClass::setFrequencyRange
void setFrequencyRange(const double, const double, const double)
SpectrumGUIClass::qwidget
QWidget * qwidget()
SpectrumGUIClass::getPendingGUIUpdateEvents
unsigned int getPendingGUIUpdateEvents()
SpectrumGUIClass::checkClicked
bool checkClicked()
SpectrumGUIClass::getFFTSize
int getFFTSize()
SpectrumGUIClass::getStartFrequency
double getStartFrequency()
SpectrumGUIClass::incrementPendingGUIUpdateEvents
void incrementPendingGUIUpdateEvents()
thread.h
SpectrumDisplayForm
Definition: spectrumdisplayform.h:40
SpectrumGUIClass::openSpectrumWindow
void openSpectrumWindow(QWidget *, const bool frequency=true, const bool waterfall=true, const bool time=true, const bool constellation=true)
SpectrumGUIClass::setLastGUIUpdateTime
void setLastGUIUpdateTime(const gr::high_res_timer_type)
SpectrumGUIClass::getFFTSizeIndex
int getFFTSizeIndex()
SpectrumGUIClass::setFFTSize
void setFFTSize(const int)