GNU Radio 3.4.2 C++ API
spectrumdisplayform.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_DISPLAY_FORM_H
00024 #define SPECTRUM_DISPLAY_FORM_H
00025 
00026 #include "spectrumdisplayform.ui.h"
00027 
00028 class SpectrumGUIClass;
00029 #include <SpectrumGUIClass.h>
00030 
00031 #include <SpectrumGUIClass.h>
00032 #include <FrequencyDisplayPlot.h>
00033 #include <WaterfallDisplayPlot.h>
00034 #include <TimeDomainDisplayPlot.h>
00035 #include <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 */