GNU Radio 3.7.0 C++ API
spectrumdisplayform.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008-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_DISPLAY_FORM_H
00024 #define SPECTRUM_DISPLAY_FORM_H
00025 
00026 #include <spectrumdisplayform.ui.h>
00027 
00028 class SpectrumGUIClass;
00029 #include <gnuradio/qtgui/SpectrumGUIClass.h>
00030 
00031 #include <gnuradio/qtgui/SpectrumGUIClass.h>
00032 #include <gnuradio/qtgui/FrequencyDisplayPlot.h>
00033 #include <gnuradio/qtgui/WaterfallDisplayPlot.h>
00034 #include <gnuradio/qtgui/TimeDomainDisplayPlot.h>
00035 #include <gnuradio/qtgui/ConstellationDisplayPlot.h>
00036 #include <QValidator>
00037 #include <QTimer>
00038 #include <vector>
00039 
00040 class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
00041 {
00042   Q_OBJECT
00043 
00044   public:
00045   SpectrumDisplayForm(QWidget* parent = 0);
00046   ~SpectrumDisplayForm();
00047 
00048   void setSystem(SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints,
00049                  const uint64_t numTimeDomainDataPoints);
00050 
00051   int getAverageCount();
00052   void setAverageCount(const int newCount);
00053   void reset();
00054   void averageDataReset();
00055   void resizeBuffers(const uint64_t numFFTDataPoints,
00056                      const uint64_t numTimeDomainDataPoints);
00057 
00058 public slots:
00059   void resizeEvent(QResizeEvent * e);
00060   void customEvent(QEvent * e);
00061   void avgLineEdit_valueChanged(int valueString);
00062   void maxHoldCheckBox_toggled(bool newState);
00063   void minHoldCheckBox_toggled(bool newState);
00064   void minHoldResetBtn_clicked();
00065   void maxHoldResetBtn_clicked();
00066   void tabChanged(int index);
00067 
00068   void setFrequencyRange(const double newCenterFrequency,
00069                          const double newStartFrequency,
00070                          const double newStopFrequency);
00071   void closeEvent(QCloseEvent * e);
00072   void windowTypeChanged(int newItem);
00073   void useRFFrequenciesCB(bool useRFFlag);
00074   void waterfallMaximumIntensityChangedCB(double);
00075   void waterfallMinimumIntensityChangedCB(double);
00076   void waterfallIntensityColorTypeChanged(int);
00077   void waterfallAutoScaleBtnCB();
00078   void fftComboBoxSelectedCB(const QString&);
00079 
00080   void toggleTabFrequency(const bool state);
00081   void toggleTabWaterfall(const bool state);
00082   void toggleTabTime(const bool state);
00083   void toggleTabConstellation(const bool state);
00084 
00085   void setTimeDomainAxis(double min, double max);
00086   void setConstellationAxis(double xmin, double xmax,
00087                             double ymin, double ymax);
00088   void setConstellationPenSize(int size);
00089   void setFrequencyAxis(double min, double max);
00090   void setUpdateTime(double t);
00091 
00092 private slots:
00093   void newFrequencyData(const SpectrumUpdateEvent*);
00094   void updateGuiTimer();
00095 
00096   void onFFTPlotPointSelected(const QPointF p);
00097   void onWFallPlotPointSelected(const QPointF p);
00098   void onTimePlotPointSelected(const QPointF p);
00099   void onConstPlotPointSelected(const QPointF p);
00100 
00101 signals:
00102   void plotPointSelected(const QPointF p, int type);
00103 
00104 private:
00105   void _averageHistory(const double * newBuffer);
00106 
00107   int _historyEntryCount;
00108   int _historyEntry;
00109   std::vector<double*>* _historyVector;
00110   double* _averagedValues;
00111   uint64_t _numRealDataPoints;
00112   double* _realFFTDataPoints;
00113   QIntValidator* _intValidator;
00114   FrequencyDisplayPlot* _frequencyDisplayPlot;
00115   WaterfallDisplayPlot* _waterfallDisplayPlot;
00116   TimeDomainDisplayPlot* _timeDomainDisplayPlot;
00117   ConstellationDisplayPlot* _constellationDisplayPlot;
00118   SpectrumGUIClass* _system;
00119   bool _systemSpecifiedFlag;
00120   double _centerFrequency;
00121   double _startFrequency;
00122   double _noiseFloorAmplitude;
00123   double _peakFrequency;
00124   double _peakAmplitude;
00125   double _stopFrequency;
00126 
00127   //SpectrumUpdateEvent _lastSpectrumEvent;
00128 
00129   // whether or not to use a particular display
00130   int d_plot_fft;
00131   int d_plot_waterfall;
00132   int d_plot_time;
00133   int d_plot_constellation;
00134 
00135   QTimer *displayTimer;
00136   double d_update_time;
00137 };
00138 
00139 #endif /* SPECTRUM_DISPLAY_FORM_H */