GNU Radio Manual and C++ API Reference  3.8.2.0
The Free & Open Software Radio Ecosystem
eye_sink_f.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 Free Software Foundation, Inc.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_QTGUI_EYE_SINK_F_H
22 #define INCLUDED_QTGUI_EYE_SINK_F_H
23 
24 #ifdef ENABLE_PYTHON
25 #include <Python.h>
26 #endif
27 
28 #include <gnuradio/qtgui/api.h>
30 #include <gnuradio/sync_block.h>
31 #include <qapplication.h>
32 namespace gr {
33 namespace qtgui {
34 
35 /*!
36  * \brief A graphical sink to display signals eye patterns.
37  * \ingroup qtgui
38  *
39  * \details
40  * This is a QT-based graphical sink which takes set of a float streams
41  * and plots them as eye patterns. For each signal, both
42  * the signal's I and Q eye patterns are plotted. Eye patterns are
43  * 2 symbol's time long. Symbol rate must be an integer multiple of
44  * the sample rate to obtain the eye pattern. The \a set_title and
45  * \a set_color functions can be used to change the label and color
46  * for a given input number.
47  *
48  * Trigger occurs at the beginning of each stream used to plot the
49  * eye pattern; whilst a real eye diagram would be triggered with
50  * a (recovered) symbol clock. For these reasons, triggering of
51  * noisy and/or unsynchronized signals may lead to incorrect eye
52  * pattern.
53  *
54  * The sink supports plotting streaming float data or
55  * messages. The message port is named "in". The two modes cannot
56  * be used simultaneously, and \p nconnections should be set to 0
57  * when using the message mode. GRC handles this issue by
58  * providing the "Float Message" type that removes the streaming
59  * port(s).
60  *
61  * This sink can plot messages that contain either uniform vectors
62  * of float 32 values (pmt::is_f32vector) or PDUs where the data
63  * is a uniform vector of float 32 values.
64  */
65 
66 class QTGUI_API eye_sink_f : virtual public gr::sync_block
67 {
68 public:
69  // gr::qtgui::eye_sink_f::sptr
70  typedef boost::shared_ptr<eye_sink_f> sptr;
71 
72  /*!
73  * \brief Build floating point eye sink
74  *
75  * \param size number of points to plot at once
76  * \param samp_rate sample rate (used to set x-axis labels)
77  * \param name title for the plot
78  * \param nconnections number of signals connected to sink
79  * \param parent a QWidget parent object, if any
80  */
81  static sptr make(int size,
82  double samp_rate,
83  const std::string& name,
84  unsigned int nconnections = 1,
85  QWidget* parent = NULL);
86 
87  virtual void exec_() = 0;
88  virtual QWidget* qwidget() = 0;
89 
90 #ifdef ENABLE_PYTHON
91  virtual PyObject* pyqwidget() = 0;
92 #else
93  virtual void* pyqwidget() = 0;
94 #endif
95 
96  virtual void set_y_axis(double min, double max) = 0;
97  virtual void set_y_label(const std::string& label, const std::string& unit = "") = 0;
98  virtual void set_update_time(double t) = 0;
99  virtual void set_samp_per_symbol(unsigned int sps) = 0;
100  virtual void set_title(const std::string& title) = 0;
101  virtual void set_line_label(unsigned int which, const std::string& line) = 0;
102  virtual void set_line_color(unsigned int which, const std::string& color) = 0;
103  virtual void set_line_width(unsigned int which, int width) = 0;
104  virtual void set_line_style(unsigned int which, int style) = 0;
105  virtual void set_line_marker(unsigned int which, int marker) = 0;
106  virtual void set_nsamps(const int newsize) = 0;
107  virtual void set_samp_rate(const double samp_rate) = 0;
108  virtual void set_line_alpha(unsigned int which, double alpha) = 0;
109 
110  /*!
111  * Set up a trigger for the sink to know when to start
112  * plotting. Useful to isolate events and avoid noise.
113  *
114  * The trigger modes are Free, Auto, Normal, and Tag (see
115  * gr::qtgui::trigger_mode). The first three are like a normal
116  * oscope trigger function. Free means free running with no
117  * trigger, auto will trigger if the trigger event is seen, but
118  * will still plot otherwise, and normal will hold until the
119  * trigger event is observed. The Tag trigger mode allows us to
120  * trigger off a specific stream tag. The tag trigger is based
121  * only on the name of the tag, so when a tag of the given name
122  * is seen, the trigger is activated.
123  *
124  * In auto and normal mode, we look for the slope of the of the
125  * signal. Given a gr::qtgui::trigger_slope as either Positive
126  * or Negative, if the value between two samples moves in the
127  * given direction (x[1] > x[0] for Positive or x[1] < x[0] for
128  * Negative), then the trigger is activated.
129  *
130  * The \p delay value is specified in time based off the sample
131  * rate. If the sample rate of the block is set to 1, the delay
132  * is then also the sample number offset. This is the offset
133  * from the left-hand y-axis of the plot. It delays the signal
134  * to show the trigger event at the given delay along with some
135  * portion of the signal before the event. The delay must be
136  * within 0 - t_max where t_max is the maximum amount of time
137  * displayed on the eye pattern equal to 2 symbol time.
138  *
139  * \param mode The trigger_mode: free, auto, normal, or tag.
140  * \param slope The trigger_slope: positive or negative. Only
141  * used for auto and normal modes.
142  * \param level The magnitude of the trigger even for auto or normal modes.
143  * \param delay The delay (in units of time) for where the trigger happens.
144  * \param channel Which input channel to use for the trigger events.
145  * \param tag_key The name (as a string) of the tag to trigger off
146  * of if using the tag mode.
147  */
150  float level,
151  float delay,
152  int channel,
153  const std::string& tag_key = "") = 0;
154 
155  virtual std::string title() = 0;
156  virtual std::string line_label(unsigned int which) = 0;
157  virtual std::string line_color(unsigned int which) = 0;
158  virtual int line_width(unsigned int which) = 0;
159  virtual int line_style(unsigned int which) = 0;
160  virtual int line_marker(unsigned int which) = 0;
161  virtual double line_alpha(unsigned int which) = 0;
162 
163  virtual void set_size(int width, int height) = 0;
164 
165  virtual void enable_menu(bool en = true) = 0;
166  virtual void enable_grid(bool en = true) = 0;
167  virtual void enable_autoscale(bool en = true) = 0;
168  virtual void enable_stem_plot(bool en = true) = 0; // Unused, but do not remove
169  virtual void enable_semilogx(bool en = true) = 0; // Unused, but do not remove
170  virtual void enable_semilogy(bool en = true) = 0; // Unused, but do not remove
171  virtual void enable_control_panel(bool en = true) = 0;
172  virtual void enable_tags(unsigned int which, bool en) = 0;
173  virtual void enable_tags(bool en) = 0;
174  virtual void enable_axis_labels(bool en = true) = 0;
175  virtual void disable_legend() = 0;
176 
177  virtual int nsamps() const = 0;
178  virtual void reset() = 0;
179 
180  QApplication* d_qApplication;
181 };
182 } // namespace qtgui
183 } // namespace gr
184 
185 #endif /* INCLUDED_QTGUI_EYE_SINK_F_H */
gr::qtgui::eye_sink_f
A graphical sink to display signals eye patterns.
Definition: eye_sink_f.h:67
gr::qtgui::eye_sink_f::set_line_style
virtual void set_line_style(unsigned int which, int style)=0
QTGUI_API
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:30
gr::qtgui::eye_sink_f::set_line_width
virtual void set_line_width(unsigned int which, int width)=0
gr::qtgui::eye_sink_f::reset
virtual void reset()=0
gr::qtgui::eye_sink_f::exec_
virtual void exec_()=0
gr::qtgui::eye_sink_f::enable_semilogy
virtual void enable_semilogy(bool en=true)=0
gr::qtgui::eye_sink_f::set_trigger_mode
virtual void set_trigger_mode(gr::qtgui::trigger_mode mode, gr::qtgui::trigger_slope slope, float level, float delay, int channel, const std::string &tag_key="")=0
gr::qtgui::eye_sink_f::d_qApplication
QApplication * d_qApplication
Definition: eye_sink_f.h:180
gr::qtgui::eye_sink_f::set_nsamps
virtual void set_nsamps(const int newsize)=0
gr::trellis::min
float min(float a, float b)
gr::qtgui::eye_sink_f::enable_tags
virtual void enable_tags(bool en)=0
gr::qtgui::eye_sink_f::set_samp_rate
virtual void set_samp_rate(const double samp_rate)=0
gr::qtgui::eye_sink_f::enable_menu
virtual void enable_menu(bool en=true)=0
gr::qtgui::eye_sink_f::line_style
virtual int line_style(unsigned int which)=0
gr::qtgui::eye_sink_f::set_line_alpha
virtual void set_line_alpha(unsigned int which, double alpha)=0
gr::qtgui::eye_sink_f::set_update_time
virtual void set_update_time(double t)=0
gr::qtgui::eye_sink_f::enable_stem_plot
virtual void enable_stem_plot(bool en=true)=0
gr::qtgui::eye_sink_f::set_size
virtual void set_size(int width, int height)=0
api.h
gr::qtgui::eye_sink_f::set_y_label
virtual void set_y_label(const std::string &label, const std::string &unit="")=0
gr::sync_block
synchronous 1:1 input to output with history
Definition: sync_block.h:38
gr::qtgui::eye_sink_f::set_samp_per_symbol
virtual void set_samp_per_symbol(unsigned int sps)=0
gr::qtgui::eye_sink_f::enable_control_panel
virtual void enable_control_panel(bool en=true)=0
gr::qtgui::eye_sink_f::enable_tags
virtual void enable_tags(unsigned int which, bool en)=0
sync_block.h
gr::qtgui::eye_sink_f::qwidget
virtual QWidget * qwidget()=0
gr::qtgui::eye_sink_f::line_label
virtual std::string line_label(unsigned int which)=0
gr::qtgui::eye_sink_f::set_line_label
virtual void set_line_label(unsigned int which, const std::string &line)=0
gr::qtgui::eye_sink_f::enable_axis_labels
virtual void enable_axis_labels(bool en=true)=0
trigger_mode.h
gr::qtgui::eye_sink_f::disable_legend
virtual void disable_legend()=0
gr::qtgui::eye_sink_f::enable_grid
virtual void enable_grid(bool en=true)=0
gr::qtgui::eye_sink_f::line_width
virtual int line_width(unsigned int which)=0
gr::qtgui::eye_sink_f::set_title
virtual void set_title(const std::string &title)=0
gr::qtgui::eye_sink_f::pyqwidget
virtual void * pyqwidget()=0
gr::qtgui::eye_sink_f::set_y_axis
virtual void set_y_axis(double min, double max)=0
gr
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
gr::qtgui::eye_sink_f::line_marker
virtual int line_marker(unsigned int which)=0
gr::qtgui::eye_sink_f::enable_autoscale
virtual void enable_autoscale(bool en=true)=0
gr::qtgui::eye_sink_f::title
virtual std::string title()=0
gr::qtgui::eye_sink_f::line_alpha
virtual double line_alpha(unsigned int which)=0
gr::qtgui::eye_sink_f::sptr
boost::shared_ptr< eye_sink_f > sptr
Definition: eye_sink_f.h:70
gr::qtgui::eye_sink_f::line_color
virtual std::string line_color(unsigned int which)=0
gr::qtgui::eye_sink_f::set_line_marker
virtual void set_line_marker(unsigned int which, int marker)=0
gr::qtgui::trigger_slope
trigger_slope
Definition: trigger_mode.h:36
gr::qtgui::eye_sink_f::set_line_color
virtual void set_line_color(unsigned int which, const std::string &color)=0
gr::qtgui::trigger_mode
trigger_mode
Definition: trigger_mode.h:29
gr::qtgui::eye_sink_f::make
static sptr make(int size, double samp_rate, const std::string &name, unsigned int nconnections=1, QWidget *parent=NULL)
Build floating point eye sink.
gr::qtgui::eye_sink_f::nsamps
virtual int nsamps() const =0
gr::qtgui::eye_sink_f::enable_semilogx
virtual void enable_semilogx(bool en=true)=0