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