-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathofdm-handler.h
executable file
·182 lines (175 loc) · 5.26 KB
/
ofdm-handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
/*
* Copyright (C) 2015 .. 2023
* Jan van Katwijk ([email protected])
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#pragma once
/*
* the ofdmHandler is the embodying of all functionality related
* to the ofdm processing and preparation for further decoding
*/
#include "dab-constants.h"
#include <QThread>
#include <QObject>
#include <QByteArray>
#include <QStringList>
#include <QSettings>
#include <vector>
#include <cstdint>
#include "sample-reader.h"
#include "fic-handler.h"
#include "msc-handler.h"
#include "ofdm-decoder.h"
#include "device-handler.h"
#include "ringbuffer.h"
//#include "tii-detector-1.h"
//#include "tii-detector-2.h"
#include "eti-generator.h"
class RadioInterface;
class dabParams;
class processParams;
class logger;
class ofdmHandler: public QThread {
Q_OBJECT
public:
ofdmHandler (RadioInterface *,
deviceHandler *,
processParams *,
QSettings *,
logger *);
~ofdmHandler ();
void start ();
// void start (int32_t);
void stop ();
void select_TII (uint8_t);
void start_dumping (const QString &, int, int);
void stop_dumping ();
bool start_etiGenerator (const QString &);
void stop_etiGenerator ();
void reset_etiGenerator ();
void set_scanMode (bool);
void get_frameQuality (int *, int*, int *);
//
// for the tii settings
void set_tiiThreshold (int16_t);
void set_tiiCollisions (bool);
void set_tiiFilter (bool);
// servicing our subordinates
// for the ficHandler:
QString find_service (uint32_t, int);
void get_parameters (const QString &,
uint32_t *, int *);
std::vector<serviceId> get_services (int);
void data_for_audioservice (const QString &,
audiodata &);
void data_for_packetservice (const QString &,
packetdata &, int16_t);
int get_nrComps (uint32_t);
uint8_t get_ecc ();
int32_t get_ensembleId ();
QString get_ensembleName ();
void set_epgData (int32_t, int32_t,
const QString &,
const QString &);
bool has_timeTable (uint32_t);
std::vector<epgElement> find_epgData (uint32_t);
uint32_t julianDate ();
QStringList basicPrint ();
int scanWidth ();
void start_ficDump (FILE *);
void stop_ficDump ();
//
// for the mscHandler
// void resetServices ();
// void stopService (descriptorType *, int);
void stopService (int, int);
bool setAudioChannel (audiodata &,
RingBuffer<std::complex<int16_t>> *,
FILE *, int);
bool setDataChannel (packetdata &,
RingBuffer<uint8_t> *, int);
void handleIQSelector ();
void handleDecoderSelector (int);
void setCorrelationOrder (bool);
void setDXMode (bool);
private:
RadioInterface *radioInterface_p;
processParams *p;
dabParams params;
QSettings *settings_p;
logger *theLogger;
sampleReader theReader;
ficHandler theFicHandler;
etiGenerator theEtiGenerator;
ofdmDecoder theOfdmDecoder;
mscHandler theMscHandler;
uint8_t selected_TII;
int16_t tiiThreshold;
bool tiiCollisions_active;
bool tiiFilter_active;
int decoder;
int threshold;
int totalFrames;
int goodFrames;
int badFrames;
bool tiiSwitch;
int16_t tii_depth;
int16_t echo_depth;
RingBuffer<Complex > *tiiBuffer_p;
RingBuffer<Complex > *nullBuffer_p;
RingBuffer<float> *snrBuffer_p;
RingBuffer<Complex> *channelBuffer_p;
int16_t tii_delay;
int16_t tii_counter;
bool eti_on;
int16_t attempts;
bool scanMode;
int32_t T_null;
int32_t T_u;
int32_t T_s;
int32_t T_g;
int32_t T_F;
int32_t nrBlocks;
int32_t carriers;
int32_t carrierDiff;
int16_t fineOffset;
int32_t coarseOffset;
QByteArray transmitters;
bool correctionNeeded;
std::vector<Complex> ofdmBuffer;
bool correlationOrder;
bool dxMode;
virtual void run ();
signals:
void set_synced (bool);
void no_signal_found ();
void set_sync_lost ();
void show_tiiData (QVector<tiiData>, int);
void show_tii_spectrum ();
void show_spectrum (int);
void show_snr (float);
void show_snr (float, float, float,
float, float);
void show_clock_error (int);
void show_null (int, int);
void show_channel (int);
void show_Corrector (int, float);
};