/
radio.h
164 lines (153 loc) · 4.51 KB
/
radio.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
#
/*
* Copyright (C) 2013, 2014, 2015, 2016, 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the dabradio
*
* dabradio 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.
*
* dabradio 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 dabradio; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Main program
*/
#ifndef __DAB_RADIO__
#define __DAB_RADIO__
#include "dab-constants.h"
#include <QMainWindow>
#include <QStringList>
#include <QStringListModel>
#include <QListView>
#include <QComboBox>
#include <QLabel>
#include <QTimer>
#include <sndfile.h>
#include <atomic>
#include <map>
#include "ui_dabradio.h"
#include "dab-processor.h"
#include "ringbuffer.h"
#include "band-handler.h"
#include "text-mapper.h"
#include "service-descriptor.h"
class QSettings;
class virtualInput;
class audioBase;
class common_fft;
class audioDescriptor;
class spectrumhandler;
/*
* GThe main gui object. It inherits from
* QDialog and the generated form
*/
class RadioInterface: public QMainWindow,
private Ui_dabradio {
Q_OBJECT
public:
RadioInterface (QSettings *,
QString,
bandHandler *,
QWidget *parent = NULL);
~RadioInterface (void);
private:
QSettings *dabSettings;
QString deviceName;
void set_picturePath (void);
void Increment_Channel (void);
deviceHandler *setDevice (QSettings *,
QSpinBox *,
QSpinBox *,
QCheckBox *);
void setColor (QLabel *l, uint8_t b);
void setColor (QPushButton *l, uint8_t b);
QTimer secondsTimer;
typedef std::pair <QString, serviceDescriptor *> mapElement;
std::map<QString, serviceDescriptor *> serviceMap;
std::atomic<int> channelNumber;
int serviceCount;
QString selectedChannel;
QStringListModel ensemble;
QStringList Services;
QListView *ensembleDisplay;
uint8_t dabBand;
uint8_t dabMode;
uint8_t isSynced;
int16_t threshold;
int16_t diff_length;
bandHandler *theBand;
int channels;
std::atomic<bool> running;
bool scanning;
deviceHandler *inputDevice;
textMapper the_textMapper;
dabProcessor *my_dabProcessor;
audioBase *soundOut;
RingBuffer<int16_t> *audioBuffer;
RingBuffer<uint8_t> *dataBuffer;
bool autoCorrector;
QLabel *pictureLabel;
bool saveSlides;
bool showSlides;
QFrame *serviceCharacteristics;
QTimer displayTimer;
QTimer signalTimer;
QTimer channelTimer;
QString currentService;
bool has_presetName;
int32_t numberofSeconds;
int16_t ficBlocks;
int16_t ficSuccess;
int autogain;
QString picturesPath;
void startService (QString);
void startScanning (void);
void TerminateProcess (void);
audioDescriptor *serviceDescription;
protected:
bool eventFilter (QObject *obj, QEvent *event);
public slots:
void set_CorrectorDisplay (int);
void addtoEnsemble (const QString &);
void nameofEnsemble (int, const QString &);
void set_ensembleName (const QString &);
void show_ficSuccess (bool);
void setSynced (char);
void showMOT (QByteArray data,
int subtype,
QString pictureName);
void showLabel (QString);
void changeinConfiguration (void);
void newAudio (int, int);
//
void setStereo (bool);
void set_streamSelector (int);
void nextChannel (void);
void closeEvent (QCloseEvent *event);
void updateTime (void);
void show_motHandling (bool);
void showImpulse (int);
void showSpectrum (int);
void showIQ (int);
void show_audioQuality (int);
void showQuality (float);
void show_snr (int);
// Somehow, these must be connected to the GUI
private slots:
void reset (void);
void channelTimer_timeout (void);
void selectService (QModelIndex);
signals:
void set_quality (int);
};
#endif