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