forked from JvanKatwijk/qt-dab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdab-processor.h
executable file
·163 lines (159 loc) · 4.79 KB
/
dab-processor.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
#
/*
* Copyright (C) 2015 .. 2020
* Jan van Katwijk ([email protected])
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* 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
*/
#
#ifndef __DAB_PROCESSOR__
#define __DAB_PROCESSOR__
/*
* dabProcessor is the embodying of all functionality related
* to the actal DAB processing.
*/
#include "dab-constants.h"
#include <QThread>
#include <QObject>
#include <QByteArray>
#include <QStringList>
#include <vector>
#include <cstdint>
#include <sndfile.h>
#include "sample-reader.h"
#include "phasereference.h"
#include "ofdm-decoder.h"
#include "fic-handler.h"
#include "msc-handler.h"
#include "device-handler.h"
#include "ringbuffer.h"
#include "tii_detector.h"
#include "eti-generator.h"
//
class RadioInterface;
class dabParams;
class processParams;
class dabProcessor: public QThread {
Q_OBJECT
public:
dabProcessor (RadioInterface *,
deviceHandler *,
processParams *);
~dabProcessor ();
void start ();
// void start (int32_t);
void stop ();
void startDumping (SNDFILE *);
void stopDumping ();
bool start_etiGenerator (const QString &);
void stop_etiGenerator ();
void reset_etiGenerator ();
void set_scanMode (bool);
void getFrameQuality (int *, int*, int *);
//
// inheriting from our delegates
// for the ficHandler:
QString findService (uint32_t, int);
void getParameters (const QString &,
uint32_t *, int *);
std::vector<serviceId> getServices (int);
bool is_audioService (const QString &s);
bool is_packetService (const QString &s);
void dataforAudioService (const QString &,
audiodata *);
void dataforPacketService (const QString &,
packetdata *, int16_t);
int getSubChId (const QString &, uint32_t);
uint8_t get_ecc ();
int32_t get_ensembleId ();
QString get_ensembleName ();
uint16_t get_countryName ();
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 reset_Services ();
void stopService (descriptorType *, int);
void stopService (int, int);
bool set_audioChannel (audiodata *,
RingBuffer<int16_t> *,
FILE *, int);
bool set_dataChannel (packetdata *,
RingBuffer<uint8_t> *, int);
void set_tiiDetectorMode (bool);
private:
int threshold;
int totalFrames;
int goodFrames;
int badFrames;
bool tiiSwitch;
int16_t tii_depth;
int16_t echo_depth;
deviceHandler *inputDevice;
dabParams params;
RingBuffer<std::complex<float> > *tiiBuffer;
RingBuffer<float> *snrBuffer;
int16_t tii_delay;
int16_t tii_counter;
etiGenerator my_etiGenerator;
bool eti_on;
sampleReader myReader;
RadioInterface *myRadioInterface;
ficHandler my_ficHandler;
mscHandler my_mscHandler;
phaseReference phaseSynchronizer;
TII_Detector my_TII_Detector;
ofdmDecoder my_ofdmDecoder;
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<std::complex<float> >ofdmBuffer;
bool wasSecond (int16_t, dabParams *);
virtual void run ();
signals:
void setSynced (bool);
void No_Signal_Found ();
void setSyncLost ();
void show_tii (int, int);
void show_tii_spectrum ();
void show_Spectrum (int);
void show_snr (int);
void show_snr (float, float, float,
float, float);
void show_clockErr (int);
void show_null (int);
};
#endif