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