GNU Radio 3.3.0 C++ API
SpectrumGUIClass.h
Go to the documentation of this file.
00001 #ifndef SPECTRUM_GUI_CLASS_HPP
00002 #define SPECTRUM_GUI_CLASS_HPP
00003 
00004 //#include <mutexClass.hpp>
00005 #include <qwidget.h>
00006 #include <qapplication.h>
00007 #include <qlabel.h>
00008 #include <qslider.h>
00009 #include <spectrumUpdateEvents.h>
00010 
00011 //#include <Windowing.hpp>
00012 
00013 class SpectrumDisplayForm;
00014 #include <spectrumdisplayform.h>
00015 
00016 #include <cmath>
00017 
00018 #include <complex>
00019 #include <vector>
00020 #include <string>
00021 
00022 class SpectrumGUIClass
00023 {
00024 public:
00025   SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
00026                    const double newCenterFrequency,
00027                    const double newStartFrequency, 
00028                    const double newStopFrequency);
00029   ~SpectrumGUIClass();
00030   void Reset();
00031 
00032   void OpenSpectrumWindow(QWidget*,
00033                           const bool frequency=true, const bool waterfall=true,
00034                           const bool waterfall3d=true, const bool time=true,
00035                           const bool constellation=true,
00036                           const bool use_openGL=true);
00037   void SetDisplayTitle(const std::string);
00038 
00039   bool GetWindowOpenFlag();
00040   void SetWindowOpenFlag(const bool);
00041 
00042   void SetFrequencyRange(const double, const double, const double);
00043   double GetStartFrequency()const;
00044   double GetStopFrequency()const;
00045   double GetCenterFrequency()const;
00046 
00047   void UpdateWindow(const bool, const std::complex<float>*,
00048                     const uint64_t, const float*,
00049                     const uint64_t, const float*,
00050                     const uint64_t,
00051                     const timespec, const bool);
00052 
00053   float GetPowerValue()const;
00054   void SetPowerValue(const float);
00055 
00056   int GetWindowType()const;
00057   void SetWindowType(const int);
00058 
00059   int GetFFTSize()const;
00060   int GetFFTSizeIndex()const;
00061   void SetFFTSize(const int);
00062 
00063   timespec GetLastGUIUpdateTime()const;
00064   void SetLastGUIUpdateTime(const timespec);
00065 
00066   unsigned int GetPendingGUIUpdateEvents()const;
00067   void IncrementPendingGUIUpdateEvents();
00068   void DecrementPendingGUIUpdateEvents();
00069   void ResetPendingGUIUpdateEvents();
00070 
00071   static const long MAX_FFT_SIZE = /*1048576*/32768;
00072   static const long MIN_FFT_SIZE = 1024;
00073 
00074   QWidget* qwidget();
00075 
00076   void SetTimeDomainAxis(double min, double max);
00077   void SetConstellationAxis(double xmin, double xmax,
00078                             double ymin, double ymax);
00079   void SetConstellationPenSize(int size);
00080   void SetFrequencyAxis(double min, double max);
00081 
00082   void SetUpdateTime(double t);
00083 
00084 protected:
00085 
00086 private:
00087 
00088   //MutexClass* _windowStateLock;
00089   int64_t _dataPoints;
00090   std::string _title;
00091   double _centerFrequency;
00092   double _startFrequency;
00093   double _stopFrequency;
00094   float _powerValue;
00095   bool _windowOpennedFlag;
00096   int _windowType;
00097   int64_t _lastDataPointCount;
00098   int _fftSize;
00099   timespec _lastGUIUpdateTime;
00100   unsigned int _pendingGUIUpdateEventsCount;
00101   int _droppedEntriesCount;
00102   bool _fftBuffersCreatedFlag;
00103   double _updateTime;
00104 
00105   SpectrumDisplayForm* _spectrumDisplayForm;
00106 
00107   std::complex<float>* _fftPoints;
00108   double* _realTimeDomainPoints;
00109   double* _imagTimeDomainPoints;
00110 };
00111 
00112 #endif /* SPECTRUM_GUI_CLASS_HPP */