diff --git a/devices/limesdr/devicelimesdrshared.h b/devices/limesdr/devicelimesdrshared.h
index 1ed170e64..fd4f2bcd0 100644
--- a/devices/limesdr/devicelimesdrshared.h
+++ b/devices/limesdr/devicelimesdrshared.h
@@ -1,104 +1,104 @@
-///////////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2017 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 . //
-///////////////////////////////////////////////////////////////////////////////////
-
-#ifndef DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
-#define DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
-
-#include
-#include "devicelimesdrparam.h"
-#include "util/message.h"
-
-/**
- * Structure shared by a buddy with other buddies
- */
-class DeviceLimeSDRShared
-{
-public:
- class MsgCrossReportToGUI : public Message {
- MESSAGE_CLASS_DECLARATION
-
- public:
- int getSampleRate() const { return m_sampleRate; }
-
- static MsgCrossReportToGUI* create(int sampleRate)
- {
- return new MsgCrossReportToGUI(sampleRate);
- }
-
- private:
- int m_sampleRate;
-
- MsgCrossReportToGUI(int sampleRate) :
- Message(),
- m_sampleRate(sampleRate)
- { }
- };
-
- class MsgReportDeviceInfo : public Message {
- MESSAGE_CLASS_DECLARATION
-
- public:
- float getTemperature() const { return m_temperature; }
-
- static MsgReportDeviceInfo* create(float temperature)
- {
- return new MsgReportDeviceInfo(temperature);
- }
-
- private:
- float m_temperature;
-
- MsgReportDeviceInfo(float temperature) :
- Message(),
- m_temperature(temperature)
- { }
- };
-
- class ThreadInterface
- {
- public:
- virtual void startWork() = 0;
- virtual void stopWork() = 0;
- virtual void setDeviceSampleRate(int sampleRate) = 0;
- virtual bool isRunning() = 0;
- };
-
- DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters
- int m_channel; //!< logical device channel number (-1 if none)
- ThreadInterface *m_thread; //!< holds the thread address if started else 0
- int m_ncoFrequency;
- uint64_t m_centerFrequency;
- uint32_t m_log2Soft;
- bool m_threadWasRunning; //!< flag to know if thread needs to be resumed after suspend
-
- static const float m_sampleFifoLengthInSeconds;
- static const int m_sampleFifoMinSize;
-
- DeviceLimeSDRShared() :
- m_deviceParams(0),
- m_channel(-1),
- m_thread(0),
- m_ncoFrequency(0),
- m_centerFrequency(0),
- m_log2Soft(0),
- m_threadWasRunning(false)
- {}
-
- ~DeviceLimeSDRShared()
- {}
-};
-
-#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 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 . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
+#define DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
+
+#include
+#include "devicelimesdrparam.h"
+#include "util/message.h"
+
+/**
+ * Structure shared by a buddy with other buddies
+ */
+class DeviceLimeSDRShared
+{
+public:
+ class MsgCrossReportToGUI : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ int getSampleRate() const { return m_sampleRate; }
+
+ static MsgCrossReportToGUI* create(int sampleRate)
+ {
+ return new MsgCrossReportToGUI(sampleRate);
+ }
+
+ private:
+ int m_sampleRate;
+
+ MsgCrossReportToGUI(int sampleRate) :
+ Message(),
+ m_sampleRate(sampleRate)
+ { }
+ };
+
+ class MsgReportDeviceInfo : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ float getTemperature() const { return m_temperature; }
+
+ static MsgReportDeviceInfo* create(float temperature)
+ {
+ return new MsgReportDeviceInfo(temperature);
+ }
+
+ private:
+ float m_temperature;
+
+ MsgReportDeviceInfo(float temperature) :
+ Message(),
+ m_temperature(temperature)
+ { }
+ };
+
+ class ThreadInterface
+ {
+ public:
+ virtual void startWork() = 0;
+ virtual void stopWork() = 0;
+ virtual void setDeviceSampleRate(int sampleRate) = 0;
+ virtual bool isRunning() = 0;
+ };
+
+ DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters
+ int m_channel; //!< logical device channel number (-1 if none)
+ ThreadInterface *m_thread; //!< holds the thread address if started else 0
+ int m_ncoFrequency;
+ uint64_t m_centerFrequency;
+ uint32_t m_log2Soft;
+ bool m_threadWasRunning; //!< flag to know if thread needs to be resumed after suspend
+
+ static const float m_sampleFifoLengthInSeconds;
+ static const int m_sampleFifoMinSize;
+
+ DeviceLimeSDRShared() :
+ m_deviceParams(0),
+ m_channel(-1),
+ m_thread(0),
+ m_ncoFrequency(0),
+ m_centerFrequency(0),
+ m_log2Soft(0),
+ m_threadWasRunning(false)
+ {}
+
+ ~DeviceLimeSDRShared()
+ {}
+};
+
+#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
diff --git a/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp b/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp
index b9f59a012..d1f70f417 100644
--- a/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp
+++ b/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp
@@ -62,7 +62,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
- connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
+ connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
BladerfOutputGui::~BladerfOutputGui()
@@ -134,24 +134,31 @@ bool BladerfOutputGui::handleMessage(const Message& message)
}
}
-void BladerfOutputGui::handleDSPMessages()
+void BladerfOutputGui::handleInputMessages()
{
Message* message;
- while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
+ while ((message = m_inputMessageQueue.pop()) != 0)
{
- qDebug("BladerfOutputGui::handleDSPMessages: message: %s", message->getIdentifier());
+ qDebug("BladerfOutputGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
- qDebug("BladerfOutputGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
+ qDebug("BladerfOutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
+ else
+ {
+ if (handleMessage(*message))
+ {
+ delete message;
+ }
+ }
}
}
diff --git a/plugins/samplesink/bladerfoutput/bladerfoutputgui.h b/plugins/samplesink/bladerfoutput/bladerfoutputgui.h
index 112120b33..9865f8784 100644
--- a/plugins/samplesink/bladerfoutput/bladerfoutputgui.h
+++ b/plugins/samplesink/bladerfoutput/bladerfoutputgui.h
@@ -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_bandwidth_currentIndexChanged(int index);
diff --git a/plugins/samplesink/filesink/filesinkgui.cpp b/plugins/samplesink/filesink/filesinkgui.cpp
index 9756e139b..3eae45c14 100644
--- a/plugins/samplesink/filesink/filesinkgui.cpp
+++ b/plugins/samplesink/filesink/filesinkgui.cpp
@@ -66,9 +66,7 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
displaySettings();
m_deviceSampleSink = (FileSinkOutput*) m_deviceAPI->getSampleSink();
- connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
-
- connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
+ connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
FileSinkGui::~FileSinkGui()
@@ -147,38 +145,30 @@ bool FileSinkGui::handleMessage(const Message& message)
}
}
-void FileSinkGui::handleDSPMessages()
+void FileSinkGui::handleInputMessages()
{
Message* message;
- while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
+ while ((message = m_inputMessageQueue.pop()) != 0)
{
- qDebug("FileSinkGui::handleDSPMessages: message: %s", message->getIdentifier());
+ qDebug("FileSinkGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
- qDebug("FileSinkGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
+ qDebug("FileSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency();
delete message;
}
- }
-}
-
-void FileSinkGui::handleSinkMessages()
-{
- Message* message;
-
- while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
- {
- //qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
-
- if (handleMessage(*message))
+ else
{
- delete message;
+ if (handleMessage(*message))
+ {
+ delete message;
+ }
}
}
}
diff --git a/plugins/samplesink/filesink/filesinkgui.h b/plugins/samplesink/filesink/filesinkgui.h
index 5a05b37ec..7153834b1 100644
--- a/plugins/samplesink/filesink/filesinkgui.h
+++ b/plugins/samplesink/filesink/filesinkgui.h
@@ -80,8 +80,7 @@ private:
void updateSampleRateAndFrequency();
private slots:
- void handleDSPMessages();
- void handleSinkMessages();
+ void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_startStop_toggled(bool checked);
diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp b/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp
index 62d6e6ec2..0902d038c 100644
--- a/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp
+++ b/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp
@@ -56,7 +56,7 @@ HackRFOutputGui::HackRFOutputGui(DeviceSinkAPI *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);
}
HackRFOutputGui::~HackRFOutputGui()
@@ -131,20 +131,20 @@ bool HackRFOutputGui::handleMessage(const Message& message)
}
}
-void HackRFOutputGui::handleDSPMessages()
+void HackRFOutputGui::handleInputMessages()
{
Message* message;
- while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
+ while ((message = m_inputMessageQueue.pop()) != 0)
{
- qDebug("HackRFOutputGui::handleDSPMessages: message: %s", message->getIdentifier());
+ qDebug("HackRFOutputGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
- qDebug("HackRFOutputGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
+ qDebug("HackRFOutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
@@ -156,6 +156,13 @@ void HackRFOutputGui::handleDSPMessages()
delete message;
}
+ else
+ {
+ if (handleMessage(*message))
+ {
+ delete message;
+ }
+ }
}
}
diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputgui.h b/plugins/samplesink/hackrfoutput/hackrfoutputgui.h
index 4be86eda2..e51a63aed 100644
--- a/plugins/samplesink/hackrfoutput/hackrfoutputgui.h
+++ b/plugins/samplesink/hackrfoutput/hackrfoutputgui.h
@@ -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);
diff --git a/plugins/samplesink/limesdroutput/limesdroutput.cpp b/plugins/samplesink/limesdroutput/limesdroutput.cpp
index 3c4214daa..0617f3500 100644
--- a/plugins/samplesink/limesdroutput/limesdroutput.cpp
+++ b/plugins/samplesink/limesdroutput/limesdroutput.cpp
@@ -428,33 +428,39 @@ bool LimeSDROutput::handleMessage(const Message& message)
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
{
- MsgReportStreamInfo *report = MsgReportStreamInfo::create(
- true, // Success
- status.active,
- status.fifoFilledCount,
- status.fifoSize,
- status.underrun,
- status.overrun,
- status.droppedPackets,
- status.sampleRate,
- status.linkRate,
- status.timestamp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (m_deviceAPI->getSampleSinkGUIMessageQueue())
+ {
+ MsgReportStreamInfo *report = MsgReportStreamInfo::create(
+ true, // Success
+ status.active,
+ status.fifoFilledCount,
+ status.fifoSize,
+ status.underrun,
+ status.overrun,
+ status.droppedPackets,
+ status.sampleRate,
+ status.linkRate,
+ status.timestamp);
+ m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
else
{
- MsgReportStreamInfo *report = MsgReportStreamInfo::create(
- false, // Success
- false, // status.active,
- 0, // status.fifoFilledCount,
- 16384, // status.fifoSize,
- 0, // status.underrun,
- 0, // status.overrun,
- 0, // status.droppedPackets,
- 0, // status.sampleRate,
- 0, // status.linkRate,
- 0); // status.timestamp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (m_deviceAPI->getSampleSinkGUIMessageQueue())
+ {
+ MsgReportStreamInfo *report = MsgReportStreamInfo::create(
+ false, // Success
+ false, // status.active,
+ 0, // status.fifoFilledCount,
+ 16384, // status.fifoSize,
+ 0, // status.underrun,
+ 0, // status.overrun,
+ 0, // status.droppedPackets,
+ 0, // status.sampleRate,
+ 0, // status.linkRate,
+ 0); // status.timestamp);
+ m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
return true;
@@ -473,8 +479,10 @@ bool LimeSDROutput::handleMessage(const Message& message)
}
// send to oneself
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (getMessageQueueToGUI()) {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ getMessageQueueToGUI()->push(report);
+ }
// send to source buddies
const std::vector& sourceBuddies = m_deviceAPI->getSourceBuddies();
@@ -482,8 +490,11 @@ bool LimeSDROutput::handleMessage(const Message& message)
for (; itSource != sourceBuddies.end(); ++itSource)
{
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- (*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
+ if ((*itSource)->getSampleSourceGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
// send to sink buddies
@@ -492,8 +503,11 @@ bool LimeSDROutput::handleMessage(const Message& message)
for (; itSink != sinkBuddies.end(); ++itSink)
{
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- (*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
+ if ((*itSink)->getSampleSinkGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
return true;
@@ -903,11 +917,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
m_settings.m_devSampleRate/(1<getDeviceEngineInputMessageQueue()->push(notif);
- MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
- m_settings.m_centerFrequency,
- m_settings.m_devSampleRate,
- m_settings.m_log2HardInterp);
- (*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSink)->getSampleSinkGUIMessageQueue())
+ {
+ MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
+ m_settings.m_centerFrequency,
+ m_settings.m_devSampleRate,
+ m_settings.m_log2HardInterp);
+ (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
// send to source buddies
@@ -924,8 +942,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
m_settings.m_devSampleRate/(1<getDeviceEngineInputMessageQueue()->push(notif);
- DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
- (*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSource)->getSampleSourceGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
+ (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
}
else if (forwardChangeTxDSP)
@@ -950,11 +972,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
- MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
- m_settings.m_centerFrequency,
- m_settings.m_devSampleRate,
- m_settings.m_log2HardInterp);
- (*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSink)->getSampleSinkGUIMessageQueue())
+ {
+ MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
+ m_settings.m_centerFrequency,
+ m_settings.m_devSampleRate,
+ m_settings.m_log2HardInterp);
+ (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
}
else if (forwardChangeOwnDSP)
diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
index 1de1fc26e..d05697572 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
+++ b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
@@ -75,7 +75,7 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
- connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleMessagesToGUI()), Qt::QueuedConnection);
+ connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
LimeSDROutputGUI::~LimeSDROutputGUI()
@@ -137,100 +137,110 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
}
}
-bool LimeSDROutputGUI::handleMessage(const Message& message __attribute__((unused))) // TODO: does not seem to be really useful in any of the source (+sink?) plugins
+bool LimeSDROutputGUI::handleMessage(const Message& message)
{
+ if (LimeSDROutput::MsgReportLimeSDRToGUI::match(message))
+ {
+ qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message.getIdentifier());
+ LimeSDROutput::MsgReportLimeSDRToGUI& report = (LimeSDROutput::MsgReportLimeSDRToGUI&) message;
+
+ m_settings.m_centerFrequency = report.getCenterFrequency();
+ m_settings.m_devSampleRate = report.getSampleRate();
+ m_settings.m_log2HardInterp = report.getLog2HardInterp();
+
+ blockApplySettings(true);
+ displaySettings();
+ blockApplySettings(false);
+
+ LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
+ m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
+
+ return true;
+ }
+ else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(message))
+ {
+ DeviceLimeSDRShared::MsgCrossReportToGUI& report = (DeviceLimeSDRShared::MsgCrossReportToGUI&) message;
+ m_settings.m_devSampleRate = report.getSampleRate();
+
+ blockApplySettings(true);
+ displaySettings();
+ blockApplySettings(false);
+
+ LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
+ m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
+
+ return true;
+ }
+ else if (LimeSDROutput::MsgReportStreamInfo::match(message))
+ {
+ LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message;
+
+ if (report.getSuccess())
+ {
+ ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
+ ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3)));
+
+ if (report.getUnderrun() > 0) {
+ ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ if (report.getOverrun() > 0) {
+ ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ if (report.getDroppedPackets() > 0) {
+ ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ ui->fifoBar->setMaximum(report.getFifoSize());
+ ui->fifoBar->setValue(report.getFifoFilledCount());
+ ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize())));
+ }
+ else
+ {
+ ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ return true;
+ }
+ else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message))
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message;
+ ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0)));
+ return true;
+ }
+
return false;
}
-void LimeSDROutputGUI::handleMessagesToGUI()
+void LimeSDROutputGUI::handleInputMessages()
{
Message* message;
- while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
+ while ((message = m_inputMessageQueue.pop()) != 0)
{
if (DSPSignalNotification::match(*message))
{
- qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
+ qDebug("LimeSDROutputGUI::handleInputMessages: message: %s", message->getIdentifier());
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
- qDebug("LimeSDROutputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
+ qDebug("LimeSDROutputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
- else if (LimeSDROutput::MsgReportLimeSDRToGUI::match(*message))
+ else
{
- qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
- LimeSDROutput::MsgReportLimeSDRToGUI *report = (LimeSDROutput::MsgReportLimeSDRToGUI *) message;
-
- m_settings.m_centerFrequency = report->getCenterFrequency();
- m_settings.m_devSampleRate = report->getSampleRate();
- m_settings.m_log2HardInterp = report->getLog2HardInterp();
-
- blockApplySettings(true);
- displaySettings();
- blockApplySettings(false);
-
- LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
- m_sampleSink->getInputMessageQueue()->push(conf);
-
- delete message;
- }
- else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message))
- {
- DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message;
- m_settings.m_devSampleRate = report->getSampleRate();
-
- blockApplySettings(true);
- displaySettings();
- blockApplySettings(false);
-
- LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
- m_sampleSink->getInputMessageQueue()->push(conf);
-
- delete message;
- }
- else if (LimeSDROutput::MsgReportStreamInfo::match(*message))
- {
- LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message;
-
- if (report->getSuccess())
- {
- ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
- ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report->getLinkRate() / 1000000.0f, 'f', 3)));
-
- if (report->getUnderrun() > 0) {
- ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- if (report->getOverrun() > 0) {
- ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- if (report->getDroppedPackets() > 0) {
- ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- ui->fifoBar->setMaximum(report->getFifoSize());
- ui->fifoBar->setValue(report->getFifoFilledCount());
- ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report->getFifoFilledCount())).arg(QString::number(report->getFifoSize())));
+ if (handleMessage(*message)) {
+ delete message;
}
- else
- {
- ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
- }
- else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
- {
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
- ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
}
}
}
diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.h b/plugins/samplesink/limesdroutput/limesdroutputgui.h
index 85c26e5da..d532c2692 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputgui.h
+++ b/plugins/samplesink/limesdroutput/limesdroutputgui.h
@@ -76,8 +76,7 @@ private:
void blockApplySettings(bool block);
private slots:
- void handleMessagesToGUI();
-
+ void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_centerFrequency_changed(quint64 value);
void on_ncoFrequency_changed(quint64 value);
diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp
index 59c38d0fb..371f5905e 100644
--- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp
+++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp
@@ -84,9 +84,8 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
m_statusTimer.start(500);
m_deviceSampleSink = (SDRdaemonSinkOutput*) m_deviceAPI->getSampleSink();
- connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
- connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
+ connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_time.start();
displayEventCounts();
@@ -183,38 +182,29 @@ bool SDRdaemonSinkGui::handleMessage(const Message& message)
}
}
-void SDRdaemonSinkGui::handleDSPMessages()
+void SDRdaemonSinkGui::handleInputMessages()
{
Message* message;
- while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
+ while ((message = m_inputMessageQueue.pop()) != 0)
{
- qDebug("SDRdaemonSinkGui::handleDSPMessages: message: %s", message->getIdentifier());
+ qDebug("SDRdaemonSinkGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
- qDebug("SDRdaemonSinkGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
+ qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency();
delete message;
}
- }
-}
-
-void SDRdaemonSinkGui::handleSinkMessages()
-{
- Message* message;
-
- while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
- {
- //qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
-
- if (handleMessage(*message))
+ else
{
- delete message;
+ if (handleMessage(*message)) {
+ delete message;
+ }
}
}
}
diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h
index 21f9419aa..dd5bef6d0 100644
--- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h
+++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h
@@ -96,8 +96,7 @@ private:
void displayEventTimer();
private slots:
- void handleDSPMessages();
- void handleSinkMessages();
+ void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_interp_currentIndexChanged(int index);
diff --git a/plugins/samplesource/hackrfinput/hackrfinput.cpp b/plugins/samplesource/hackrfinput/hackrfinput.cpp
index 0c8b3a6a1..8406a7054 100644
--- a/plugins/samplesource/hackrfinput/hackrfinput.cpp
+++ b/plugins/samplesource/hackrfinput/hackrfinput.cpp
@@ -312,8 +312,13 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
if (m_settings.m_linkTxFrequency && (m_deviceAPI->getSinkBuddies().size() > 0))
{
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
- DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency);
- buddy->getDeviceEngineOutputMessageQueue()->push(deltaMsg);
+
+ if (buddy->getSampleSinkGUIMessageQueue())
+ {
+ DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency);
+ buddy->getSampleSinkGUIMessageQueue()->push(deltaMsg);
+ }
+ // TODO: send to buddy sample sink
}
}
diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp
index 8bdbade79..0682e6887 100644
--- a/plugins/samplesource/limesdrinput/limesdrinput.cpp
+++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp
@@ -426,33 +426,39 @@ bool LimeSDRInput::handleMessage(const Message& message)
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
{
- MsgReportStreamInfo *report = MsgReportStreamInfo::create(
- true, // Success
- status.active,
- status.fifoFilledCount,
- status.fifoSize,
- status.underrun,
- status.overrun,
- status.droppedPackets,
- status.sampleRate,
- status.linkRate,
- status.timestamp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (m_deviceAPI->getSampleSourceGUIMessageQueue())
+ {
+ MsgReportStreamInfo *report = MsgReportStreamInfo::create(
+ true, // Success
+ status.active,
+ status.fifoFilledCount,
+ status.fifoSize,
+ status.underrun,
+ status.overrun,
+ status.droppedPackets,
+ status.sampleRate,
+ status.linkRate,
+ status.timestamp);
+ m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
else
{
- MsgReportStreamInfo *report = MsgReportStreamInfo::create(
- false, // Success
- false, // status.active,
- 0, // status.fifoFilledCount,
- 16384, // status.fifoSize,
- 0, // status.underrun,
- 0, // status.overrun,
- 0, // status.droppedPackets,
- 0, // status.sampleRate,
- 0, // status.linkRate,
- 0); // status.timestamp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (m_deviceAPI->getSampleSourceGUIMessageQueue())
+ {
+ MsgReportStreamInfo *report = MsgReportStreamInfo::create(
+ false, // Success
+ false, // status.active,
+ 0, // status.fifoFilledCount,
+ 16384, // status.fifoSize,
+ 0, // status.underrun,
+ 0, // status.overrun,
+ 0, // status.droppedPackets,
+ 0, // status.sampleRate,
+ 0, // status.linkRate,
+ 0); // status.timestamp);
+ m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
return true;
@@ -471,8 +477,10 @@ bool LimeSDRInput::handleMessage(const Message& message)
}
// send to oneself
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
+ if (m_deviceAPI->getSampleSourceGUIMessageQueue()) {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
+ }
// send to source buddies
const std::vector& sourceBuddies = m_deviceAPI->getSourceBuddies();
@@ -480,8 +488,11 @@ bool LimeSDRInput::handleMessage(const Message& message)
for (; itSource != sourceBuddies.end(); ++itSource)
{
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- (*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
+ if ((*itSource)->getSampleSourceGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
// send to sink buddies
@@ -490,8 +501,11 @@ bool LimeSDRInput::handleMessage(const Message& message)
for (; itSink != sinkBuddies.end(); ++itSink)
{
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
- (*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
+ if ((*itSink)->getSampleSinkGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
+ (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
return true;
@@ -1065,11 +1079,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
m_settings.m_devSampleRate/(1<getDeviceEngineInputMessageQueue()->push(notif);
- MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
- m_settings.m_centerFrequency,
- m_settings.m_devSampleRate,
- m_settings.m_log2HardDecim);
- (*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSource)->getSampleSourceGUIMessageQueue())
+ {
+ MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
+ m_settings.m_centerFrequency,
+ m_settings.m_devSampleRate,
+ m_settings.m_log2HardDecim);
+ (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
// send to sink buddies
@@ -1086,8 +1104,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
m_settings.m_devSampleRate/(1<getDeviceEngineInputMessageQueue()->push(notif);
- DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
- (*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSink)->getSampleSinkGUIMessageQueue())
+ {
+ DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
+ (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
+ }
}
}
else if (forwardChangeRxDSP)
@@ -1111,11 +1133,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq);
(*itSource)->getDeviceEngineInputMessageQueue()->push(notif);
- MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
- m_settings.m_centerFrequency,
- m_settings.m_devSampleRate,
- m_settings.m_log2HardDecim);
- (*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
+
+ if ((*itSource)->getSampleSourceGUIMessageQueue())
+ {
+ MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
+ m_settings.m_centerFrequency,
+ m_settings.m_devSampleRate,
+ m_settings.m_log2HardDecim);
+ (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
+ }
}
}
else if (forwardChangeOwnDSP)
diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
index 35b08d705..11b5db6ce 100644
--- a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
+++ b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
@@ -137,8 +137,84 @@ bool LimeSDRInputGUI::deserialize(const QByteArray& data)
}
}
-bool LimeSDRInputGUI::handleMessage(const Message& message __attribute__((unused))) // TODO: does not seem to be really useful in any of the source (+sink?) plugins
+bool LimeSDRInputGUI::handleMessage(const Message& message)
{
+ if (LimeSDRInput::MsgReportLimeSDRToGUI::match(message))
+ {
+ LimeSDRInput::MsgReportLimeSDRToGUI& report = (LimeSDRInput::MsgReportLimeSDRToGUI&) message;
+
+ m_settings.m_centerFrequency = report.getCenterFrequency();
+ m_settings.m_devSampleRate = report.getSampleRate();
+ m_settings.m_log2HardDecim = report.getLog2HardDecim();
+
+ blockApplySettings(true);
+ displaySettings();
+ blockApplySettings(false);
+
+ LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
+ m_sampleSource->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
+
+ return true;
+ }
+ else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(message))
+ {
+ DeviceLimeSDRShared::MsgCrossReportToGUI& report = (DeviceLimeSDRShared::MsgCrossReportToGUI&) message;
+ m_settings.m_devSampleRate = report.getSampleRate(); // TODO: remove from here should be done device to device
+
+ blockApplySettings(true);
+ displaySettings();
+ blockApplySettings(false);
+
+ LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
+ m_sampleSource->getInputMessageQueue()->push(conf);
+
+ return true;
+ }
+ else if (LimeSDRInput::MsgReportStreamInfo::match(message))
+ {
+ LimeSDRInput::MsgReportStreamInfo& report = (LimeSDRInput::MsgReportStreamInfo&) message;
+
+ if (report.getSuccess())
+ {
+ ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
+ ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3)));
+
+ if (report.getUnderrun() > 0) {
+ ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ if (report.getOverrun() > 0) {
+ ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ if (report.getDroppedPackets() > 0) {
+ ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
+ } else {
+ ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ ui->fifoBar->setMaximum(report.getFifoSize());
+ ui->fifoBar->setValue(report.getFifoFilledCount());
+ ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize())));
+ }
+ else
+ {
+ ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ }
+
+ return true;
+ }
+ else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message))
+ {
+ DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message;
+ ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0)));
+ return true;
+ }
+
return false;
}
@@ -160,77 +236,11 @@ void LimeSDRInputGUI::handleInputMessages()
delete message;
}
- else if (LimeSDRInput::MsgReportLimeSDRToGUI::match(*message))
+ else
{
- LimeSDRInput::MsgReportLimeSDRToGUI *report = (LimeSDRInput::MsgReportLimeSDRToGUI *) message;
-
- m_settings.m_centerFrequency = report->getCenterFrequency();
- m_settings.m_devSampleRate = report->getSampleRate();
- m_settings.m_log2HardDecim = report->getLog2HardDecim();
-
- blockApplySettings(true);
- displaySettings();
- blockApplySettings(false);
-
- LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
- m_sampleSource->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
-
- delete message;
- }
- else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message))
- {
- DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message;
- m_settings.m_devSampleRate = report->getSampleRate();
-
- blockApplySettings(true);
- displaySettings();
- blockApplySettings(false);
-
- LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
- m_sampleSource->getInputMessageQueue()->push(conf);
-
- delete message;
- }
- else if (LimeSDRInput::MsgReportStreamInfo::match(*message))
- {
- LimeSDRInput::MsgReportStreamInfo *report = (LimeSDRInput::MsgReportStreamInfo *) message;
-
- if (report->getSuccess())
- {
- ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
- ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report->getLinkRate() / 1000000.0f, 'f', 3)));
-
- if (report->getUnderrun() > 0) {
- ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- if (report->getOverrun() > 0) {
- ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- if (report->getDroppedPackets() > 0) {
- ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
- } else {
- ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
-
- ui->fifoBar->setMaximum(report->getFifoSize());
- ui->fifoBar->setValue(report->getFifoFilledCount());
- ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report->getFifoFilledCount())).arg(QString::number(report->getFifoSize())));
+ if (handleMessage(*message)) {
+ delete message;
}
- else
- {
- ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
- }
- }
- else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
- {
- DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
- ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
}
}
}
diff --git a/sdrbase/device/devicesinkapi.cpp b/sdrbase/device/devicesinkapi.cpp
index 682a82219..f7fc083bd 100644
--- a/sdrbase/device/devicesinkapi.cpp
+++ b/sdrbase/device/devicesinkapi.cpp
@@ -17,6 +17,7 @@
#include
#include "device/devicesinkapi.h"
#include "device/devicesourceapi.h"
+#include "dsp/devicesamplesink.h"
#include "plugin/pluginapi.h"
#include "plugin/plugininterface.h"
#include "gui/glspectrum.h"
@@ -127,9 +128,14 @@ MessageQueue *DeviceSinkAPI::getDeviceEngineInputMessageQueue()
return m_deviceSinkEngine->getInputMessageQueue();
}
-MessageQueue *DeviceSinkAPI::getDeviceEngineOutputMessageQueue()
+MessageQueue *DeviceSinkAPI::getSampleSinkInputMessageQueue()
{
- return m_deviceSinkEngine->getOutputMessageQueue();
+ return getSampleSink()->getInputMessageQueue();
+}
+
+MessageQueue *DeviceSinkAPI::getSampleSinkGUIMessageQueue()
+{
+ return getSampleSink()->getMessageQueueToGUI();
}
GLSpectrum *DeviceSinkAPI::getSpectrum()
diff --git a/sdrbase/device/devicesinkapi.h b/sdrbase/device/devicesinkapi.h
index ee53ace7a..3f2be5c8d 100644
--- a/sdrbase/device/devicesinkapi.h
+++ b/sdrbase/device/devicesinkapi.h
@@ -59,7 +59,8 @@ public:
QString errorMessage(); //!< Return the current device engine error message
uint getDeviceUID() const; //!< Return the current device engine unique ID
MessageQueue *getDeviceEngineInputMessageQueue();
- MessageQueue *getDeviceEngineOutputMessageQueue();
+ MessageQueue *getSampleSinkInputMessageQueue();
+ MessageQueue *getSampleSinkGUIMessageQueue();
// device related stuff
GLSpectrum *getSpectrum(); //!< Direct spectrum getter
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
diff --git a/sdrbase/device/devicesourceapi.cpp b/sdrbase/device/devicesourceapi.cpp
index 9c55edb59..2251941fe 100644
--- a/sdrbase/device/devicesourceapi.cpp
+++ b/sdrbase/device/devicesourceapi.cpp
@@ -17,6 +17,7 @@
#include
#include "device/devicesourceapi.h"
#include "device/devicesinkapi.h"
+#include "dsp/devicesamplesource.h"
#include "plugin/pluginapi.h"
#include "plugin/plugininterface.h"
#include "gui/glspectrum.h"
@@ -113,11 +114,17 @@ MessageQueue *DeviceSourceAPI::getDeviceEngineInputMessageQueue()
return m_deviceSourceEngine->getInputMessageQueue();
}
-MessageQueue *DeviceSourceAPI::getDeviceEngineOutputMessageQueue()
+MessageQueue *DeviceSourceAPI::getSampleSourceInputMessageQueue()
{
- return m_deviceSourceEngine->getOutputMessageQueue();
+ return getSampleSource()->getInputMessageQueue();
}
+MessageQueue *DeviceSourceAPI::getSampleSourceGUIMessageQueue()
+{
+ return getSampleSource()->getMessageQueueToGUI();
+}
+
+
void DeviceSourceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
{
m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
diff --git a/sdrbase/device/devicesourceapi.h b/sdrbase/device/devicesourceapi.h
index 9b7d17890..b169b96de 100644
--- a/sdrbase/device/devicesourceapi.h
+++ b/sdrbase/device/devicesourceapi.h
@@ -58,7 +58,8 @@ public:
QString errorMessage(); //!< Return the current device engine error message
uint getDeviceUID() const; //!< Return the current device engine unique ID
MessageQueue *getDeviceEngineInputMessageQueue();
- MessageQueue *getDeviceEngineOutputMessageQueue();
+ MessageQueue *getSampleSourceInputMessageQueue();
+ MessageQueue *getSampleSourceGUIMessageQueue();
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
// device related stuff
diff --git a/sdrbase/dsp/dspdevicesinkengine.cpp b/sdrbase/dsp/dspdevicesinkengine.cpp
index 01cfd9c31..671dbf4bc 100644
--- a/sdrbase/dsp/dspdevicesinkengine.cpp
+++ b/sdrbase/dsp/dspdevicesinkengine.cpp
@@ -414,9 +414,11 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
m_spectrumSink->handleMessage(notif);
// pass data to listeners
-
- DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
- m_outputMessageQueue.push(rep);
+ if (m_deviceSampleSink->getMessageQueueToGUI())
+ {
+ DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
+ m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
+ }
return StReady;
}
@@ -663,9 +665,11 @@ void DSPDeviceSinkEngine::handleInputMessages()
}
// forward changes to listeners on DSP output queue
-
- DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
- m_outputMessageQueue.push(rep);
+ if (m_deviceSampleSink->getMessageQueueToGUI())
+ {
+ DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
+ m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
+ }
delete message;
}
diff --git a/sdrbase/dsp/dspdevicesinkengine.h b/sdrbase/dsp/dspdevicesinkengine.h
index c8825ed1b..968c18292 100644
--- a/sdrbase/dsp/dspdevicesinkengine.h
+++ b/sdrbase/dsp/dspdevicesinkengine.h
@@ -54,7 +54,6 @@ public:
uint32_t getUID() const { return m_uid; }
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
- MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
void start(); //!< This thread start
void stop(); //!< This thread stop
@@ -87,7 +86,6 @@ private:
uint32_t m_uid; //!< unique ID
MessageQueue m_inputMessageQueue; //getMessageQueueToGUI())
+ {
+ DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
+ m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
+ }
return StReady;
}
diff --git a/sdrbase/dsp/dspdevicesourceengine.h b/sdrbase/dsp/dspdevicesourceengine.h
index ad55d11fe..23561dd92 100644
--- a/sdrbase/dsp/dspdevicesourceengine.h
+++ b/sdrbase/dsp/dspdevicesourceengine.h
@@ -50,7 +50,6 @@ public:
uint getUID() const { return m_uid; }
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
- MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
void start(); //!< This thread start
void stop(); //!< This thread stop
@@ -80,7 +79,6 @@ private:
uint m_uid; //!< unique ID
MessageQueue m_inputMessageQueue; //m_deviceSinkAPI->freeChannels();
+ m_deviceUIs.back()->m_deviceSinkAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
m_deviceUIs.back()->m_deviceSinkAPI->resetSampleSinkId();
@@ -922,6 +923,7 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked __attribute__((unused
deviceUI->m_deviceSinkAPI->stopGeneration();
// deletes old UI and output object
+ deviceUI->m_deviceSinkAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
deviceUI->m_deviceSinkAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
deviceUI->m_deviceSinkAPI->resetSampleSinkId();