2016-06-19 03:56:49 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program 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 as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program 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 V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-06-09 07:42:33 -04:00
|
|
|
#ifndef INCLUDE_SDRDAEMONSOURCEINPUT_H
|
|
|
|
#define INCLUDE_SDRDAEMONSOURCEINPUT_H
|
2016-06-19 03:56:49 -04:00
|
|
|
|
2016-10-02 17:16:40 -04:00
|
|
|
#include <dsp/devicesamplesource.h>
|
2016-06-19 03:56:49 -04:00
|
|
|
#include <QString>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <ctime>
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-06-07 20:06:36 -04:00
|
|
|
#include "sdrdaemonfecsettings.h"
|
|
|
|
|
2016-10-10 19:17:55 -04:00
|
|
|
class DeviceSourceAPI;
|
2016-06-19 03:56:49 -04:00
|
|
|
class SDRdaemonFECUDPHandler;
|
|
|
|
|
2016-10-02 17:16:40 -04:00
|
|
|
class SDRdaemonFECInput : public DeviceSampleSource {
|
2016-06-19 03:56:49 -04:00
|
|
|
public:
|
2017-06-07 20:06:36 -04:00
|
|
|
class MsgConfigureSDRdaemonFEC : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
const SDRdaemonFECSettings& getSettings() const { return m_settings; }
|
|
|
|
bool getForce() const { return m_force; }
|
|
|
|
|
|
|
|
static MsgConfigureSDRdaemonFEC* create(const SDRdaemonFECSettings& settings, bool force = false)
|
|
|
|
{
|
|
|
|
return new MsgConfigureSDRdaemonFEC(settings, force);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SDRdaemonFECSettings m_settings;
|
|
|
|
bool m_force;
|
|
|
|
|
|
|
|
MsgConfigureSDRdaemonFEC(const SDRdaemonFECSettings& settings, bool force) :
|
|
|
|
Message(),
|
|
|
|
m_settings(settings),
|
|
|
|
m_force(force)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2016-06-19 03:56:49 -04:00
|
|
|
class MsgConfigureSDRdaemonUDPLink : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
const QString& getAddress() const { return m_address; }
|
|
|
|
quint16 getPort() const { return m_port; }
|
|
|
|
|
|
|
|
static MsgConfigureSDRdaemonUDPLink* create(const QString& address, quint16 port)
|
|
|
|
{
|
|
|
|
return new MsgConfigureSDRdaemonUDPLink(address, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_address;
|
|
|
|
quint16 m_port;
|
|
|
|
|
|
|
|
MsgConfigureSDRdaemonUDPLink(const QString& address, quint16 port) :
|
|
|
|
Message(),
|
|
|
|
m_address(address),
|
|
|
|
m_port(port)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class MsgConfigureSDRdaemonAutoCorr : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
public:
|
|
|
|
bool getDCBlock() const { return m_dcBlock; }
|
|
|
|
bool getIQImbalance() const { return m_iqCorrection; }
|
|
|
|
|
|
|
|
static MsgConfigureSDRdaemonAutoCorr* create(bool dcBlock, bool iqImbalance)
|
|
|
|
{
|
|
|
|
return new MsgConfigureSDRdaemonAutoCorr(dcBlock, iqImbalance);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_dcBlock;
|
|
|
|
bool m_iqCorrection;
|
|
|
|
|
|
|
|
MsgConfigureSDRdaemonAutoCorr(bool dcBlock, bool iqImbalance) :
|
|
|
|
Message(),
|
|
|
|
m_dcBlock(dcBlock),
|
|
|
|
m_iqCorrection(iqImbalance)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class MsgConfigureSDRdaemonWork : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool isWorking() const { return m_working; }
|
|
|
|
|
|
|
|
static MsgConfigureSDRdaemonWork* create(bool working)
|
|
|
|
{
|
|
|
|
return new MsgConfigureSDRdaemonWork(working);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_working;
|
|
|
|
|
|
|
|
MsgConfigureSDRdaemonWork(bool working) :
|
|
|
|
Message(),
|
|
|
|
m_working(working)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class MsgConfigureSDRdaemonStreamTiming : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static MsgConfigureSDRdaemonStreamTiming* create()
|
|
|
|
{
|
|
|
|
return new MsgConfigureSDRdaemonStreamTiming();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
MsgConfigureSDRdaemonStreamTiming() :
|
|
|
|
Message()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class MsgReportSDRdaemonAcquisition : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool getAcquisition() const { return m_acquisition; }
|
|
|
|
|
|
|
|
static MsgReportSDRdaemonAcquisition* create(bool acquisition)
|
|
|
|
{
|
|
|
|
return new MsgReportSDRdaemonAcquisition(acquisition);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_acquisition;
|
|
|
|
|
|
|
|
MsgReportSDRdaemonAcquisition(bool acquisition) :
|
|
|
|
Message(),
|
|
|
|
m_acquisition(acquisition)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2016-06-20 03:07:37 -04:00
|
|
|
class MsgReportSDRdaemonFECStreamData : public Message {
|
2016-06-19 03:56:49 -04:00
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
int getSampleRate() const { return m_sampleRate; }
|
|
|
|
quint64 getCenterFrequency() const { return m_centerFrequency; }
|
|
|
|
uint32_t get_tv_sec() const { return m_tv_sec; }
|
|
|
|
uint32_t get_tv_usec() const { return m_tv_usec; }
|
|
|
|
|
2016-06-20 03:07:37 -04:00
|
|
|
static MsgReportSDRdaemonFECStreamData* create(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec)
|
2016-06-19 03:56:49 -04:00
|
|
|
{
|
2016-06-20 03:07:37 -04:00
|
|
|
return new MsgReportSDRdaemonFECStreamData(sampleRate, centerFrequency, tv_sec, tv_usec);
|
2016-06-19 03:56:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_sampleRate;
|
|
|
|
quint64 m_centerFrequency;
|
|
|
|
uint32_t m_tv_sec;
|
|
|
|
uint32_t m_tv_usec;
|
|
|
|
|
2016-06-20 03:07:37 -04:00
|
|
|
MsgReportSDRdaemonFECStreamData(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) :
|
2016-06-19 03:56:49 -04:00
|
|
|
Message(),
|
|
|
|
m_sampleRate(sampleRate),
|
|
|
|
m_centerFrequency(centerFrequency),
|
|
|
|
m_tv_sec(tv_sec),
|
|
|
|
m_tv_usec(tv_usec)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2016-06-19 18:45:24 -04:00
|
|
|
class MsgReportSDRdaemonFECStreamTiming : public Message {
|
2016-06-19 03:56:49 -04:00
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint32_t get_tv_sec() const { return m_tv_sec; }
|
|
|
|
uint32_t get_tv_usec() const { return m_tv_usec; }
|
2016-07-24 05:09:11 -04:00
|
|
|
int getFramesDecodingStatus() const { return m_framesDecodingStatus; }
|
2016-07-27 22:49:33 -04:00
|
|
|
bool allBlocksReceived() const { return m_allBlocksReceived; }
|
2016-06-19 03:56:49 -04:00
|
|
|
float getBufferLengthInSecs() const { return m_bufferLenSec; }
|
|
|
|
int32_t getBufferGauge() const { return m_bufferGauge; }
|
2016-07-17 18:39:35 -04:00
|
|
|
int getMinNbBlocks() const { return m_minNbBlocks; }
|
2016-07-27 12:49:17 -04:00
|
|
|
int getMinNbOriginalBlocks() const { return m_minNbOriginalBlocks; }
|
|
|
|
int getMaxNbRecovery() const { return m_maxNbRecovery; }
|
2016-06-19 18:45:24 -04:00
|
|
|
float getAvgNbBlocks() const { return m_avgNbBlocks; }
|
2016-07-27 12:49:17 -04:00
|
|
|
float getAvgNbOriginalBlocks() const { return m_avgNbOriginalBlocks; }
|
2016-06-19 18:45:24 -04:00
|
|
|
float getAvgNbRecovery() const { return m_avgNbRecovery; }
|
2016-07-24 05:09:11 -04:00
|
|
|
int getNbOriginalBlocksPerFrame() const { return m_nbOriginalBlocksPerFrame; }
|
|
|
|
int getNbFECBlocksPerFrame() const { return m_nbFECBlocksPerFrame; }
|
2016-06-19 03:56:49 -04:00
|
|
|
|
2016-06-19 18:45:24 -04:00
|
|
|
static MsgReportSDRdaemonFECStreamTiming* create(uint32_t tv_sec,
|
2016-06-19 03:56:49 -04:00
|
|
|
uint32_t tv_usec,
|
|
|
|
float bufferLenSec,
|
2016-06-19 18:45:24 -04:00
|
|
|
int32_t bufferGauge,
|
2016-07-24 05:09:11 -04:00
|
|
|
int framesDecodingStatus,
|
2016-07-27 22:49:33 -04:00
|
|
|
bool allBlocksReceived,
|
2016-07-27 12:49:17 -04:00
|
|
|
int minNbBlocks,
|
|
|
|
int minNbOriginalBlocks,
|
|
|
|
int maxNbRecovery,
|
2016-06-19 18:45:24 -04:00
|
|
|
float avgNbBlocks,
|
2016-07-27 12:49:17 -04:00
|
|
|
float avgNbOriginalBlocks,
|
2016-07-24 05:09:11 -04:00
|
|
|
float avgNbRecovery,
|
|
|
|
int nbOriginalBlocksPerFrame,
|
|
|
|
int nbFECBlocksPerFrame)
|
2016-06-19 03:56:49 -04:00
|
|
|
{
|
2016-06-19 18:45:24 -04:00
|
|
|
return new MsgReportSDRdaemonFECStreamTiming(tv_sec,
|
2016-06-19 03:56:49 -04:00
|
|
|
tv_usec,
|
|
|
|
bufferLenSec,
|
2016-06-19 18:45:24 -04:00
|
|
|
bufferGauge,
|
2016-07-24 05:09:11 -04:00
|
|
|
framesDecodingStatus,
|
2016-07-27 22:49:33 -04:00
|
|
|
allBlocksReceived,
|
2016-07-27 12:49:17 -04:00
|
|
|
minNbBlocks,
|
|
|
|
minNbOriginalBlocks,
|
|
|
|
maxNbRecovery,
|
2016-06-19 18:45:24 -04:00
|
|
|
avgNbBlocks,
|
2016-07-27 12:49:17 -04:00
|
|
|
avgNbOriginalBlocks,
|
2016-07-24 05:09:11 -04:00
|
|
|
avgNbRecovery,
|
|
|
|
nbOriginalBlocksPerFrame,
|
|
|
|
nbFECBlocksPerFrame);
|
2016-06-19 03:56:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
uint32_t m_tv_sec;
|
|
|
|
uint32_t m_tv_usec;
|
2016-07-24 05:09:11 -04:00
|
|
|
int m_framesDecodingStatus;
|
2016-07-27 22:49:33 -04:00
|
|
|
bool m_allBlocksReceived;
|
2016-06-19 18:45:24 -04:00
|
|
|
float m_bufferLenSec;
|
|
|
|
int32_t m_bufferGauge;
|
2016-07-17 18:39:35 -04:00
|
|
|
int m_minNbBlocks;
|
2016-07-27 12:49:17 -04:00
|
|
|
int m_minNbOriginalBlocks;
|
2016-07-17 18:39:35 -04:00
|
|
|
int m_maxNbRecovery;
|
2016-06-19 18:45:24 -04:00
|
|
|
float m_avgNbBlocks;
|
2016-07-27 12:49:17 -04:00
|
|
|
float m_avgNbOriginalBlocks;
|
2016-06-19 18:45:24 -04:00
|
|
|
float m_avgNbRecovery;
|
2016-07-24 05:09:11 -04:00
|
|
|
int m_nbOriginalBlocksPerFrame;
|
|
|
|
int m_nbFECBlocksPerFrame;
|
2016-06-19 18:45:24 -04:00
|
|
|
|
|
|
|
MsgReportSDRdaemonFECStreamTiming(uint32_t tv_sec,
|
2016-06-19 03:56:49 -04:00
|
|
|
uint32_t tv_usec,
|
|
|
|
float bufferLenSec,
|
2016-06-19 18:45:24 -04:00
|
|
|
int32_t bufferGauge,
|
2016-07-24 05:09:11 -04:00
|
|
|
int framesDecodingStatus,
|
2016-07-27 22:49:33 -04:00
|
|
|
bool allBlocksReceived,
|
2016-07-27 12:49:17 -04:00
|
|
|
int minNbBlocks,
|
|
|
|
int minNbOriginalBlocks,
|
|
|
|
int maxNbRecovery,
|
2016-06-19 18:45:24 -04:00
|
|
|
float avgNbBlocks,
|
2016-07-27 12:49:17 -04:00
|
|
|
float avgNbOriginalBlocks,
|
2016-07-24 05:09:11 -04:00
|
|
|
float avgNbRecovery,
|
|
|
|
int nbOriginalBlocksPerFrame,
|
|
|
|
int nbFECBlocksPerFrame) :
|
2016-06-19 03:56:49 -04:00
|
|
|
Message(),
|
|
|
|
m_tv_sec(tv_sec),
|
|
|
|
m_tv_usec(tv_usec),
|
2016-07-24 05:09:11 -04:00
|
|
|
m_framesDecodingStatus(framesDecodingStatus),
|
2016-07-27 22:49:33 -04:00
|
|
|
m_allBlocksReceived(allBlocksReceived),
|
2016-06-19 03:56:49 -04:00
|
|
|
m_bufferLenSec(bufferLenSec),
|
2016-06-19 18:45:24 -04:00
|
|
|
m_bufferGauge(bufferGauge),
|
2016-07-27 12:49:17 -04:00
|
|
|
m_minNbBlocks(minNbBlocks),
|
|
|
|
m_minNbOriginalBlocks(minNbOriginalBlocks),
|
|
|
|
m_maxNbRecovery(maxNbRecovery),
|
2016-06-19 18:45:24 -04:00
|
|
|
m_avgNbBlocks(avgNbBlocks),
|
2016-07-27 12:49:17 -04:00
|
|
|
m_avgNbOriginalBlocks(avgNbOriginalBlocks),
|
2016-07-24 05:09:11 -04:00
|
|
|
m_avgNbRecovery(avgNbRecovery),
|
|
|
|
m_nbOriginalBlocksPerFrame(nbOriginalBlocksPerFrame),
|
|
|
|
m_nbFECBlocksPerFrame(nbFECBlocksPerFrame)
|
2016-06-19 03:56:49 -04:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2016-10-10 19:17:55 -04:00
|
|
|
SDRdaemonFECInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI);
|
2016-06-19 03:56:49 -04:00
|
|
|
virtual ~SDRdaemonFECInput();
|
|
|
|
|
2017-04-13 21:40:45 -04:00
|
|
|
virtual bool start();
|
2016-06-19 03:56:49 -04:00
|
|
|
virtual void stop();
|
|
|
|
|
|
|
|
virtual const QString& getDeviceDescription() const;
|
|
|
|
virtual int getSampleRate() const;
|
|
|
|
virtual quint64 getCenterFrequency() const;
|
|
|
|
std::time_t getStartingTimeStamp() const;
|
|
|
|
void getRemoteAddress(QString &s);
|
|
|
|
|
|
|
|
virtual bool handleMessage(const Message& message);
|
|
|
|
|
|
|
|
private:
|
2016-10-10 19:17:55 -04:00
|
|
|
DeviceSourceAPI *m_deviceAPI;
|
2016-06-19 03:56:49 -04:00
|
|
|
QMutex m_mutex;
|
|
|
|
QString m_address;
|
|
|
|
quint16 m_port;
|
|
|
|
SDRdaemonFECUDPHandler* m_SDRdaemonUDPHandler;
|
|
|
|
QString m_deviceDescription;
|
|
|
|
int m_sampleRate;
|
|
|
|
quint64 m_centerFrequency;
|
|
|
|
std::time_t m_startingTimeStamp;
|
|
|
|
const QTimer& m_masterTimer;
|
|
|
|
bool m_autoFollowRate;
|
|
|
|
bool m_autoCorrBuffer;
|
|
|
|
};
|
|
|
|
|
2017-06-09 07:42:33 -04:00
|
|
|
#endif // INCLUDE_SDRDAEMONSOURCEINPUT_H
|