GNU Radio 3.4.0 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 <qtgui.h>
00033 #include "SpectrumGUIClass.h"
00034 
00035 class qtgui_sink_f;
00036 typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
00037 
00038 GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
00039                                      double fc=0, double bw=1.0,
00040                                      const std::string &name="Spectrum Display",
00041                                      bool plotfreq=true, bool plotwaterfall=true,
00042                                      bool plottime=true, bool plotconst=true,
00043                                      QWidget *parent=NULL);
00044 
00045 class GR_QTGUI_API qtgui_sink_f : public gr_block
00046 {
00047 private:
00048   friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
00049                                               double fc, double bw,
00050                                               const std::string &name,
00051                                               bool plotfreq, bool plotwaterfall,
00052                                               bool plottime, bool plotconst,
00053                                               QWidget *parent);
00054   qtgui_sink_f (int fftsize, int wintype,
00055                 double fc, double bw,
00056                 const std::string &name,
00057                 bool plotfreq, bool plotwaterfall,
00058                 bool plottime, bool plotconst,
00059                 QWidget *parent);
00060 
00061   void forecast(int noutput_items, gr_vector_int &ninput_items_required);
00062 
00063   void initialize();
00064 
00065   int d_fftsize;
00066   gr_firdes::win_type d_wintype;
00067   std::vector<float> d_window;
00068   double d_center_freq;
00069   double d_bandwidth;
00070   std::string d_name;
00071   
00072   bool d_shift;
00073   gri_fft_complex *d_fft;
00074 
00075   int d_index;
00076   float *d_residbuf;
00077 
00078   bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
00079 
00080   double d_update_time;
00081 
00082   QWidget *d_parent;
00083   SpectrumGUIClass *d_main_gui; 
00084 
00085   void windowreset();
00086   void buildwindow();
00087   void fftresize();
00088   void fft(const float *data_in, int size);
00089   
00090 public:
00091   ~qtgui_sink_f();
00092   void exec_();
00093   QWidget*  qwidget();
00094   PyObject* pyqwidget();
00095 
00096   void set_frequency_range(const double centerfreq,
00097                            const double bandwidth);
00098 
00099   void set_time_domain_axis(double min, double max);
00100   void set_constellation_axis(double xmin, double xmax,
00101                               double ymin, double ymax);
00102   void set_constellation_pen_size(int size);
00103   void set_frequency_axis(double min, double max);
00104 
00105   void set_update_time(double t);
00106 
00107   QApplication *d_qApplication;
00108 
00109   int general_work (int noutput_items,
00110                     gr_vector_int &ninput_items,
00111                     gr_vector_const_void_star &input_items,
00112                     gr_vector_void_star &output_items);
00113 };
00114 
00115 #endif /* INCLUDED_QTGUI_SINK_F_H */