GNU Radio 3.4.0 C++ API
SpectrumGUIClass.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef SPECTRUM_GUI_CLASS_HPP
00024 #define SPECTRUM_GUI_CLASS_HPP
00025 
00026 #include <gruel/thread.h>
00027 #include <qwidget.h>
00028 #include <qapplication.h>
00029 #include <qlabel.h>
00030 #include <qslider.h>
00031 #include <spectrumUpdateEvents.h>
00032 
00033 class SpectrumDisplayForm;
00034 #include <spectrumdisplayform.h>
00035 
00036 #include <cmath>
00037 
00038 #include <complex>
00039 #include <vector>
00040 #include <string>
00041 
00042 class SpectrumGUIClass
00043 {
00044 public:
00045   SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
00046                    const double newCenterFrequency,
00047                    const double newStartFrequency, 
00048                    const double newStopFrequency);
00049   ~SpectrumGUIClass();
00050   void Reset();
00051 
00052   void OpenSpectrumWindow(QWidget*,
00053                           const bool frequency=true, const bool waterfall=true,
00054                           const bool time=true, const bool constellation=true);
00055   void SetDisplayTitle(const std::string);
00056 
00057   bool GetWindowOpenFlag();
00058   void SetWindowOpenFlag(const bool);
00059 
00060   void SetFrequencyRange(const double, const double, const double);
00061   double GetStartFrequency();
00062   double GetStopFrequency();
00063   double GetCenterFrequency();
00064 
00065   void UpdateWindow(const bool, const std::complex<float>*,
00066                     const uint64_t, const float*,
00067                     const uint64_t, const float*,
00068                     const uint64_t,
00069                     const gruel::high_res_timer_type, const bool);
00070 
00071   float GetPowerValue();
00072   void SetPowerValue(const float);
00073 
00074   int GetWindowType();
00075   void SetWindowType(const int);
00076 
00077   int GetFFTSize();
00078   int GetFFTSizeIndex();
00079   void SetFFTSize(const int);
00080 
00081   gruel::high_res_timer_type GetLastGUIUpdateTime();
00082   void SetLastGUIUpdateTime(const gruel::high_res_timer_type);
00083 
00084   unsigned int GetPendingGUIUpdateEvents();
00085   void IncrementPendingGUIUpdateEvents();
00086   void DecrementPendingGUIUpdateEvents();
00087   void ResetPendingGUIUpdateEvents();
00088 
00089   static const long MAX_FFT_SIZE;
00090   static const long MIN_FFT_SIZE;
00091 
00092   QWidget* qwidget();
00093 
00094   void SetTimeDomainAxis(double min, double max);
00095   void SetConstellationAxis(double xmin, double xmax,
00096                             double ymin, double ymax);
00097   void SetConstellationPenSize(int size);
00098   void SetFrequencyAxis(double min, double max);
00099 
00100   void SetUpdateTime(double t);
00101 
00102 protected:
00103 
00104 private:
00105 
00106   gruel::mutex d_mutex;
00107   int64_t _dataPoints;
00108   std::string _title;
00109   double _centerFrequency;
00110   double _startFrequency;
00111   double _stopFrequency;
00112   float _powerValue;
00113   bool _windowOpennedFlag;
00114   int _windowType;
00115   int64_t _lastDataPointCount;
00116   int _fftSize;
00117   gruel::high_res_timer_type _lastGUIUpdateTime;
00118   unsigned int _pendingGUIUpdateEventsCount;
00119   int _droppedEntriesCount;
00120   bool _fftBuffersCreatedFlag;
00121   double _updateTime;
00122 
00123   SpectrumDisplayForm* _spectrumDisplayForm;
00124 
00125   std::complex<float>* _fftPoints;
00126   double* _realTimeDomainPoints;
00127   double* _imagTimeDomainPoints;
00128 };
00129 
00130 #endif /* SPECTRUM_GUI_CLASS_HPP */