Fixes the replotting update. It's now based on a QTimer so it's in the event buffer...
[debian/gnuradio] / gr-qtgui / src / lib / SpectrumGUIClass.h
1 #ifndef SPECTRUM_GUI_CLASS_HPP
2 #define SPECTRUM_GUI_CLASS_HPP
3
4 //#include <mutexClass.hpp>
5 #include <qwidget.h>
6 #include <qapplication.h>
7 #include <qlabel.h>
8 #include <qslider.h>
9 #include <spectrumUpdateEvents.h>
10
11 //#include <Windowing.hpp>
12
13 class SpectrumDisplayForm;
14 #include <spectrumdisplayform.h>
15
16 #include <cmath>
17
18 #include <complex>
19 #include <vector>
20 #include <string>
21
22 class SpectrumGUIClass
23 {
24 public:
25   SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
26                    const double newCenterFrequency,
27                    const double newStartFrequency, 
28                    const double newStopFrequency);
29   ~SpectrumGUIClass();
30   void Reset();
31
32   void OpenSpectrumWindow(QWidget*,
33                           const bool frequency=true, const bool waterfall=true,
34                           const bool waterfall3d=true, const bool time=true,
35                           const bool constellation=true,
36                           const bool use_openGL=true);
37   void SetDisplayTitle(const std::string);
38
39   bool GetWindowOpenFlag();
40   void SetWindowOpenFlag(const bool);
41
42   void SetFrequencyRange(const double, const double, const double);
43   double GetStartFrequency()const;
44   double GetStopFrequency()const;
45   double GetCenterFrequency()const;
46
47   void UpdateWindow(const bool, const std::complex<float>*,
48                     const uint64_t, const float*,
49                     const uint64_t, const float*,
50                     const uint64_t,
51                     const timespec, const bool);
52
53   float GetPowerValue()const;
54   void SetPowerValue(const float);
55
56   int GetWindowType()const;
57   void SetWindowType(const int);
58
59   int GetFFTSize()const;
60   int GetFFTSizeIndex()const;
61   void SetFFTSize(const int);
62
63   timespec GetLastGUIUpdateTime()const;
64   void SetLastGUIUpdateTime(const timespec);
65
66   unsigned int GetPendingGUIUpdateEvents()const;
67   void IncrementPendingGUIUpdateEvents();
68   void DecrementPendingGUIUpdateEvents();
69   void ResetPendingGUIUpdateEvents();
70
71   static const long MAX_FFT_SIZE = /*1048576*/32768;
72   static const long MIN_FFT_SIZE = 1024;
73
74   QWidget* qwidget();
75
76   void SetTimeDomainAxis(double min, double max);
77   void SetConstellationAxis(double xmin, double xmax,
78                             double ymin, double ymax);
79   void SetConstellationPenSize(int size);
80   void SetFrequencyAxis(double min, double max);
81
82   void SetUpdateTime(double t);
83
84 protected:
85
86 private:
87
88   //MutexClass* _windowStateLock;
89   int64_t _dataPoints;
90   std::string _title;
91   double _centerFrequency;
92   double _startFrequency;
93   double _stopFrequency;
94   float _powerValue;
95   bool _windowOpennedFlag;
96   int _windowType;
97   int64_t _lastDataPointCount;
98   int _fftSize;
99   timespec _lastGUIUpdateTime;
100   unsigned int _pendingGUIUpdateEventsCount;
101   int _droppedEntriesCount;
102   bool _fftBuffersCreatedFlag;
103   double _updateTime;
104
105   SpectrumDisplayForm* _spectrumDisplayForm;
106
107   std::complex<float>* _fftPoints;
108   double* _realTimeDomainPoints;
109   double* _imagTimeDomainPoints;
110 };
111
112 #endif /* SPECTRUM_GUI_CLASS_HPP */