GNU Radio 3.7.0 C++ API
freq_sink_c.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2012 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_FREQ_SINK_C_H
00024 #define INCLUDED_QTGUI_FREQ_SINK_C_H
00025 
00026 #include <Python.h>
00027 #include <gnuradio/qtgui/api.h>
00028 #include <gnuradio/sync_block.h>
00029 #include <qapplication.h>
00030 #include <gnuradio/filter/firdes.h>
00031 
00032 namespace gr {
00033   namespace qtgui {
00034     
00035     /*!
00036      * \brief A graphical sink to display multiple signals in frequency.
00037      * \ingroup instrumentation_blk
00038      * \ingroup qtgui_blk
00039      *
00040      * \details
00041      * This is a QT-based graphical sink the takes set of a complex
00042      * streams and plots the PSD. Each signal is plotted with a
00043      * different color, and the \a set_title and \a set_color
00044      * functions can be used to change the lable and color for a given
00045      * input number.
00046      */
00047     class QTGUI_API freq_sink_c : virtual public sync_block
00048     {
00049     public:
00050       // gr::qtgui::freq_sink_c::sptr
00051       typedef boost::shared_ptr<freq_sink_c> sptr;
00052 
00053       /*!
00054        * \brief Build a complex PSD sink.
00055        *
00056        * \param fftsize size of the FFT to compute and display
00057        * \param wintype type of window to apply (see gnuradio/filter/firdes.h)
00058        * \param fc center frequency of signal (use for x-axis labels)
00059        * \param bw bandwidth of signal (used to set x-axis labels)
00060        * \param name title for the plot
00061        * \param nconnections number of signals connected to sink
00062        * \param parent a QWidget parent object, if any
00063        */
00064       static sptr make(int fftsize, int wintype,
00065                        double fc, double bw,
00066                        const std::string &name,
00067                        int nconnections=1,
00068                        QWidget *parent=NULL);
00069 
00070       virtual void exec_() = 0;
00071       virtual PyObject* pyqwidget() = 0;
00072 
00073       virtual void set_fft_size(const int fftsize) = 0;
00074       virtual int fft_size() const = 0;
00075       virtual void set_fft_average(const float fftavg) = 0;
00076       virtual float fft_average() const = 0;
00077       virtual void set_fft_window(const gr::filter::firdes::win_type win) = 0;
00078       virtual gr::filter::firdes::win_type fft_window() = 0;
00079 
00080       virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0;
00081       virtual void set_y_axis(double min, double max) = 0;
00082 
00083       virtual void set_update_time(double t) = 0;
00084 
00085       virtual void set_title(const std::string &title) = 0;
00086       virtual void set_line_label(int which, const std::string &label) = 0;
00087       virtual void set_line_color(int which, const std::string &color) = 0;
00088       virtual void set_line_width(int which, int width) = 0;
00089       virtual void set_line_style(int which, int style) = 0;
00090       virtual void set_line_marker(int which, int marker) = 0;
00091       virtual void set_line_alpha(int which, double alpha) = 0;
00092 
00093       virtual std::string title() = 0;
00094       virtual std::string line_label(int which) = 0;
00095       virtual std::string line_color(int which) = 0;
00096       virtual int line_width(int which) = 0;
00097       virtual int line_style(int which) = 0;
00098       virtual int line_marker(int which) = 0;
00099       virtual double line_alpha(int which) = 0;
00100 
00101       virtual void set_size(int width, int height) = 0;
00102 
00103       virtual void enable_menu(bool en=true) = 0;
00104       virtual void enable_grid(bool en=true) = 0;
00105       virtual void enable_autoscale(bool en=true) = 0;
00106       virtual void reset() = 0;
00107 
00108       QApplication *d_qApplication;
00109     };
00110 
00111   } /* namespace qtgui */
00112 } /* namespace gr */
00113 
00114 #endif /* INCLUDED_QTGUI_FREQ_SINK_C_H */