1
0
mirror of https://github.com/JvanKatwijk/dabradio synced 2025-10-06 00:02:49 +02:00
Files
SDR-DAB_dabradio/radio.h

165 lines
4.5 KiB
C
Raw Permalink Normal View History

2018-03-06 20:05:31 +01:00
#
/*
* Copyright (C) 2013, 2014, 2015, 2016, 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
2018-04-11 12:25:35 +02:00
* This file is part of the dabradio
2018-03-06 20:05:31 +01:00
*
2018-04-11 12:25:35 +02:00
* dabradio is free software; you can redistribute it and/or modify
2018-03-06 20:05:31 +01:00
* 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.
*
2018-04-11 12:25:35 +02:00
* dabradio is distributed in the hope that it will be useful,
2018-03-06 20:05:31 +01:00
* 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
2018-04-11 12:25:35 +02:00
* along with dabradio; if not, write to the Free Software
2018-03-06 20:05:31 +01:00
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Main program
*/
2018-04-11 12:25:35 +02:00
#ifndef __DAB_RADIO__
#define __DAB_RADIO__
2018-03-06 20:05:31 +01:00
#include "dab-constants.h"
#include <QMainWindow>
#include <QStringList>
#include <QStringListModel>
#include <QListView>
2018-03-06 20:05:31 +01:00
#include <QComboBox>
#include <QLabel>
#include <QTimer>
#include <sndfile.h>
#include <atomic>
#include <map>
2018-03-06 20:05:31 +01:00
#include "ui_dabradio.h"
#include "dab-processor.h"
#include "ringbuffer.h"
#include "band-handler.h"
#include "text-mapper.h"
#include "service-descriptor.h"
2018-03-06 20:05:31 +01:00
class QSettings;
class virtualInput;
class audioBase;
class common_fft;
class audioDescriptor;
2018-03-06 20:05:31 +01:00
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 *,
2018-04-11 12:25:35 +02:00
QString,
bandHandler *,
2018-03-06 20:05:31 +01:00
QWidget *parent = NULL);
~RadioInterface (void);
private:
QSettings *dabSettings;
QString deviceName;
void set_picturePath (void);
void Increment_Channel (void);
2018-12-29 20:15:00 +01:00
deviceHandler *setDevice (QSettings *,
QSpinBox *,
QSpinBox *,
QCheckBox *);
2018-04-11 12:25:35 +02:00
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;
2018-04-11 12:25:35 +02:00
std::atomic<int> channelNumber;
int serviceCount;
QString selectedChannel;
QStringListModel ensemble;
QStringList Services;
QListView *ensembleDisplay;
2018-03-06 20:05:31 +01:00
uint8_t dabBand;
uint8_t dabMode;
uint8_t isSynced;
int16_t threshold;
int16_t diff_length;
2018-04-11 12:25:35 +02:00
bandHandler *theBand;
2018-04-12 19:48:16 +02:00
int channels;
2018-03-06 20:05:31 +01:00
std::atomic<bool> running;
bool scanning;
2018-12-29 20:15:00 +01:00
deviceHandler *inputDevice;
2018-03-06 20:05:31 +01:00
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;
2018-03-06 20:05:31 +01:00
QTimer displayTimer;
QTimer signalTimer;
QTimer channelTimer;
QString currentService;
2018-03-06 20:05:31 +01:00
bool has_presetName;
int32_t numberofSeconds;
int16_t ficBlocks;
int16_t ficSuccess;
2018-04-11 12:25:35 +02:00
int autogain;
2018-03-06 20:05:31 +01:00
QString picturesPath;
void startService (QString);
2018-04-11 12:25:35 +02:00
void startScanning (void);
void TerminateProcess (void);
audioDescriptor *serviceDescription;
protected:
bool eventFilter (QObject *obj, QEvent *event);
2018-03-06 20:05:31 +01:00
public slots:
void set_CorrectorDisplay (int);
2018-03-06 20:05:31 +01:00
void addtoEnsemble (const QString &);
void nameofEnsemble (int, const QString &);
2018-04-11 12:25:35 +02:00
void set_ensembleName (const QString &);
2018-03-06 20:05:31 +01:00
void show_ficSuccess (bool);
void setSynced (char);
2018-04-11 12:25:35 +02:00
void showMOT (QByteArray data,
int subtype,
QString pictureName);
2018-03-06 20:05:31 +01:00
void showLabel (QString);
void changeinConfiguration (void);
void newAudio (int, int);
//
void setStereo (bool);
void set_streamSelector (int);
2018-04-11 12:25:35 +02:00
void nextChannel (void);
2018-03-06 20:05:31 +01:00
void closeEvent (QCloseEvent *event);
void updateTime (void);
2018-03-06 20:05:31 +01:00
2018-04-11 12:25:35 +02:00
void show_motHandling (bool);
void showImpulse (int);
void showSpectrum (int);
void showIQ (int);
void show_audioQuality (int);
void showQuality (float);
void show_snr (int);
2018-03-06 20:05:31 +01:00
// Somehow, these must be connected to the GUI
private slots:
2018-04-11 12:25:35 +02:00
void reset (void);
2018-03-06 20:05:31 +01:00
void channelTimer_timeout (void);
void selectService (QModelIndex);
signals:
void set_quality (int);
2018-03-06 20:05:31 +01:00
};
#endif