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