1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Make the DSP source engine forward messages to own source input GUI message queue. Implementation in all sources

This commit is contained in:
f4exb 2017-09-17 01:23:54 +02:00
parent dc45452a76
commit 31ad75a405
30 changed files with 154 additions and 145 deletions

View File

@ -52,8 +52,7 @@ AirspyGui::AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_rates = ((AirspyInput*) m_sampleSource)->getSampleRates();
displaySampleRates();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
AirspyGui::~AirspyGui()
@ -128,42 +127,34 @@ bool AirspyGui::handleMessage(const Message& message __attribute__((unused)))
// }
}
void AirspyGui::handleDSPMessages()
void AirspyGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("AirspyGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("AirspyGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("AirspyGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("AirspyGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
void AirspyGui::handleSourceMessages()
{
Message* message;
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{
qDebug("AirspyGui::HandleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
}
void AirspyGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);

View File

@ -74,7 +74,6 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void on_centerFrequency_changed(quint64 value);
void on_LOppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked);
@ -92,7 +91,7 @@ private slots:
void on_record_toggled(bool checked);
void updateHardware();
void updateStatus();
void handleSourceMessages();
void handleInputMessages();
};
#endif // INCLUDE_AIRSPYGUI_H

View File

@ -59,7 +59,7 @@ BladerfInputGui::BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
BladerfInputGui::~BladerfInputGui()
@ -123,20 +123,20 @@ bool BladerfInputGui::handleMessage(const Message& message __attribute__((unused
return false;
}
void BladerfInputGui::handleDSPMessages()
void BladerfInputGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("BladerfGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("BladerfGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("BladerfGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("BladerfGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;

View File

@ -70,7 +70,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_dcOffset_toggled(bool checked);

View File

@ -142,7 +142,7 @@ FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
FCDProGui::~FCDProGui()
@ -209,20 +209,20 @@ bool FCDProGui::handleMessage(const Message& message __attribute__((unused)))
return false;
}
void FCDProGui::handleDSPMessages()
void FCDProGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("FCDProGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("FCDProGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("FCDProGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("FCDProGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;

View File

@ -70,7 +70,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_ppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked);

View File

@ -60,7 +60,7 @@ FCDProPlusGui::FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
FCDProPlusGui::~FCDProPlusGui()
@ -127,20 +127,20 @@ bool FCDProPlusGui::handleMessage(const Message& message __attribute__((unused))
return false;
}
void FCDProPlusGui::handleDSPMessages()
void FCDProPlusGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("RTLSDRGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("RTLSDRGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("RTLSDRGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("RTLSDRGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;

View File

@ -69,7 +69,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);

View File

@ -67,9 +67,8 @@ FileSourceGui::FileSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->playLoop->setEnabled(false);
m_sampleSource = m_deviceAPI->getSampleSource();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
FileSourceGui::~FileSourceGui()
@ -128,24 +127,31 @@ bool FileSourceGui::deserialize(const QByteArray& data)
}
}
void FileSourceGui::handleDSPMessages()
void FileSourceGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("FileSourceGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("FileSourceGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_deviceSampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("FileSourceGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("FileSourceGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
@ -178,21 +184,6 @@ bool FileSourceGui::handleMessage(const Message& message)
}
}
void FileSourceGui::handleSourceMessages()
{
Message* message;
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
}
void FileSourceGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_deviceSampleRate);

View File

@ -82,8 +82,7 @@ private:
void updateWithStreamTime();
private slots:
void handleDSPMessages();
void handleSourceMessages();
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_playLoop_toggled(bool checked);
void on_play_toggled(bool checked);

View File

@ -128,7 +128,10 @@ void FileSourceInput::openFileStream()
m_centerFrequency,
m_startingTimeStamp,
m_recordLength); // file stream data
getOutputMessageQueueToGUI()->push(report);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(report);
}
}
void FileSourceInput::seekFileStream(int seekPercentage)
@ -178,7 +181,10 @@ bool FileSourceInput::start()
qDebug("FileSourceInput::startInput: started");
MsgReportFileSourceAcquisition *report = MsgReportFileSourceAcquisition::create(true); // acquisition on
getOutputMessageQueueToGUI()->push(report);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(report);
}
return true;
}
@ -198,7 +204,10 @@ void FileSourceInput::stop()
m_deviceDescription.clear();
MsgReportFileSourceAcquisition *report = MsgReportFileSourceAcquisition::create(false); // acquisition off
getOutputMessageQueueToGUI()->push(report);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(report);
}
}
const QString& FileSourceInput::getDeviceDescription() const
@ -268,7 +277,10 @@ bool FileSourceInput::handleMessage(const Message& message)
if (m_fileSourceThread != 0)
{
report = MsgReportFileSourceStreamTiming::create(m_fileSourceThread->getSamplesCount());
getOutputMessageQueueToGUI()->push(report);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(report);
}
}
return true;

View File

@ -56,7 +56,7 @@ HackRFInputGui::HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
displayBandwidths();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
sendSettings();
}
@ -134,24 +134,31 @@ bool HackRFInputGui::handleMessage(const Message& message)
}
}
void HackRFInputGui::handleDSPMessages()
void HackRFInputGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("HackRFGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("HackRFGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("HackRFGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("HackRFGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}

View File

@ -80,7 +80,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_LOppm_valueChanged(int value);

View File

@ -75,7 +75,7 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleMessagesToGUI()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
LimeSDRInputGUI::~LimeSDRInputGUI()
@ -142,26 +142,26 @@ bool LimeSDRInputGUI::handleMessage(const Message& message __attribute__((unused
return false;
}
void LimeSDRInputGUI::handleMessagesToGUI()
void LimeSDRInputGUI::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("LimeSDRInputGUI::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
qDebug("LimeSDRInputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("LimeSDRInputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("LimeSDRInputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else if (LimeSDRInput::MsgReportLimeSDRToGUI::match(*message))
{
qDebug("LimeSDRInputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
LimeSDRInput::MsgReportLimeSDRToGUI *report = (LimeSDRInput::MsgReportLimeSDRToGUI *) message;
m_settings.m_centerFrequency = report->getCenterFrequency();
@ -173,7 +173,7 @@ void LimeSDRInputGUI::handleMessagesToGUI()
blockApplySettings(false);
LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
m_sampleSource->getInputMessageQueue()->push(conf);
m_sampleSource->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
delete message;
}

View File

@ -75,8 +75,7 @@ private:
void blockApplySettings(bool block);
private slots:
void handleMessagesToGUI();
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_centerFrequency_changed(quint64 value);

View File

@ -66,7 +66,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent)
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
PlutoSDRInputGui::~PlutoSDRInputGui()
@ -385,24 +385,32 @@ void PlutoSDRInputGui::setSampleRateLimits()
ui->sampleRate->setValue(m_settings.m_devSampleRate);
}
void PlutoSDRInputGui::handleDSPMessages()
void PlutoSDRInputGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("LimeSDRInputGUI::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
qDebug("LimeSDRInputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("LimeSDRInputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("LimeSDRInputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
setFIRBWLimits();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}

View File

@ -93,7 +93,7 @@ private slots:
void on_antenna_currentIndexChanged(int index);
void updateHardware();
void updateStatus();
void handleDSPMessages();
void handleInputMessages();
};
#endif /* PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTGUI_H_ */

View File

@ -51,8 +51,7 @@ RTLSDRGui::RTLSDRGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
queryDeviceReport(); // will reply with MsgReportRTLSDR to report gain list
}
@ -144,42 +143,34 @@ bool RTLSDRGui::handleMessage(const Message& message)
}
}
void RTLSDRGui::handleDSPMessages()
void RTLSDRGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("RTLSDRGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("RTLSDRGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("RTLSDRGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("RTLSDRGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
void RTLSDRGui::handleSourceMessages()
{
Message* message;
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{
qDebug("RTLSDRGui::HandleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
}
void RTLSDRGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);

View File

@ -72,7 +72,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_lowSampleRate_toggled(bool checked);
@ -89,7 +89,6 @@ private slots:
void on_record_toggled(bool checked);
void updateHardware();
void updateStatus();
void handleSourceMessages();
};
#endif // INCLUDE_RTLSDRGUI_H

View File

@ -256,7 +256,10 @@ bool RTLSDRInput::handleMessage(const Message& message)
qDebug() << "RTLSDRInput::handleMessage: MsgQueryRTLSDR";
MsgReportRTLSDR *message = MsgReportRTLSDR::create(m_gains);
getOutputMessageQueueToGUI()->push(message);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(message);
}
return true;
}

View File

@ -103,11 +103,10 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* pare
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
m_sampleSource = (SDRdaemonSourceInput*) m_deviceAPI->getSampleSource();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
displaySettings();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_eventsTime.start();
displayEventCounts();
@ -253,44 +252,36 @@ bool SDRdaemonSourceGui::handleMessage(const Message& message)
}
}
void SDRdaemonSourceGui::handleDSPMessages()
void SDRdaemonSourceGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("SDRdaemonGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("SDRdaemonGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_deviceSampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("SDRdaemonGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("SDRdaemonGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
DSPSignalNotification *fwd = new DSPSignalNotification(*notif);
m_sampleSource->getInputMessageQueue()->push(fwd);
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
void SDRdaemonSourceGui::handleSourceMessages()
{
Message* message;
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{
//qDebug("SDRdaemonGui::handleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
}
void SDRdaemonSourceGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_deviceSampleRate);

View File

@ -124,8 +124,7 @@ private:
void displayEventTimer();
private slots:
void handleDSPMessages();
void handleSourceMessages();
void handleInputMessages();
void on_applyButton_clicked(bool checked);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);

View File

@ -52,7 +52,7 @@ SDRdaemonSourceInput::SDRdaemonSourceInput(DeviceSourceAPI *deviceAPI) :
m_autoCorrBuffer(false)
{
m_sampleFifo.setSize(96000 * 4);
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, getOutputMessageQueueToGUI(), m_deviceAPI);
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, getMessageQueueToGUI(), m_deviceAPI);
m_SDRdaemonUDPHandler->connectTimer(&m_masterTimer);
char recFileNameCStr[30];
@ -181,3 +181,9 @@ bool SDRdaemonSourceInput::handleMessage(const Message& message)
}
}
void SDRdaemonSourceInput::setMessageQueueToGUI(MessageQueue *queue)
{
DeviceSampleSource::setMessageQueueToGUI(queue);
m_SDRdaemonUDPHandler->setMessageQueueToGUI(queue);
}

View File

@ -318,6 +318,8 @@ public:
virtual bool handleMessage(const Message& message);
void setMessageQueueToGUI(MessageQueue *queue);
private:
DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex;

View File

@ -179,7 +179,10 @@ void SDRdaemonSourceUDPHandler::processData()
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,
m_tv_usec);
m_outputMessageQueueToGUI->push(report);
if (m_outputMessageQueueToGUI) {
m_outputMessageQueueToGUI->push(report);
}
}
}
@ -258,6 +261,9 @@ void SDRdaemonSourceUDPHandler::tick()
m_sdrDaemonBuffer.getAvgNbRecovery(),
nbOriginalBlocks,
nbFECblocks);
m_outputMessageQueueToGUI->push(report);
if (m_outputMessageQueueToGUI) {
m_outputMessageQueueToGUI->push(report);
}
}
}

View File

@ -38,6 +38,7 @@ class SDRdaemonSourceUDPHandler : public QObject
public:
SDRdaemonSourceUDPHandler(SampleSinkFifo* sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *deviceAPI);
~SDRdaemonSourceUDPHandler();
void setMessageQueueToGUI(MessageQueue *queue) { m_outputMessageQueueToGUI = queue; }
void connectTimer(const QTimer* timer);
void start();
void stop();

View File

@ -69,9 +69,7 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
// connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
// connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
SDRPlayGui::~SDRPlayGui()

View File

@ -319,7 +319,9 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
mirisdr_get_tuner_gain(m_dev)
);
getOutputMessageQueueToGUI()->push(message);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(message);
}
}
}
}
@ -418,7 +420,10 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
mirisdr_get_baseband_gain(m_dev),
mirisdr_get_tuner_gain(m_dev)
);
getOutputMessageQueueToGUI()->push(message);
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(message);
}
}
}

View File

@ -44,7 +44,7 @@ public:
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } // TODO: remove
//MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } // TODO: remove
SampleSinkFifo* getSampleFifo() { return &m_sampleFifo; }
protected slots:

View File

@ -306,6 +306,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and input object
m_deviceUIs.back()->m_deviceSourceAPI->freeChannels(); // destroys the channel instances
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(0); // have source stop sending messages to the GUI
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
m_deviceUIs.back()->m_deviceSourceAPI->resetSampleSourceId();
@ -844,6 +845,7 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus
deviceUI->m_deviceSourceAPI->stopAcquisition();
// deletes old UI and input object
deviceUI->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(0); // have source stop sending messages to the GUI
deviceUI->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
deviceUI->m_deviceSourceAPI->resetSampleSourceId();
deviceUI->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists