GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
freqdisplayform.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 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 FREQ_DISPLAY_FORM_H
12 #define FREQ_DISPLAY_FORM_H
13 
14 #include <gnuradio/fft/window.h>
17 #include <QtGui/QtGui>
18 #include <vector>
19 
21 
22 class FreqControlPanel;
23 
24 /*!
25  * \brief DisplayForm child for managing frequency (PSD) plots.
26  * \ingroup qtgui_blk
27  */
29 {
30  Q_OBJECT
31 
32 public:
33  FreqDisplayForm(int nplots = 1, QWidget* parent = 0);
34  ~FreqDisplayForm() override;
35 
37 
38  int getFFTSize() const;
39  float getFFTAverage() const;
41 
42  // Trigger methods
44  float getTriggerLevel() const;
45  int getTriggerChannel() const;
46  std::string getTriggerTagKey() const;
47 
48 
49  // returns the frequency that was last double-clicked on by the user
50  float getClickedFreq() const;
51 
52  // checks if there was a double-click event; reset if there was
53  bool checkClicked();
54 
55  const int MIN_FFT_SIZE = 32;
56  const int MAX_FFT_SIZE = 32768;
57  const int FFT_DEFAULT_SIZE = 1024;
58 
59 public slots:
60  void customEvent(QEvent* e) override;
61 
62  void setSampleRate(const QString& samprate) override;
63  void setFFTSize(const int);
64  void setFFTAverage(const float);
66 
67  void setFrequencyRange(const double centerfreq, const double bandwidth);
68  void setYaxis(double min, double max);
69  void setYLabel(const std::string& label, const std::string& unit = "");
70  void setYMax(const QString& m);
71  void setYMin(const QString& m);
72  void autoScale(bool en) override;
73  void autoScaleShot();
74  void setPlotPosHalf(bool half);
75  void clearMaxHold();
76  void clearMinHold();
77 
78  // Trigger slots
81  void setTriggerLevel(QString s);
82  void setTriggerLevel(float level);
83  void setTriggerChannel(int chan);
84  void setTriggerTagKey(QString s);
85  void setTriggerTagKey(const std::string& s);
86 
87  void setupControlPanel(bool en);
90 
95  void notifyFFTSize(const QString& s);
96  void notifyFFTWindow(const QString& s);
97  void notifyMaxHold(bool en);
98  void notifyMinHold(bool en);
99  void notifyTriggerMode(const QString& mode);
102 
103 signals:
104  void signalFFTSize(int size);
108  void signalSetMaxFFTVisible(bool en);
109  void signalSetMinFFTVisible(bool en);
111  void signalTriggerLevel(float level);
112  void signalReplot();
113 
114 
115 private slots:
116  void newData(const QEvent* updateEvent) override;
117  void onPlotPointSelected(const QPointF p) override;
118 
119 private:
120  QIntValidator* d_int_validator;
121 
122  double d_samp_rate, d_center_freq;
123  int d_fftsize;
124  float d_fftavg;
125  gr::fft::window::win_type d_fftwintype;
126  double d_units;
127 
128  bool d_clicked;
129  double d_clicked_freq;
130 
131  FFTAverageMenu* d_avgmenu;
132  FFTWindowMenu* d_winmenu;
133  QAction *d_minhold_act, *d_maxhold_act;
134 
135  QMenu* d_triggermenu;
136  TriggerModeMenu* d_tr_mode_menu;
137  PopupMenu* d_tr_level_act;
138  TriggerChannelMenu* d_tr_channel_menu;
139  PopupMenu* d_tr_tag_key_act;
140 
141  gr::qtgui::trigger_mode d_trig_mode;
142  float d_trig_level;
143  int d_trig_channel;
144  std::string d_trig_tag_key;
145 
146  QAction* d_controlpanelmenu;
147  FreqControlPanel* d_controlpanel;
148 };
149 
150 #endif /* FREQ_DISPLAY_FORM_H */
Base class for setting up and managing QTGUI plot forms.
Definition: displayform.h:30
Definition: form_menus.h:561
Definition: form_menus.h:575
Definition: freqcontrolpanel.h:27
DisplayForm child for managing frequency (PSD) plots.
Definition: freqdisplayform.h:29
void customEvent(QEvent *e) override
void notifyYRangeMinus()
const int FFT_DEFAULT_SIZE
Definition: freqdisplayform.h:57
void setTriggerLevel(QString s)
FrequencyDisplayPlot * getPlot() override
void setupControlPanel()
void setSampleRate(const QString &samprate) override
void setYaxis(double min, double max)
void signalFFTSize(int size)
int getFFTSize() const
void setPlotPosHalf(bool half)
void setYMax(const QString &m)
void signalClearMaxData()
void signalSetMaxFFTVisible(bool en)
std::string getTriggerTagKey() const
void notifyMaxHold(bool en)
void notifyYRangePlus()
void notifyTriggerMode(const QString &mode)
void setTriggerTagKey(const std::string &s)
void setTriggerChannel(int chan)
void autoScaleShot()
void setYMin(const QString &m)
void teardownControlPanel()
float getTriggerLevel() const
void setTriggerTagKey(QString s)
void updateTrigger(gr::qtgui::trigger_mode mode)
void setYLabel(const std::string &label, const std::string &unit="")
void setFFTWindowType(const gr::fft::window::win_type)
void autoScale(bool en) override
void setFFTAverage(const float)
float getClickedFreq() const
const int MIN_FFT_SIZE
Definition: freqdisplayform.h:55
void signalTriggerMode(gr::qtgui::trigger_mode mode)
gr::fft::window::win_type getFFTWindowType() const
void notifyFFTWindow(const QString &s)
void notifyFFTSize(const QString &s)
void setTriggerLevel(float level)
FreqDisplayForm(int nplots=1, QWidget *parent=0)
void signalFFTWindow(gr::fft::window::win_type win)
void notifyYAxisPlus()
int getTriggerChannel() const
void setFrequencyRange(const double centerfreq, const double bandwidth)
~FreqDisplayForm() override
void signalClearMinData()
void signalTriggerLevel(float level)
float getFFTAverage() const
gr::qtgui::trigger_mode getTriggerMode() const
void notifyTriggerLevelPlus()
void signalSetMinFFTVisible(bool en)
void setupControlPanel(bool en)
void notifyYAxisMinus()
void setTriggerMode(gr::qtgui::trigger_mode mode)
const int MAX_FFT_SIZE
Definition: freqdisplayform.h:56
void notifyTriggerLevelMinus()
void notifyMinHold(bool en)
void setFFTSize(const int)
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:24
Definition: form_menus.h:1191
Definition: form_menus.h:986
Definition: form_menus.h:843
win_type
Definition: window.h:28
trigger_mode
Definition: trigger_mode.h:17
float min(float a, float b)