mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Device plugins: make setMessageQueueToGUI pure virtual so that child classes must have to deal with this
This commit is contained in:
parent
b127182062
commit
1987bbac77
@ -97,6 +97,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -177,6 +177,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -191,6 +191,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -158,6 +158,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -229,6 +229,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -117,6 +117,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -211,6 +211,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -55,6 +55,9 @@ RTLSDRGui::RTLSDRGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
|
||||
displaySettings();
|
||||
|
||||
m_gains = m_sampleSource->getGains();
|
||||
displayGains();
|
||||
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
@ -133,13 +136,7 @@ bool RTLSDRGui::deserialize(const QByteArray& data)
|
||||
|
||||
bool RTLSDRGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (RTLSDRInput::MsgReportRTLSDR::match(message))
|
||||
{
|
||||
m_gains = ((RTLSDRInput::MsgReportRTLSDR&) message).getGains();
|
||||
displayGains();
|
||||
return true;
|
||||
}
|
||||
else if (RTLSDRInput::MsgConfigureRTLSDR::match(message))
|
||||
if (RTLSDRInput::MsgConfigureRTLSDR::match(message))
|
||||
{
|
||||
const RTLSDRInput::MsgConfigureRTLSDR& cfg = (RTLSDRInput::MsgConfigureRTLSDR&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
std::vector<int> m_gains;
|
||||
DeviceSampleSource* m_sampleSource;
|
||||
RTLSDRInput* m_sampleSource;
|
||||
int m_sampleRate;
|
||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||
int m_lastEngineState;
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "dsp/filerecord.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgConfigureRTLSDR, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgReportRTLSDR, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgFileRecord, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgStartStop, Message)
|
||||
|
||||
@ -481,17 +480,6 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
return true;
|
||||
}
|
||||
|
||||
void RTLSDRInput::setMessageQueueToGUI(MessageQueue *queue)
|
||||
{
|
||||
qDebug("RTLSDRInput::setMessageQueueToGUI: %p", queue);
|
||||
DeviceSampleSource::setMessageQueueToGUI(queue);
|
||||
|
||||
if (queue) {
|
||||
MsgReportRTLSDR *message = MsgReportRTLSDR::create(m_gains);
|
||||
queue->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
void RTLSDRInput::set_ds_mode(int on)
|
||||
{
|
||||
rtlsdr_set_direct_sampling(m_dev, on);
|
||||
|
@ -53,26 +53,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportRTLSDR : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const std::vector<int>& getGains() const { return m_gains; }
|
||||
|
||||
static MsgReportRTLSDR* create(const std::vector<int>& gains)
|
||||
{
|
||||
return new MsgReportRTLSDR(gains);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<int> m_gains;
|
||||
|
||||
MsgReportRTLSDR(const std::vector<int>& gains) :
|
||||
Message(),
|
||||
m_gains(gains)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgFileRecord : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -118,12 +98,12 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue);
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
|
@ -54,7 +54,8 @@ SDRdaemonSourceInput::SDRdaemonSourceInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_autoCorrBuffer(false)
|
||||
{
|
||||
m_sampleFifo.setSize(96000 * 4);
|
||||
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, &m_inputMessageQueue, m_deviceAPI);
|
||||
//m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, &m_inputMessageQueue, m_deviceAPI);
|
||||
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, m_deviceAPI);
|
||||
m_SDRdaemonUDPHandler->connectTimer(&m_masterTimer);
|
||||
|
||||
char recFileNameCStr[30];
|
||||
@ -91,6 +92,12 @@ void SDRdaemonSourceInput::stop()
|
||||
getInputMessageQueue()->push(command);
|
||||
}
|
||||
|
||||
void SDRdaemonSourceInput::setMessageQueueToGUI(MessageQueue *queue)
|
||||
{
|
||||
m_guiMessageQueue = queue;
|
||||
m_SDRdaemonUDPHandler->setMessageQueueToGUI(queue);
|
||||
}
|
||||
|
||||
const QString& SDRdaemonSourceInput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -224,13 +231,6 @@ bool SDRdaemonSourceInput::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceInput::setMessageQueueToGUI(MessageQueue *queue)
|
||||
{
|
||||
qDebug("SDRdaemonSourceInput::setMessageQueueToGUI: %p", queue);
|
||||
DeviceSampleSource::setMessageQueueToGUI(queue);
|
||||
m_SDRdaemonUDPHandler->setMessageQueueToGUI(queue);
|
||||
}
|
||||
|
||||
int SDRdaemonSourceInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
|
@ -329,6 +329,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue);
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
@ -337,8 +338,6 @@ public:
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "sdrdaemonsourceinput.h"
|
||||
#include "sdrdaemonsourceudphandler.h"
|
||||
|
||||
SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *devieAPI) :
|
||||
SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo, DeviceSourceAPI *devieAPI) :
|
||||
m_deviceAPI(devieAPI),
|
||||
m_sdrDaemonBuffer(m_rateDivider),
|
||||
m_dataSocket(0),
|
||||
@ -41,7 +41,7 @@ SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo,
|
||||
m_centerFrequency(0),
|
||||
m_tv_sec(0),
|
||||
m_tv_usec(0),
|
||||
m_outputMessageQueueToGUI(outputMessageQueueToGUI),
|
||||
m_outputMessageQueueToGUI(0),
|
||||
m_tickCount(0),
|
||||
m_samplesCount(0),
|
||||
m_timer(0),
|
||||
@ -244,22 +244,25 @@ void SDRdaemonSourceUDPHandler::tick()
|
||||
framesDecodingStatus = 2;
|
||||
}
|
||||
|
||||
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming::create(
|
||||
m_tv_sec,
|
||||
m_tv_usec,
|
||||
m_sdrDaemonBuffer.getBufferLengthInSecs(),
|
||||
m_sdrDaemonBuffer.getBufferGauge(),
|
||||
framesDecodingStatus,
|
||||
minNbBlocks == nbOriginalBlocks + nbFECblocks,
|
||||
minNbBlocks,
|
||||
minNbOriginalBlocks,
|
||||
m_sdrDaemonBuffer.getMaxNbRecovery(),
|
||||
m_sdrDaemonBuffer.getAvgNbBlocks(),
|
||||
m_sdrDaemonBuffer.getAvgOriginalBlocks(),
|
||||
m_sdrDaemonBuffer.getAvgNbRecovery(),
|
||||
nbOriginalBlocks,
|
||||
nbFECblocks);
|
||||
if (m_outputMessageQueueToGUI)
|
||||
{
|
||||
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming::create(
|
||||
m_tv_sec,
|
||||
m_tv_usec,
|
||||
m_sdrDaemonBuffer.getBufferLengthInSecs(),
|
||||
m_sdrDaemonBuffer.getBufferGauge(),
|
||||
framesDecodingStatus,
|
||||
minNbBlocks == nbOriginalBlocks + nbFECblocks,
|
||||
minNbBlocks,
|
||||
minNbOriginalBlocks,
|
||||
m_sdrDaemonBuffer.getMaxNbRecovery(),
|
||||
m_sdrDaemonBuffer.getAvgNbBlocks(),
|
||||
m_sdrDaemonBuffer.getAvgOriginalBlocks(),
|
||||
m_sdrDaemonBuffer.getAvgNbRecovery(),
|
||||
nbOriginalBlocks,
|
||||
nbFECblocks);
|
||||
|
||||
m_outputMessageQueueToGUI->push(report);
|
||||
m_outputMessageQueueToGUI->push(report);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class SDRdaemonSourceUDPHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SDRdaemonSourceUDPHandler(SampleSinkFifo* sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *deviceAPI);
|
||||
SDRdaemonSourceUDPHandler(SampleSinkFifo* sampleFifo, DeviceSourceAPI *deviceAPI);
|
||||
~SDRdaemonSourceUDPHandler();
|
||||
void setMessageQueueToGUI(MessageQueue *queue) { m_outputMessageQueueToGUI = queue; }
|
||||
void connectTimer(const QTimer* timer);
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
|
||||
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
|
||||
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
|
||||
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
|
||||
SampleSinkFifo* getSampleFifo() { return &m_sampleFifo; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user