b87b50cab586d8ecbd5c968179b8dd8815fdc82a
[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 newStartFrequency, const double newStopFrequency);
27   ~SpectrumGUIClass();
28   void Reset();
29
30   void OpenSpectrumWindow(QWidget*,
31                           const bool frequency=true, const bool waterfall=true,
32                           const bool waterfall3d=true, const bool time=true,
33                           const bool constellation=true,
34                           const bool use_openGL=true);
35   void SetDisplayTitle(const std::string);
36
37   bool GetWindowOpenFlag();
38   void SetWindowOpenFlag(const bool);
39
40   void SetFrequencyRange(const double, const double, const double);
41   double GetStartFrequency()const;
42   double GetStopFrequency()const;
43   double GetCenterFrequency()const;
44
45   void UpdateWindow(const bool, const std::complex<float>*,
46                     const uint64_t, const float*,
47                     const uint64_t, const float*,
48                     const uint64_t, const double,
49                     const timespec, const bool);
50
51   float GetPowerValue()const;
52   void SetPowerValue(const float);
53
54   int GetWindowType()const;
55   void SetWindowType(const int);
56
57   int GetFFTSize()const;
58   int GetFFTSizeIndex()const;
59   void SetFFTSize(const int);
60
61   timespec GetLastGUIUpdateTime()const;
62   void SetLastGUIUpdateTime(const timespec);
63
64   unsigned int GetPendingGUIUpdateEvents()const;
65   void IncrementPendingGUIUpdateEvents();
66   void DecrementPendingGUIUpdateEvents();
67   void ResetPendingGUIUpdateEvents();
68
69   static const long MAX_FFT_SIZE = /*1048576*/32768;
70   static const long MIN_FFT_SIZE = 1024;
71
72   QWidget* qwidget();
73
74   void SetTimeDomainAxis(double min, double max);
75   void SetConstellationAxis(double xmin, double xmax,
76                             double ymin, double ymax);
77   void SetFrequencyAxis(double min, double max);
78
79 protected:
80
81 private:
82
83   //MutexClass* _windowStateLock;
84   int64_t _dataPoints;
85   std::string _title;
86   double _centerFrequency;
87   double _startFrequency;
88   double _stopFrequency;
89   float _powerValue;
90   bool _windowOpennedFlag;
91   int _windowType;
92   int64_t _lastDataPointCount;
93   int _fftSize;
94   timespec _lastGUIUpdateTime;
95   unsigned int _pendingGUIUpdateEventsCount;
96   int _droppedEntriesCount;
97   bool _fftBuffersCreatedFlag;
98
99   SpectrumDisplayForm* _spectrumDisplayForm;
100
101   std::complex<float>* _fftPoints;
102   double* _realTimeDomainPoints;
103   double* _imagTimeDomainPoints;
104 };
105
106 #endif /* SPECTRUM_GUI_CLASS_HPP */