GNU Radio 3.6.5 C++ API

qtgui_sink_f.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2009,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 INCLUDED_QTGUI_SINK_F_H
00024 #define INCLUDED_QTGUI_SINK_F_H
00025 
00026 #include <Python.h>
00027 #include <gr_qtgui_api.h>
00028 #include <gr_block.h>
00029 #include <gr_firdes.h>
00030 #include <gri_fft.h>
00031 #include <qapplication.h>
00032 #include "SpectrumGUIClass.h"
00033 
00034 class qtgui_sink_f;
00035 typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
00036 
00037 GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
00038                                      double fc=0, double bw=1.0,
00039                                      const std::string &name="Spectrum Display",
00040                                      bool plotfreq=true, bool plotwaterfall=true,
00041                                      bool plottime=true, bool plotconst=false,
00042                                      QWidget *parent=NULL);
00043 
00044 /*!
00045  * \brief A graphical sink to display freq, spec, and time.
00046  * \ingroup instrumentation_blk
00047  * \ingroup qtgui_blk
00048  *
00049  * \details
00050  * This is a QT-based graphical sink the takes a float stream and
00051  * plots it. The default action is to plot the signal as a PSD (FFT),
00052  * spectrogram (waterfall), and time domain plots. The plots may be
00053  * turned off by setting the appropriate boolean value in the
00054  * constructor to False.
00055  */
00056 
00057 class GR_QTGUI_API qtgui_sink_f : public gr_block
00058 {
00059 private:
00060   friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
00061                                               double fc, double bw,
00062                                               const std::string &name,
00063                                               bool plotfreq, bool plotwaterfall,
00064                                               bool plottime, bool plotconst,
00065                                               QWidget *parent);
00066   qtgui_sink_f (int fftsize, int wintype,
00067                 double fc, double bw,
00068                 const std::string &name,
00069                 bool plotfreq, bool plotwaterfall,
00070                 bool plottime, bool plotconst,
00071                 QWidget *parent);
00072 
00073   void forecast(int noutput_items, gr_vector_int &ninput_items_required);
00074 
00075   void initialize();
00076 
00077   int d_fftsize;
00078   gr_firdes::win_type d_wintype;
00079   std::vector<float> d_window;
00080   double d_center_freq;
00081   double d_bandwidth;
00082   std::string d_name;
00083 
00084   bool d_shift;
00085   gri_fft_complex *d_fft;
00086 
00087   int d_index;
00088   float *d_residbuf;
00089 
00090   bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
00091 
00092   double d_update_time;
00093 
00094   QWidget *d_parent;
00095   SpectrumGUIClass *d_main_gui;
00096 
00097   void windowreset();
00098   void buildwindow();
00099   void fftresize();
00100   void fft(const float *data_in, int size);
00101 
00102 public:
00103   ~qtgui_sink_f();
00104   void exec_();
00105   QWidget*  qwidget();
00106   PyObject* pyqwidget();
00107 
00108   void set_frequency_range(const double centerfreq,
00109                            const double bandwidth);
00110 
00111   void set_time_domain_axis(double min, double max);
00112   void set_constellation_axis(double xmin, double xmax,
00113                               double ymin, double ymax);
00114   void set_constellation_pen_size(int size);
00115   void set_frequency_axis(double min, double max);
00116 
00117   void set_update_time(double t);
00118 
00119   QApplication *d_qApplication;
00120 
00121   int general_work (int noutput_items,
00122                     gr_vector_int &ninput_items,
00123                     gr_vector_const_void_star &input_items,
00124                     gr_vector_void_star &output_items);
00125 };
00126 
00127 #endif /* INCLUDED_QTGUI_SINK_F_H */