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