Bringing out set axis function to the qtgui sinks for user-settable axis ranges.
[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
77 protected:
78
79 private:
80
81   //MutexClass* _windowStateLock;
82   int64_t _dataPoints;
83   std::string _title;
84   double _centerFrequency;
85   double _startFrequency;
86   double _stopFrequency;
87   float _powerValue;
88   bool _windowOpennedFlag;
89   int _windowType;
90   int64_t _lastDataPointCount;
91   int _fftSize;
92   timespec _lastGUIUpdateTime;
93   unsigned int _pendingGUIUpdateEventsCount;
94   int _droppedEntriesCount;
95   bool _fftBuffersCreatedFlag;
96
97   SpectrumDisplayForm* _spectrumDisplayForm;
98
99   std::complex<float>* _fftPoints;
100   double* _realTimeDomainPoints;
101   double* _imagTimeDomainPoints;
102 };
103
104 #endif /* SPECTRUM_GUI_CLASS_HPP */