GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
spectrumUpdateEvents.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008-2014 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_UPDATE_EVENTS_H
12 #define SPECTRUM_UPDATE_EVENTS_H
13 
15 #include <gnuradio/qtgui/api.h>
16 #include <gnuradio/tags.h>
17 #include <volk/volk_alloc.hh>
18 #include <QEvent>
19 #include <QString>
20 #include <complex>
21 #include <cstdint>
22 #include <vector>
23 
24 static constexpr int SpectrumUpdateEventType = 10005;
25 static constexpr int SpectrumWindowCaptionEventType = 10008;
26 static constexpr int SpectrumWindowResetEventType = 10009;
27 static constexpr int SpectrumFrequencyRangeEventType = 10010;
28 
29 class SpectrumUpdateEvent : public QEvent
30 {
31 
32 public:
33  SpectrumUpdateEvent(const float* fftPoints,
34  const uint64_t numFFTDataPoints,
35  const double* realTimeDomainPoints,
36  const double* imagTimeDomainPoints,
37  const uint64_t numTimeDomainDataPoints,
38  const gr::high_res_timer_type dataTimestamp,
39  const bool repeatDataFlag,
40  const bool lastOfMultipleUpdateFlag,
41  const gr::high_res_timer_type generatedTimestamp,
42  const int droppedFFTFrames);
43 
45 
46  const float* getFFTPoints() const;
47  const double* getRealTimeDomainPoints() const;
48  const double* getImagTimeDomainPoints() const;
49  uint64_t getNumFFTDataPoints() const;
50  uint64_t getNumTimeDomainDataPoints() const;
52  bool getRepeatDataFlag() const;
55  int getDroppedFFTFrames() const;
56 
57 protected:
58 private:
59  std::vector<float> d_fft_points;
60  std::vector<double> d_real_data_time_domain_points;
61  std::vector<double> d_imag_data_time_domain_points;
62  gr::high_res_timer_type _dataTimestamp;
63  bool _repeatDataFlag;
64  bool _lastOfMultipleUpdateFlag;
65  gr::high_res_timer_type _eventGeneratedTimestamp;
66  int _droppedFFTFrames;
67 };
68 
69 class SpectrumWindowCaptionEvent : public QEvent
70 {
71 public:
72  SpectrumWindowCaptionEvent(const QString&);
74  QString getLabel();
75 
76 protected:
77 private:
78  QString _labelString;
79 };
80 
81 class SpectrumWindowResetEvent : public QEvent
82 {
83 public:
86 
87 protected:
88 private:
89 };
90 
91 class SpectrumFrequencyRangeEvent : public QEvent
92 {
93 public:
94  SpectrumFrequencyRangeEvent(const double, const double, const double);
96  double GetCenterFrequency() const;
97  double GetStartFrequency() const;
98  double GetStopFrequency() const;
99 
100 protected:
101 private:
102  double _centerFrequency;
103  double _startFrequency;
104  double _stopFrequency;
105 };
106 
107 
108 class TimeUpdateEvent : public QEvent
109 {
110 public:
111  TimeUpdateEvent(const std::vector<volk::vector<double>> timeDomainPoints,
112  const uint64_t numTimeDomainDataPoints,
113  const std::vector<std::vector<gr::tag_t>> tags);
114 
115  ~TimeUpdateEvent() override;
116 
117  int which() const;
118  const std::vector<double*> getTimeDomainPoints() const;
119  uint64_t getNumTimeDomainDataPoints() const;
120  bool getRepeatDataFlag() const;
121 
122  const std::vector<std::vector<gr::tag_t>> getTags() const;
123 
124  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
125 
126 protected:
127 private:
128  size_t _nplots;
129  std::vector<double*> _dataTimeDomainPoints;
130  uint64_t _numTimeDomainDataPoints;
131  std::vector<std::vector<gr::tag_t>> _tags;
132 };
133 
134 
135 /********************************************************************/
136 
137 
138 class FreqUpdateEvent : public QEvent
139 {
140 public:
141  FreqUpdateEvent(const std::vector<volk::vector<double>> dataPoints,
142  const uint64_t numDataPoints);
143 
144  ~FreqUpdateEvent() override;
145 
146  int which() const;
147  const std::vector<double*> getPoints() const;
148  uint64_t getNumDataPoints() const;
149  bool getRepeatDataFlag() const;
150 
151  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
152 
153 protected:
154 private:
155  size_t _nplots;
156  std::vector<double*> _dataPoints;
157  uint64_t _numDataPoints;
158 };
159 
160 
161 class SetFreqEvent : public QEvent
162 {
163 public:
164  SetFreqEvent(const double, const double);
165  ~SetFreqEvent() override;
166  double getCenterFrequency() const;
167  double getBandwidth() const;
168 
169 private:
170  double _centerFrequency;
171  double _bandwidth;
172 };
173 
174 
175 /********************************************************************/
176 
177 
178 class QTGUI_API ConstUpdateEvent : public QEvent
179 {
180 public:
181  ConstUpdateEvent(const std::vector<volk::vector<double>> realDataPoints,
182  const std::vector<volk::vector<double>> imagDataPoints,
183  const uint64_t numDataPoints);
184 
185  ~ConstUpdateEvent() override;
186 
187  int which() const;
188  const std::vector<double*> getRealPoints() const;
189  const std::vector<double*> getImagPoints() const;
190  uint64_t getNumDataPoints() const;
191  bool getRepeatDataFlag() const;
192 
193  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
194 
195 protected:
196 private:
197  size_t _nplots;
198  std::vector<double*> _realDataPoints;
199  std::vector<double*> _imagDataPoints;
200  uint64_t _numDataPoints;
201 };
202 
203 
204 /********************************************************************/
205 
206 
207 class WaterfallUpdateEvent : public QEvent
208 {
209 public:
210  WaterfallUpdateEvent(const std::vector<volk::vector<double>> dataPoints,
211  const uint64_t numDataPoints,
212  const gr::high_res_timer_type dataTimestamp);
213 
215 
216  int which() const;
217  const std::vector<double*> getPoints() const;
218  uint64_t getNumDataPoints() const;
219  bool getRepeatDataFlag() const;
220 
222 
223  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
224 
225 protected:
226 private:
227  size_t _nplots;
228  std::vector<double*> _dataPoints;
229  uint64_t _numDataPoints;
230 
231  gr::high_res_timer_type _dataTimestamp;
232 };
233 
234 
235 /********************************************************************/
236 
237 
238 class TimeRasterUpdateEvent : public QEvent
239 {
240 public:
241  TimeRasterUpdateEvent(const std::vector<volk::vector<double>> dataPoints,
242  const uint64_t numDataPoints);
244 
245  int which() const;
246  const std::vector<double*> getPoints() const;
247  uint64_t getNumDataPoints() const;
248  bool getRepeatDataFlag() const;
249 
250  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
251 
252 protected:
253 private:
254  size_t _nplots;
255  std::vector<double*> _dataPoints;
256  uint64_t _numDataPoints;
257 };
258 
259 
260 class TimeRasterSetSize : public QEvent
261 {
262 public:
263  TimeRasterSetSize(const double nrows, const double ncols);
264  ~TimeRasterSetSize() override;
265 
266  double nRows() const;
267  double nCols() const;
268 
269  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType + 1); }
270 
271 private:
272  double _nrows;
273  double _ncols;
274 };
275 
276 
277 /********************************************************************/
278 
279 
280 class HistogramUpdateEvent : public QEvent
281 {
282 public:
283  HistogramUpdateEvent(const std::vector<volk::vector<double>> points,
284  const uint64_t npoints);
285 
287 
288  int which() const;
289  const std::vector<double*> getDataPoints() const;
290  uint64_t getNumDataPoints() const;
291  bool getRepeatDataFlag() const;
292 
293  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
294 
295 protected:
296 private:
297  size_t _nplots;
298  std::vector<double*> _points;
299  uint64_t _npoints;
300 };
301 
302 
303 class HistogramSetAccumulator : public QEvent
304 {
305 public:
306  HistogramSetAccumulator(const bool en);
308 
309  bool getAccumulator() const;
310 
311  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType + 1); }
312 
313 private:
314  bool _en;
315 };
316 
317 class HistogramClearEvent : public QEvent
318 {
319 public:
321 
322  ~HistogramClearEvent() override {}
323 
324  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType + 2); }
325 };
326 
327 
328 /********************************************************************/
329 
330 
331 class NumberUpdateEvent : public QEvent
332 {
333 public:
334  NumberUpdateEvent(const std::vector<float> samples);
335  ~NumberUpdateEvent() override;
336 
337  int which() const;
338  const std::vector<float> getSamples() const;
339 
340  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
341 
342 protected:
343 private:
344  size_t _nplots;
345  std::vector<float> _samples;
346 };
347 
348 
349 #endif /* SPECTRUM_UPDATE_EVENTS_H */
Definition: spectrumUpdateEvents.h:179
ConstUpdateEvent(const std::vector< volk::vector< double >> realDataPoints, const std::vector< volk::vector< double >> imagDataPoints, const uint64_t numDataPoints)
int which() const
~ConstUpdateEvent() override
const std::vector< double * > getRealPoints() const
const std::vector< double * > getImagPoints() const
bool getRepeatDataFlag() const
uint64_t getNumDataPoints() const
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:193
Definition: spectrumUpdateEvents.h:139
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:151
~FreqUpdateEvent() override
int which() const
const std::vector< double * > getPoints() const
uint64_t getNumDataPoints() const
bool getRepeatDataFlag() const
FreqUpdateEvent(const std::vector< volk::vector< double >> dataPoints, const uint64_t numDataPoints)
Definition: spectrumUpdateEvents.h:318
~HistogramClearEvent() override
Definition: spectrumUpdateEvents.h:322
HistogramClearEvent()
Definition: spectrumUpdateEvents.h:320
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:324
Definition: spectrumUpdateEvents.h:304
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:311
bool getAccumulator() const
HistogramSetAccumulator(const bool en)
~HistogramSetAccumulator() override
Definition: spectrumUpdateEvents.h:281
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:293
bool getRepeatDataFlag() const
const std::vector< double * > getDataPoints() const
uint64_t getNumDataPoints() const
HistogramUpdateEvent(const std::vector< volk::vector< double >> points, const uint64_t npoints)
~HistogramUpdateEvent() override
Definition: spectrumUpdateEvents.h:332
~NumberUpdateEvent() override
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:340
const std::vector< float > getSamples() const
NumberUpdateEvent(const std::vector< float > samples)
int which() const
Definition: spectrumUpdateEvents.h:162
~SetFreqEvent() override
SetFreqEvent(const double, const double)
double getBandwidth() const
double getCenterFrequency() const
Definition: spectrumUpdateEvents.h:92
~SpectrumFrequencyRangeEvent() override
double GetCenterFrequency() const
SpectrumFrequencyRangeEvent(const double, const double, const double)
double GetStartFrequency() const
double GetStopFrequency() const
Definition: spectrumUpdateEvents.h:30
int getDroppedFFTFrames() const
~SpectrumUpdateEvent() override
gr::high_res_timer_type getEventGeneratedTimestamp() const
const double * getImagTimeDomainPoints() const
uint64_t getNumFFTDataPoints() const
const double * getRealTimeDomainPoints() const
bool getRepeatDataFlag() const
SpectrumUpdateEvent(const float *fftPoints, const uint64_t numFFTDataPoints, const double *realTimeDomainPoints, const double *imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, const gr::high_res_timer_type dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, const gr::high_res_timer_type generatedTimestamp, const int droppedFFTFrames)
const float * getFFTPoints() const
gr::high_res_timer_type getDataTimestamp() const
bool getLastOfMultipleUpdateFlag() const
uint64_t getNumTimeDomainDataPoints() const
Definition: spectrumUpdateEvents.h:70
SpectrumWindowCaptionEvent(const QString &)
~SpectrumWindowCaptionEvent() override
Definition: spectrumUpdateEvents.h:82
~SpectrumWindowResetEvent() override
Definition: spectrumUpdateEvents.h:261
double nCols() const
~TimeRasterSetSize() override
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:269
double nRows() const
TimeRasterSetSize(const double nrows, const double ncols)
Definition: spectrumUpdateEvents.h:239
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:250
~TimeRasterUpdateEvent() override
bool getRepeatDataFlag() const
uint64_t getNumDataPoints() const
TimeRasterUpdateEvent(const std::vector< volk::vector< double >> dataPoints, const uint64_t numDataPoints)
const std::vector< double * > getPoints() const
Definition: spectrumUpdateEvents.h:109
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:124
TimeUpdateEvent(const std::vector< volk::vector< double >> timeDomainPoints, const uint64_t numTimeDomainDataPoints, const std::vector< std::vector< gr::tag_t >> tags)
uint64_t getNumTimeDomainDataPoints() const
const std::vector< std::vector< gr::tag_t > > getTags() const
const std::vector< double * > getTimeDomainPoints() const
int which() const
~TimeUpdateEvent() override
bool getRepeatDataFlag() const
Definition: spectrumUpdateEvents.h:208
~WaterfallUpdateEvent() override
WaterfallUpdateEvent(const std::vector< volk::vector< double >> dataPoints, const uint64_t numDataPoints, const gr::high_res_timer_type dataTimestamp)
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:223
bool getRepeatDataFlag() const
uint64_t getNumDataPoints() const
const std::vector< double * > getPoints() const
gr::high_res_timer_type getDataTimestamp() const
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:40
static constexpr int SpectrumWindowCaptionEventType
Definition: spectrumUpdateEvents.h:25
static constexpr int SpectrumWindowResetEventType
Definition: spectrumUpdateEvents.h:26
static constexpr int SpectrumFrequencyRangeEventType
Definition: spectrumUpdateEvents.h:27
static constexpr int SpectrumUpdateEventType
Definition: spectrumUpdateEvents.h:24