GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
const_sink_c.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012,2014-2015 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_QTGUI_CONST_SINK_C_H
12 #define INCLUDED_QTGUI_CONST_SINK_C_H
13 
14 #ifdef ENABLE_PYTHON
15 #include <Python.h>
16 #endif
17 
18 #include <gnuradio/filter/firdes.h>
19 #include <gnuradio/qtgui/api.h>
21 #include <gnuradio/sync_block.h>
22 #include <qapplication.h>
23 
24 namespace gr {
25 namespace qtgui {
26 
27 /*!
28  * \brief A graphical sink to display the IQ constellation of multiple signals.
29  * \ingroup instrumentation_blk
30  * \ingroup qtgui_blk
31  *
32  * \details
33  * This is a QT-based graphical sink the takes set of a complex
34  * streams and plots them on an IQ constellation plot.
35  *
36  * The sink supports plotting streaming complex data or
37  * messages. The message port is named "in". The two modes cannot
38  * be used simultaneously, and \p nconnections should be set to 0
39  * when using the message mode. GRC handles this issue by
40  * providing the "Complex Message" type that removes the streaming
41  * port(s).
42  *
43  * This sink can plot messages that contain either uniform vectors
44  * of complex 32 values (pmt::is_c32vector) or PDUs where the data
45  * is a uniform vector of complex 32 values.
46  */
47 class QTGUI_API const_sink_c : virtual public sync_block
48 {
49 public:
50  // gr::qtgui::const_sink_c::sptr
51  typedef std::shared_ptr<const_sink_c> sptr;
52 
53  /*!
54  * \brief Build a constellation plot sink.
55  *
56  * \param size number of points to plot at once
57  * \param name title for the plot
58  * \param nconnections number of signals connected to sink
59  * \param parent a QWidget parent object, if any
60  */
61  static sptr
62  make(int size, const std::string& name, int nconnections = 1, QWidget* parent = NULL);
63 
64  virtual void exec_() = 0;
65  virtual QWidget* qwidget() = 0;
66 
67 #ifdef ENABLE_PYTHON
68  virtual PyObject* pyqwidget() = 0;
69 #else
70  virtual void* pyqwidget() = 0;
71 #endif
72 
73  virtual void set_y_axis(double min, double max) = 0;
74  virtual void set_x_axis(double min, double max) = 0;
75 
76  virtual void set_update_time(double t) = 0;
77  virtual void set_title(const std::string& title) = 0;
78  virtual void set_line_label(unsigned int which, const std::string& label) = 0;
79  virtual void set_line_color(unsigned int which, const std::string& color) = 0;
80  virtual void set_line_width(unsigned int which, int width) = 0;
81  virtual void set_line_style(unsigned int which, int style) = 0;
82  virtual void set_line_marker(unsigned int which, int marker) = 0;
83  virtual void set_nsamps(const int newsize) = 0;
84  virtual void set_line_alpha(unsigned int which, double alpha) = 0;
85 
86  /*!
87  * Set up a trigger for the sink to know when to start
88  * plotting. Useful to isolate events and avoid noise.
89  *
90  * The trigger modes are Free, Auto, Normal, and Tag (see
91  * gr::qtgui::trigger_mode). The first three are like a normal
92  * oscope trigger function. Free means free running with no
93  * trigger, auto will trigger if the trigger event is seen, but
94  * will still plot otherwise, and normal will hold until the
95  * trigger event is observed. The Tag trigger mode allows us to
96  * trigger off a specific stream tag. The tag trigger is based
97  * only on the name of the tag, so when a tag of the given name
98  * is seen, the trigger is activated.
99  *
100  * In auto and normal mode, we look for the slope of the
101  * magnitude of the signal. As a constellation sink, this only
102  * takes in complex numbers to plot. Given a
103  * gr::qtgui::trigger_slope as either Positive or Negative, if
104  * the magnitude between two samples moves in the given
105  * direction (x[1] > x[0] for Positive or x[1] < x[0] for
106  * Negative), then the trigger is activated.
107  *
108  * \param mode The trigger_mode: free, auto, normal, or tag.
109  * \param slope The trigger_slope: positive or negative. Only
110  * used for auto and normal modes.
111  * \param level The magnitude of the trigger even for auto or normal modes.
112  * \param channel Which input channel to use for the trigger events.
113  * \param tag_key The name (as a string) of the tag to trigger off
114  * of if using the tag mode.
115  */
116  virtual void set_trigger_mode(trigger_mode mode,
117  trigger_slope slope,
118  float level,
119  int channel,
120  const std::string& tag_key = "") = 0;
121 
122  virtual std::string title() = 0;
123  virtual std::string line_label(unsigned int which) = 0;
124  virtual std::string line_color(unsigned int which) = 0;
125  virtual int line_width(unsigned int which) = 0;
126  virtual int line_style(unsigned int which) = 0;
127  virtual int line_marker(unsigned int which) = 0;
128  virtual double line_alpha(unsigned int which) = 0;
129 
130  virtual void set_size(int width, int height) = 0;
131 
132  virtual void enable_menu(bool en = true) = 0;
133  virtual void enable_autoscale(bool en) = 0;
134  virtual void enable_grid(bool en) = 0;
135  virtual void enable_axis_labels(bool en = true) = 0;
136  virtual void disable_legend() = 0;
137  virtual int nsamps() const = 0;
138  virtual void reset() = 0;
139 
140  QApplication* d_qApplication;
141 };
142 
143 } /* namespace qtgui */
144 } /* namespace gr */
145 
146 #endif /* INCLUDED_QTGUI_CONST_SINK_C_H */
A graphical sink to display the IQ constellation of multiple signals.
Definition: const_sink_c.h:48
virtual int nsamps() const =0
virtual void reset()=0
virtual void set_line_width(unsigned int which, int width)=0
virtual void exec_()=0
virtual int line_marker(unsigned int which)=0
virtual void set_x_axis(double min, double max)=0
virtual std::string line_color(unsigned int which)=0
QApplication * d_qApplication
Definition: const_sink_c.h:140
virtual double line_alpha(unsigned int which)=0
virtual void set_line_style(unsigned int which, int style)=0
virtual int line_style(unsigned int which)=0
virtual void set_size(int width, int height)=0
virtual void set_trigger_mode(trigger_mode mode, trigger_slope slope, float level, int channel, const std::string &tag_key="")=0
std::shared_ptr< const_sink_c > sptr
Definition: const_sink_c.h:51
virtual void set_nsamps(const int newsize)=0
virtual void enable_grid(bool en)=0
virtual QWidget * qwidget()=0
virtual void enable_menu(bool en=true)=0
virtual void * pyqwidget()=0
virtual void set_y_axis(double min, double max)=0
virtual void set_title(const std::string &title)=0
virtual std::string title()=0
virtual void set_update_time(double t)=0
virtual void set_line_color(unsigned int which, const std::string &color)=0
static sptr make(int size, const std::string &name, int nconnections=1, QWidget *parent=NULL)
Build a constellation plot sink.
virtual void enable_axis_labels(bool en=true)=0
virtual void set_line_alpha(unsigned int which, double alpha)=0
virtual std::string line_label(unsigned int which)=0
virtual void disable_legend()=0
virtual void set_line_marker(unsigned int which, int marker)=0
virtual void set_line_label(unsigned int which, const std::string &label)=0
virtual int line_width(unsigned int which)=0
virtual void enable_autoscale(bool en)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18
trigger_mode
Definition: trigger_mode.h:17
trigger_slope
Definition: trigger_mode.h:24
float min(float a, float b)
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29