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