GNU Radio Manual and C++ API Reference 3.10.4.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
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
19#include <gnuradio/qtgui/api.h>
21#include <gnuradio/sync_block.h>
22#include <qapplication.h>
23
24namespace gr {
25namespace 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 */
47class QTGUI_API const_sink_c : virtual public sync_block
48{
49public:
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 virtual void set_y_axis(double min, double max) = 0;
68 virtual void set_x_axis(double min, double max) = 0;
69
70 virtual void set_update_time(double t) = 0;
71 virtual void set_title(const std::string& title) = 0;
72 virtual void set_line_label(unsigned int which, const std::string& label) = 0;
73 virtual void set_line_color(unsigned int which, const std::string& color) = 0;
74 virtual void set_line_width(unsigned int which, int width) = 0;
75 virtual void set_line_style(unsigned int which, int style) = 0;
76 virtual void set_line_marker(unsigned int which, int marker) = 0;
77 virtual void set_nsamps(const int newsize) = 0;
78 virtual void set_line_alpha(unsigned int which, double alpha) = 0;
79
80 /*!
81 * Set up a trigger for the sink to know when to start
82 * plotting. Useful to isolate events and avoid noise.
83 *
84 * The trigger modes are Free, Auto, Normal, and Tag (see
85 * gr::qtgui::trigger_mode). The first three are like a normal
86 * oscope trigger function. Free means free running with no
87 * trigger, auto will trigger if the trigger event is seen, but
88 * will still plot otherwise, and normal will hold until the
89 * trigger event is observed. The Tag trigger mode allows us to
90 * trigger off a specific stream tag. The tag trigger is based
91 * only on the name of the tag, so when a tag of the given name
92 * is seen, the trigger is activated.
93 *
94 * In auto and normal mode, we look for the slope of the
95 * magnitude of the signal. As a constellation sink, this only
96 * takes in complex numbers to plot. Given a
97 * gr::qtgui::trigger_slope as either Positive or Negative, if
98 * the magnitude between two samples moves in the given
99 * direction (x[1] > x[0] for Positive or x[1] < x[0] for
100 * Negative), then the trigger is activated.
101 *
102 * \param mode The trigger_mode: free, auto, normal, or tag.
103 * \param slope The trigger_slope: positive or negative. Only
104 * used for auto and normal modes.
105 * \param level The magnitude of the trigger even for auto or normal modes.
106 * \param channel Which input channel to use for the trigger events.
107 * \param tag_key The name (as a string) of the tag to trigger off
108 * of if using the tag mode.
109 */
111 trigger_slope slope,
112 float level,
113 int channel,
114 const std::string& tag_key = "") = 0;
115
116 virtual std::string title() = 0;
117 virtual std::string line_label(unsigned int which) = 0;
118 virtual std::string line_color(unsigned int which) = 0;
119 virtual int line_width(unsigned int which) = 0;
120 virtual int line_style(unsigned int which) = 0;
121 virtual int line_marker(unsigned int which) = 0;
122 virtual double line_alpha(unsigned int which) = 0;
123
124 virtual void set_size(int width, int height) = 0;
125
126 virtual void enable_menu(bool en = true) = 0;
127 virtual void enable_autoscale(bool en) = 0;
128 virtual void enable_grid(bool en) = 0;
129 virtual void enable_axis_labels(bool en = true) = 0;
130 virtual void disable_legend() = 0;
131 virtual int nsamps() const = 0;
132 virtual void reset() = 0;
133
134 // Disallow copy/move because of the pointer.
135 const_sink_c(const const_sink_c&) = delete;
139
140 QApplication* d_qApplication;
141
142protected:
143 const_sink_c() = default;
144};
145
146} /* namespace qtgui */
147} /* namespace gr */
148
149#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
const_sink_c & operator=(const const_sink_c &)=delete
virtual void set_line_style(unsigned int which, int style)=0
const_sink_c(const_sink_c &&)=delete
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 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
const_sink_c(const const_sink_c &)=delete
const_sink_c & operator=(const_sink_c &&)=delete
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
GNU Radio logging wrapper.
Definition: basic_block.h:29