GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
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 <QEvent>
18 #include <QString>
19 #include <complex>
20 #include <cstdint>
21 #include <vector>
22 
23 static constexpr int SpectrumUpdateEventType = 10005;
24 static constexpr int SpectrumWindowCaptionEventType = 10008;
25 static constexpr int SpectrumWindowResetEventType = 10009;
26 static constexpr int SpectrumFrequencyRangeEventType = 10010;
27 
28 class SpectrumUpdateEvent : public QEvent
29 {
30 
31 public:
32  SpectrumUpdateEvent(const float* fftPoints,
33  const uint64_t numFFTDataPoints,
34  const double* realTimeDomainPoints,
35  const double* imagTimeDomainPoints,
36  const uint64_t numTimeDomainDataPoints,
37  const gr::high_res_timer_type dataTimestamp,
38  const bool repeatDataFlag,
39  const bool lastOfMultipleUpdateFlag,
40  const gr::high_res_timer_type generatedTimestamp,
41  const int droppedFFTFrames);
42 
44 
45  const float* getFFTPoints() const;
46  const double* getRealTimeDomainPoints() const;
47  const double* getImagTimeDomainPoints() const;
48  uint64_t getNumFFTDataPoints() const;
49  uint64_t getNumTimeDomainDataPoints() const;
51  bool getRepeatDataFlag() const;
54  int getDroppedFFTFrames() const;
55 
56 protected:
57 private:
58  float* _fftPoints;
59  double* _realDataTimeDomainPoints;
60  double* _imagDataTimeDomainPoints;
61  uint64_t _numFFTDataPoints;
62  uint64_t _numTimeDomainDataPoints;
63  gr::high_res_timer_type _dataTimestamp;
64  bool _repeatDataFlag;
65  bool _lastOfMultipleUpdateFlag;
66  gr::high_res_timer_type _eventGeneratedTimestamp;
67  int _droppedFFTFrames;
68 };
69 
70 class SpectrumWindowCaptionEvent : public QEvent
71 {
72 public:
73  SpectrumWindowCaptionEvent(const QString&);
75  QString getLabel();
76 
77 protected:
78 private:
79  QString _labelString;
80 };
81 
82 class SpectrumWindowResetEvent : public QEvent
83 {
84 public:
87 
88 protected:
89 private:
90 };
91 
92 class SpectrumFrequencyRangeEvent : public QEvent
93 {
94 public:
95  SpectrumFrequencyRangeEvent(const double, const double, const double);
97  double GetCenterFrequency() const;
98  double GetStartFrequency() const;
99  double GetStopFrequency() const;
100 
101 protected:
102 private:
103  double _centerFrequency;
104  double _startFrequency;
105  double _stopFrequency;
106 };
107 
108 
109 class TimeUpdateEvent : public QEvent
110 {
111 public:
112  TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
113  const uint64_t numTimeDomainDataPoints,
114  const std::vector<std::vector<gr::tag_t>> tags);
115 
116  ~TimeUpdateEvent() override;
117 
118  int which() const;
119  const std::vector<double*> getTimeDomainPoints() const;
120  uint64_t getNumTimeDomainDataPoints() const;
121  bool getRepeatDataFlag() const;
122 
123  const std::vector<std::vector<gr::tag_t>> getTags() const;
124 
125  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
126 
127 protected:
128 private:
129  size_t _nplots;
130  std::vector<double*> _dataTimeDomainPoints;
131  uint64_t _numTimeDomainDataPoints;
132  std::vector<std::vector<gr::tag_t>> _tags;
133 };
134 
135 
136 /********************************************************************/
137 
138 
139 class FreqUpdateEvent : public QEvent
140 {
141 public:
142  FreqUpdateEvent(const std::vector<double*> dataPoints, 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<double*> realDataPoints,
182  const std::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<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<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<double*> points, const uint64_t npoints);
284 
286 
287  int which() const;
288  const std::vector<double*> getDataPoints() const;
289  uint64_t getNumDataPoints() const;
290  bool getRepeatDataFlag() const;
291 
292  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
293 
294 protected:
295 private:
296  size_t _nplots;
297  std::vector<double*> _points;
298  uint64_t _npoints;
299 };
300 
301 
302 class HistogramSetAccumulator : public QEvent
303 {
304 public:
305  HistogramSetAccumulator(const bool en);
307 
308  bool getAccumulator() const;
309 
310  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType + 1); }
311 
312 private:
313  bool _en;
314 };
315 
316 class HistogramClearEvent : public QEvent
317 {
318 public:
320 
321  ~HistogramClearEvent() override {}
322 
323  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType + 2); }
324 };
325 
326 
327 /********************************************************************/
328 
329 
330 class NumberUpdateEvent : public QEvent
331 {
332 public:
333  NumberUpdateEvent(const std::vector<float> samples);
334  ~NumberUpdateEvent() override;
335 
336  int which() const;
337  const std::vector<float> getSamples() const;
338 
339  static QEvent::Type Type() { return QEvent::Type(SpectrumUpdateEventType); }
340 
341 protected:
342 private:
343  size_t _nplots;
344  std::vector<float> _samples;
345 };
346 
347 
348 #endif /* SPECTRUM_UPDATE_EVENTS_H */
Definition: spectrumUpdateEvents.h:179
int which() const
~ConstUpdateEvent() override
const std::vector< double * > getRealPoints() const
ConstUpdateEvent(const std::vector< double * > realDataPoints, const std::vector< double * > imagDataPoints, const uint64_t numDataPoints)
const std::vector< double * > getImagPoints() const
bool getRepeatDataFlag() const
uint64_t getNumDataPoints() const
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:193
Definition: spectrumUpdateEvents.h:140
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< double * > dataPoints, const uint64_t numDataPoints)
Definition: spectrumUpdateEvents.h:317
~HistogramClearEvent() override
Definition: spectrumUpdateEvents.h:321
HistogramClearEvent()
Definition: spectrumUpdateEvents.h:319
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:323
Definition: spectrumUpdateEvents.h:303
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:310
bool getAccumulator() const
HistogramSetAccumulator(const bool en)
~HistogramSetAccumulator() override
Definition: spectrumUpdateEvents.h:281
HistogramUpdateEvent(const std::vector< double * > points, const uint64_t npoints)
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:292
bool getRepeatDataFlag() const
const std::vector< double * > getDataPoints() const
uint64_t getNumDataPoints() const
~HistogramUpdateEvent() override
Definition: spectrumUpdateEvents.h:331
~NumberUpdateEvent() override
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:339
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:93
~SpectrumFrequencyRangeEvent() override
double GetCenterFrequency() const
SpectrumFrequencyRangeEvent(const double, const double, const double)
double GetStartFrequency() const
double GetStopFrequency() const
Definition: spectrumUpdateEvents.h:29
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:71
SpectrumWindowCaptionEvent(const QString &)
~SpectrumWindowCaptionEvent() override
Definition: spectrumUpdateEvents.h:83
~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
TimeRasterUpdateEvent(const std::vector< double * > dataPoints, const uint64_t numDataPoints)
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:250
~TimeRasterUpdateEvent() override
bool getRepeatDataFlag() const
uint64_t getNumDataPoints() const
const std::vector< double * > getPoints() const
Definition: spectrumUpdateEvents.h:110
static QEvent::Type Type()
Definition: spectrumUpdateEvents.h:125
uint64_t getNumTimeDomainDataPoints() const
TimeUpdateEvent(const std::vector< double * > timeDomainPoints, const uint64_t numTimeDomainDataPoints, const std::vector< std::vector< gr::tag_t >> tags)
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< 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:39
static constexpr int SpectrumWindowCaptionEventType
Definition: spectrumUpdateEvents.h:24
static constexpr int SpectrumWindowResetEventType
Definition: spectrumUpdateEvents.h:25
static constexpr int SpectrumFrequencyRangeEventType
Definition: spectrumUpdateEvents.h:26
static constexpr int SpectrumUpdateEventType
Definition: spectrumUpdateEvents.h:23