gr-baz Package
SpectrumGUIClass.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_GUI_CLASS_HPP
24 #define SPECTRUM_GUI_CLASS_HPP
25 
26 #include <gruel/thread.h>
27 #include <qwidget.h>
28 #include <qapplication.h>
29 #include <qlabel.h>
30 #include <qslider.h>
31 #include <spectrumUpdateEvents.h>
32 
34 #include <spectrumdisplayform.h>
35 
36 #include <cmath>
37 
38 #include <complex>
39 #include <vector>
40 #include <string>
41 
43 {
44 public:
45  SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
46  const double newCenterFrequency,
47  const double newStartFrequency,
48  const double newStopFrequency);
50  void Reset();
51 
52  void OpenSpectrumWindow(QWidget*,
53  const bool frequency=true, const bool waterfall=true,
54  const bool time=true, const bool constellation=true);
55  void SetDisplayTitle(const std::string);
56 
57  bool GetWindowOpenFlag();
58  void SetWindowOpenFlag(const bool);
59 
60  void SetFrequencyRange(const double, const double, const double);
61  double GetStartFrequency();
62  double GetStopFrequency();
63  double GetCenterFrequency();
64 
65  void UpdateWindow(const bool, const std::complex<float>*,
66  const uint64_t, const float*,
67  const uint64_t, const float*,
68  const uint64_t,
69  const gruel::high_res_timer_type, const bool);
70 
71  float GetPowerValue();
72  void SetPowerValue(const float);
73 
74  int GetWindowType();
75  void SetWindowType(const int);
76 
77  int GetFFTSize();
78  int GetFFTSizeIndex();
79  void SetFFTSize(const int);
80 
83 
84  unsigned int GetPendingGUIUpdateEvents();
88 
89  static const long MAX_FFT_SIZE;
90  static const long MIN_FFT_SIZE;
91 
92  QWidget* qwidget();
93 
94  void SetTimeDomainAxis(double min, double max);
95  void SetConstellationAxis(double xmin, double xmax,
96  double ymin, double ymax);
97  void SetConstellationPenSize(int size);
98  void SetFrequencyAxis(double min, double max);
99 
100  void SetUpdateTime(double t);
101 
102 protected:
103 
104 private:
105 
106  gruel::mutex d_mutex;
107  int64_t _dataPoints;
108  std::string _title;
109  double _centerFrequency;
110  double _startFrequency;
111  double _stopFrequency;
112  float _powerValue;
113  bool _windowOpennedFlag;
114  int _windowType;
115  int64_t _lastDataPointCount;
116  int _fftSize;
117  gruel::high_res_timer_type _lastGUIUpdateTime;
118  unsigned int _pendingGUIUpdateEventsCount;
119  int _droppedEntriesCount;
120  bool _fftBuffersCreatedFlag;
121  double _updateTime;
122 
123  SpectrumDisplayForm* _spectrumDisplayForm;
124 
125  std::complex<float>* _fftPoints;
126  double* _realTimeDomainPoints;
127  double* _imagTimeDomainPoints;
128 };
129 
130 #endif /* SPECTRUM_GUI_CLASS_HPP */