GNU Radio 3.5.1 C++ API
|
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_C_H 00024 #define INCLUDED_QTGUI_SINK_C_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 <gruel/high_res_timer.h> 00033 #include "SpectrumGUIClass.h" 00034 00035 class qtgui_sink_c; 00036 typedef boost::shared_ptr<qtgui_sink_c> qtgui_sink_c_sptr; 00037 00038 GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, 00039 double fc=0, double bandwidth=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 /*! 00046 * \brief A graphical sink to display freq, spec, time, and const plots. 00047 * \ingroup qtgui_blk 00048 * 00049 * This is a QT-based graphical sink the takes a complex stream and 00050 * plots it. The default action is to plot the signal as a PSD (FFT), 00051 * spectrogram (waterfall), time domain I&Q, and constellation (I 00052 * vs. Q) plots. The plots may be turned off by setting the 00053 * appropriate boolean value in the constructor to False. 00054 */ 00055 00056 class GR_QTGUI_API qtgui_sink_c : public gr_block 00057 { 00058 private: 00059 friend GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, 00060 double fc, double bw, 00061 const std::string &name, 00062 bool plotfreq, bool plotwaterfall, 00063 bool plottime, bool plotconst, 00064 QWidget *parent); 00065 qtgui_sink_c (int fftsize, int wintype, 00066 double fc, double bw, 00067 const std::string &name, 00068 bool plotfreq, bool plotwaterfall, 00069 bool plottime, bool plotconst, 00070 QWidget *parent); 00071 00072 void forecast(int noutput_items, gr_vector_int &ninput_items_required); 00073 00074 void initialize(); 00075 00076 int d_fftsize; 00077 gr_firdes::win_type d_wintype; 00078 std::vector<float> d_window; 00079 double d_center_freq; 00080 double d_bandwidth; 00081 std::string d_name; 00082 gruel::high_res_timer_type d_last_update; 00083 bool d_update_active; 00084 00085 bool d_shift; 00086 gri_fft_complex *d_fft; 00087 00088 int d_index; 00089 gr_complex *d_residbuf; 00090 00091 bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst; 00092 00093 gruel::high_res_timer_type d_update_time; 00094 00095 QWidget *d_parent; 00096 SpectrumGUIClass *d_main_gui; 00097 00098 void windowreset(); 00099 void buildwindow(); 00100 void fftresize(); 00101 void fft(const gr_complex *data_in, int size); 00102 00103 public: 00104 ~qtgui_sink_c(); 00105 void exec_(); 00106 QWidget* qwidget(); 00107 PyObject* pyqwidget(); 00108 00109 void set_frequency_range(const double centerfreq, 00110 const double bandwidth); 00111 00112 void set_time_domain_axis(double min, double max); 00113 void set_constellation_axis(double xmin, double xmax, 00114 double ymin, double ymax); 00115 void set_constellation_pen_size(int size); 00116 void set_frequency_axis(double min, double max); 00117 00118 void set_update_time(double t); 00119 00120 QApplication *d_qApplication; 00121 00122 int general_work (int noutput_items, 00123 gr_vector_int &ninput_items, 00124 gr_vector_const_void_star &input_items, 00125 gr_vector_void_star &output_items); 00126 }; 00127 00128 #endif /* INCLUDED_QTGUI_SINK_C_H */