GNU Radio C++ API Reference: SpectrumGUIClass.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
SpectrumGUIClass.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2008-2011 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 SPECTRUM_GUI_CLASS_HPP
12#define SPECTRUM_GUI_CLASS_HPP
13
14#include <gnuradio/qtgui/spectrumUpdateEvents.h>
15#include <gnuradio/thread/thread.h>
16#include <qapplication.h>
17#include <qlabel.h>
18#include <qslider.h>
19#include <qwidget.h>
20
21class SpectrumDisplayForm;
22#include <gnuradio/qtgui/spectrumdisplayform.h>
23
24#include <cmath>
25
26#include <complex>
27#include <string>
28#include <vector>
29
30/*!
31 * \brief QWidget class for controlling plotting.
32 * \ingroup qtgui_blk
33 */
34 class SpectrumGUIClass
35{
36public:
37 SpectrumGUIClass(const uint64_t maxDataSize,
38 const uint64_t fftSize,
39 const double newCenterFrequency,
40 const double newStartFrequency,
41 const double newStopFrequency);
42 ~SpectrumGUIClass();
43
44 // Disable copy/move because of raw QT pointers.
45 SpectrumGUIClass(const SpectrumGUIClass&) = delete;
46 SpectrumGUIClass(SpectrumGUIClass&&) = delete;
47 SpectrumGUIClass& operator=(const SpectrumGUIClass&) = delete;
48 SpectrumGUIClass& operator=(SpectrumGUIClass&&) = delete;
49
50 void reset();
51
52 void openSpectrumWindow(QWidget*,
53 const bool frequency = true,
54 const bool waterfall = true,
55 const bool time = true,
56 const bool constellation = true);
57 void setDisplayTitle(const std::string);
58
59 bool getWindowOpenFlag();
60 void setWindowOpenFlag(const bool);
61
62 void setFrequencyRange(const double, const double, const double);
63 double getStartFrequency();
64 double getStopFrequency();
65 double getCenterFrequency();
66
67 void updateWindow(const bool,
68 const float*,
69 const uint64_t,
70 const float*,
71 const uint64_t,
72 const float*,
73 const uint64_t,
74 const gr::high_res_timer_type,
75 const bool);
76
77 float getPowerValue();
78 void setPowerValue(const float);
79
80 int getWindowType();
81 void setWindowType(const int);
82
83 int getFFTSize();
84 int getFFTSizeIndex();
85 void setFFTSize(const int);
86
87 gr::high_res_timer_type getLastGUIUpdateTime();
88 void setLastGUIUpdateTime(const gr::high_res_timer_type);
89
90 unsigned int getPendingGUIUpdateEvents();
91 void incrementPendingGUIUpdateEvents();
92 void decrementPendingGUIUpdateEvents();
93 void resetPendingGUIUpdateEvents();
94
95 static const long MAX_FFT_SIZE;
96 static const long MIN_FFT_SIZE;
97 static const long DEFAULT_FFT_SIZE;
98
99 QWidget* qwidget();
100
101 void setTimeDomainAxis(double min, double max);
102 void setConstellationAxis(double xmin, double xmax, double ymin, double ymax);
103 void setConstellationPenSize(int size);
104 void setFrequencyAxis(double min, double max);
105
106 void setUpdateTime(double t);
107
108 void enableRFFreq(bool en);
109
110 bool checkClicked();
111 float getClickedFreq();
112
113protected:
114private:
115 gr::thread::mutex d_mutex;
116 const int64_t _dataPoints;
117 std::string _title;
118 double _centerFrequency;
119 double _startFrequency;
120 double _stopFrequency;
121 float _powerValue = 1;
122 bool _windowOpennedFlag = false;
123 int _windowType = 5;
124 int64_t _lastDataPointCount;
125 int _fftSize;
126 gr::high_res_timer_type _lastGUIUpdateTime = 0;
127 unsigned int _pendingGUIUpdateEventsCount = 0;
128 int _droppedEntriesCount = 0;
129 double _updateTime = 0.5;
130
131 SpectrumDisplayForm* _spectrumDisplayForm = nullptr; // Deleted by QT.
132
133 std::vector<float> _fftPoints;
134 std::vector<double> _realTimeDomainPoints;
135 std::vector<double> _imagTimeDomainPoints;
136};
137
138#endif /* SPECTRUM_GUI_CLASS_HPP */
SpectrumDisplayForm
Definition spectrumdisplayform.h:30
SpectrumGUIClass::SpectrumGUIClass
SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency)
SpectrumGUIClass::setFFTSize
void setFFTSize(const int)
SpectrumGUIClass::setWindowType
void setWindowType(const int)
SpectrumGUIClass::getFFTSizeIndex
int getFFTSizeIndex()
SpectrumGUIClass::setDisplayTitle
void setDisplayTitle(const std::string)
SpectrumGUIClass::~SpectrumGUIClass
~SpectrumGUIClass()
SpectrumGUIClass::setPowerValue
void setPowerValue(const float)
SpectrumGUIClass::resetPendingGUIUpdateEvents
void resetPendingGUIUpdateEvents()
SpectrumGUIClass::setFrequencyAxis
void setFrequencyAxis(double min, double max)
SpectrumGUIClass::reset
void reset()
SpectrumGUIClass::setWindowOpenFlag
void setWindowOpenFlag(const bool)
SpectrumGUIClass::SpectrumGUIClass
SpectrumGUIClass(const SpectrumGUIClass &)=delete
SpectrumGUIClass::setConstellationPenSize
void setConstellationPenSize(int size)
SpectrumGUIClass::getCenterFrequency
double getCenterFrequency()
SpectrumGUIClass::getClickedFreq
float getClickedFreq()
SpectrumGUIClass::operator=
SpectrumGUIClass & operator=(const SpectrumGUIClass &)=delete
SpectrumGUIClass::DEFAULT_FFT_SIZE
static const long DEFAULT_FFT_SIZE
Definition SpectrumGUIClass.h:97
SpectrumGUIClass::setLastGUIUpdateTime
void setLastGUIUpdateTime(const gr::high_res_timer_type)
SpectrumGUIClass::openSpectrumWindow
void openSpectrumWindow(QWidget *, const bool frequency=true, const bool waterfall=true, const bool time=true, const bool constellation=true)
SpectrumGUIClass::MIN_FFT_SIZE
static const long MIN_FFT_SIZE
Definition SpectrumGUIClass.h:96
SpectrumGUIClass::incrementPendingGUIUpdateEvents
void incrementPendingGUIUpdateEvents()
SpectrumGUIClass::getWindowOpenFlag
bool getWindowOpenFlag()
SpectrumGUIClass::getLastGUIUpdateTime
gr::high_res_timer_type getLastGUIUpdateTime()
SpectrumGUIClass::setConstellationAxis
void setConstellationAxis(double xmin, double xmax, double ymin, double ymax)
SpectrumGUIClass::setFrequencyRange
void setFrequencyRange(const double, const double, const double)
SpectrumGUIClass::qwidget
QWidget * qwidget()
SpectrumGUIClass::decrementPendingGUIUpdateEvents
void decrementPendingGUIUpdateEvents()
SpectrumGUIClass::getWindowType
int getWindowType()
SpectrumGUIClass::MAX_FFT_SIZE
static const long MAX_FFT_SIZE
Definition SpectrumGUIClass.h:95
SpectrumGUIClass::setTimeDomainAxis
void setTimeDomainAxis(double min, double max)
SpectrumGUIClass::enableRFFreq
void enableRFFreq(bool en)
SpectrumGUIClass::updateWindow
void updateWindow(const bool, const float *, const uint64_t, const float *, const uint64_t, const float *, const uint64_t, const gr::high_res_timer_type, const bool)
SpectrumGUIClass::getPowerValue
float getPowerValue()
SpectrumGUIClass::getStopFrequency
double getStopFrequency()
SpectrumGUIClass::checkClicked
bool checkClicked()
SpectrumGUIClass::operator=
SpectrumGUIClass & operator=(SpectrumGUIClass &&)=delete
SpectrumGUIClass::setUpdateTime
void setUpdateTime(double t)
SpectrumGUIClass::SpectrumGUIClass
SpectrumGUIClass(SpectrumGUIClass &&)=delete
SpectrumGUIClass::getFFTSize
int getFFTSize()
SpectrumGUIClass::getStartFrequency
double getStartFrequency()
SpectrumGUIClass::getPendingGUIUpdateEvents
unsigned int getPendingGUIUpdateEvents()
gr::thread::mutex
boost::mutex mutex
Definition thread.h:37
gr::high_res_timer_type
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition high_res_timer.h:40
spectrumUpdateEvents.h
spectrumdisplayform.h
thread.h