1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-01 12:37:11 -05:00

Finalized the new source/sink GUI messaging scheme

This commit is contained in:
f4exb 2017-09-17 17:35:03 +02:00
parent 2af1f56fea
commit 512900d98c
24 changed files with 499 additions and 412 deletions

View File

@ -62,7 +62,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
char recFileNameCStr[30]; char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); 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() BladerfOutputGui::~BladerfOutputGui()
@ -134,24 +134,31 @@ bool BladerfOutputGui::handleMessage(const Message& message)
} }
} }
void BladerfOutputGui::handleDSPMessages() void BladerfOutputGui::handleInputMessages()
{ {
Message* message; 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)) if (DSPSignalNotification::match(*message))
{ {
DSPSignalNotification* notif = (DSPSignalNotification*) message; DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate(); m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency(); 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(); updateSampleRateAndFrequency();
delete message; delete message;
} }
else
{
if (handleMessage(*message))
{
delete message;
}
}
} }
} }

View File

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

View File

@ -66,9 +66,7 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
displaySettings(); displaySettings();
m_deviceSampleSink = (FileSinkOutput*) m_deviceAPI->getSampleSink(); m_deviceSampleSink = (FileSinkOutput*) m_deviceAPI->getSampleSink();
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages())); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
} }
FileSinkGui::~FileSinkGui() FileSinkGui::~FileSinkGui()
@ -147,41 +145,33 @@ bool FileSinkGui::handleMessage(const Message& message)
} }
} }
void FileSinkGui::handleDSPMessages() void FileSinkGui::handleInputMessages()
{ {
Message* message; 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)) if (DSPSignalNotification::match(*message))
{ {
DSPSignalNotification* notif = (DSPSignalNotification*) 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_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency(); m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency(); updateSampleRateAndFrequency();
delete message; delete message;
} }
} else
}
void FileSinkGui::handleSinkMessages()
{ {
Message* message;
while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
{
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message)) if (handleMessage(*message))
{ {
delete message; delete message;
} }
} }
} }
}
void FileSinkGui::updateSampleRateAndFrequency() void FileSinkGui::updateSampleRateAndFrequency()
{ {

View File

@ -80,8 +80,7 @@ private:
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
private slots: private slots:
void handleDSPMessages(); void handleInputMessages();
void handleSinkMessages();
void on_centerFrequency_changed(quint64 value); void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value); void on_sampleRate_changed(quint64 value);
void on_startStop_toggled(bool checked); void on_startStop_toggled(bool checked);

View File

@ -56,7 +56,7 @@ HackRFOutputGui::HackRFOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
displaySettings(); displaySettings();
displayBandwidths(); displayBandwidths();
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
} }
HackRFOutputGui::~HackRFOutputGui() HackRFOutputGui::~HackRFOutputGui()
@ -131,20 +131,20 @@ bool HackRFOutputGui::handleMessage(const Message& message)
} }
} }
void HackRFOutputGui::handleDSPMessages() void HackRFOutputGui::handleInputMessages()
{ {
Message* message; 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)) if (DSPSignalNotification::match(*message))
{ {
DSPSignalNotification* notif = (DSPSignalNotification*) message; DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate(); m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency(); 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(); updateSampleRateAndFrequency();
delete message; delete message;
@ -156,6 +156,13 @@ void HackRFOutputGui::handleDSPMessages()
delete message; delete message;
} }
else
{
if (handleMessage(*message))
{
delete message;
}
}
} }
} }

View File

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

View File

@ -427,6 +427,8 @@ bool LimeSDROutput::handleMessage(const Message& message)
lms_stream_status_t status; lms_stream_status_t status;
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0)) if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
{
if (m_deviceAPI->getSampleSinkGUIMessageQueue())
{ {
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
true, // Success true, // Success
@ -439,9 +441,12 @@ bool LimeSDROutput::handleMessage(const Message& message)
status.sampleRate, status.sampleRate,
status.linkRate, status.linkRate,
status.timestamp); status.timestamp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
}
} }
else else
{
if (m_deviceAPI->getSampleSinkGUIMessageQueue())
{ {
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
false, // Success false, // Success
@ -454,7 +459,8 @@ bool LimeSDROutput::handleMessage(const Message& message)
0, // status.sampleRate, 0, // status.sampleRate,
0, // status.linkRate, 0, // status.linkRate,
0); // status.timestamp); 0); // status.timestamp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
}
} }
return true; return true;
@ -473,17 +479,22 @@ bool LimeSDROutput::handleMessage(const Message& message)
} }
// send to oneself // send to oneself
if (getMessageQueueToGUI()) {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); getMessageQueueToGUI()->push(report);
}
// send to source buddies // send to source buddies
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies(); const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin(); std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{
if ((*itSource)->getSampleSourceGUIMessageQueue())
{ {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
}
} }
// send to sink buddies // send to sink buddies
@ -491,9 +502,12 @@ bool LimeSDROutput::handleMessage(const Message& message)
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin(); std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{
if ((*itSink)->getSampleSinkGUIMessageQueue())
{ {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
}
} }
return true; return true;
@ -903,11 +917,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
m_settings.m_devSampleRate/(1<<buddyLog2SoftInterp), m_settings.m_devSampleRate/(1<<buddyLog2SoftInterp),
m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif); (*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSink)->getSampleSinkGUIMessageQueue())
{
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
m_settings.m_log2HardInterp); m_settings.m_log2HardInterp);
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
}
} }
// send to source buddies // send to source buddies
@ -924,8 +942,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
m_settings.m_devSampleRate/(1<<buddyLog2SoftDecim), m_settings.m_devSampleRate/(1<<buddyLog2SoftDecim),
buddyCenterFreq + buddyNCOFreq); buddyCenterFreq + buddyNCOFreq);
(*itSource)->getDeviceEngineInputMessageQueue()->push(notif); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSource)->getSampleSourceGUIMessageQueue())
{
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate); DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
}
} }
} }
else if (forwardChangeTxDSP) else if (forwardChangeTxDSP)
@ -950,11 +972,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif); (*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSink)->getSampleSinkGUIMessageQueue())
{
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
m_settings.m_log2HardInterp); m_settings.m_log2HardInterp);
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
}
} }
} }
else if (forwardChangeOwnDSP) else if (forwardChangeOwnDSP)

View File

@ -75,7 +75,7 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
char recFileNameCStr[30]; char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); 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() 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)
{ {
return false; if (LimeSDROutput::MsgReportLimeSDRToGUI::match(message))
} {
qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message.getIdentifier());
LimeSDROutput::MsgReportLimeSDRToGUI& report = (LimeSDROutput::MsgReportLimeSDRToGUI&) message;
void LimeSDROutputGUI::handleMessagesToGUI() m_settings.m_centerFrequency = report.getCenterFrequency();
{ m_settings.m_devSampleRate = report.getSampleRate();
Message* message; m_settings.m_log2HardInterp = report.getLog2HardInterp();
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
{
if (DSPSignalNotification::match(*message))
{
qDebug("LimeSDROutputGUI::handleMessagesToGUI: 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());
updateSampleRateAndFrequency();
delete message;
}
else 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); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings); LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
m_sampleSink->getInputMessageQueue()->push(conf); m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
delete message; return true;
} }
else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message)) else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(message))
{ {
DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message; DeviceLimeSDRShared::MsgCrossReportToGUI& report = (DeviceLimeSDRShared::MsgCrossReportToGUI&) message;
m_settings.m_devSampleRate = report->getSampleRate(); m_settings.m_devSampleRate = report.getSampleRate();
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings); LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
m_sampleSink->getInputMessageQueue()->push(conf); m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
delete message; return true;
} }
else if (LimeSDROutput::MsgReportStreamInfo::match(*message)) else if (LimeSDROutput::MsgReportStreamInfo::match(message))
{ {
LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message; LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message;
if (report->getSuccess()) if (report.getSuccess())
{ {
ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }"); ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report->getLinkRate() / 1000000.0f, 'f', 3))); ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3)));
if (report->getUnderrun() > 0) { if (report.getUnderrun() > 0) {
ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }"); ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
} else { } else {
ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
if (report->getOverrun() > 0) { if (report.getOverrun() > 0) {
ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }"); ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
} else { } else {
ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
if (report->getDroppedPackets() > 0) { if (report.getDroppedPackets() > 0) {
ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }"); ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
} else { } else {
ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
ui->fifoBar->setMaximum(report->getFifoSize()); ui->fifoBar->setMaximum(report.getFifoSize());
ui->fifoBar->setValue(report->getFifoFilledCount()); ui->fifoBar->setValue(report.getFifoFilledCount());
ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report->getFifoFilledCount())).arg(QString::number(report->getFifoSize()))); ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize())));
} }
else else
{ {
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
} }
return true;
} }
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message)) else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message))
{ {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message; DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0))); ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0)));
return true;
}
return false;
}
void LimeSDROutputGUI::handleInputMessages()
{
Message* message;
while ((message = m_inputMessageQueue.pop()) != 0)
{
if (DSPSignalNotification::match(*message))
{
qDebug("LimeSDROutputGUI::handleInputMessages: message: %s", message->getIdentifier());
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("LimeSDROutputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message)) {
delete message;
}
} }
} }
} }

View File

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

View File

@ -84,9 +84,8 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
m_statusTimer.start(500); m_statusTimer.start(500);
m_deviceSampleSink = (SDRdaemonSinkOutput*) m_deviceAPI->getSampleSink(); 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(); m_time.start();
displayEventCounts(); displayEventCounts();
@ -183,41 +182,32 @@ bool SDRdaemonSinkGui::handleMessage(const Message& message)
} }
} }
void SDRdaemonSinkGui::handleDSPMessages() void SDRdaemonSinkGui::handleInputMessages()
{ {
Message* message; 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)) if (DSPSignalNotification::match(*message))
{ {
DSPSignalNotification* notif = (DSPSignalNotification*) 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_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency(); m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency(); updateSampleRateAndFrequency();
delete message; delete message;
} }
} else
}
void SDRdaemonSinkGui::handleSinkMessages()
{
Message* message;
while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
{
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{ {
if (handleMessage(*message)) {
delete message; delete message;
} }
} }
} }
}
void SDRdaemonSinkGui::updateSampleRateAndFrequency() void SDRdaemonSinkGui::updateSampleRateAndFrequency()
{ {

View File

@ -96,8 +96,7 @@ private:
void displayEventTimer(); void displayEventTimer();
private slots: private slots:
void handleDSPMessages(); void handleInputMessages();
void handleSinkMessages();
void on_centerFrequency_changed(quint64 value); void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value); void on_sampleRate_changed(quint64 value);
void on_interp_currentIndexChanged(int index); void on_interp_currentIndexChanged(int index);

View File

@ -312,8 +312,13 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
if (m_settings.m_linkTxFrequency && (m_deviceAPI->getSinkBuddies().size() > 0)) if (m_settings.m_linkTxFrequency && (m_deviceAPI->getSinkBuddies().size() > 0))
{ {
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0]; DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
if (buddy->getSampleSinkGUIMessageQueue())
{
DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency); DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency);
buddy->getDeviceEngineOutputMessageQueue()->push(deltaMsg); buddy->getSampleSinkGUIMessageQueue()->push(deltaMsg);
}
// TODO: send to buddy sample sink
} }
} }

View File

@ -425,6 +425,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
lms_stream_status_t status; lms_stream_status_t status;
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0)) if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
{
if (m_deviceAPI->getSampleSourceGUIMessageQueue())
{ {
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
true, // Success true, // Success
@ -437,9 +439,12 @@ bool LimeSDRInput::handleMessage(const Message& message)
status.sampleRate, status.sampleRate,
status.linkRate, status.linkRate,
status.timestamp); status.timestamp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
}
} }
else else
{
if (m_deviceAPI->getSampleSourceGUIMessageQueue())
{ {
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
false, // Success false, // Success
@ -452,7 +457,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
0, // status.sampleRate, 0, // status.sampleRate,
0, // status.linkRate, 0, // status.linkRate,
0); // status.timestamp); 0); // status.timestamp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
}
} }
return true; return true;
@ -471,17 +477,22 @@ bool LimeSDRInput::handleMessage(const Message& message)
} }
// send to oneself // send to oneself
if (m_deviceAPI->getSampleSourceGUIMessageQueue()) {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report); m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
}
// send to source buddies // send to source buddies
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies(); const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin(); std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{
if ((*itSource)->getSampleSourceGUIMessageQueue())
{ {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
}
} }
// send to sink buddies // send to sink buddies
@ -489,9 +500,12 @@ bool LimeSDRInput::handleMessage(const Message& message)
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin(); std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{
if ((*itSink)->getSampleSinkGUIMessageQueue())
{ {
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
}
} }
return true; return true;
@ -1065,11 +1079,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
m_settings.m_devSampleRate/(1<<buddyLog2Decim), m_settings.m_devSampleRate/(1<<buddyLog2Decim),
m_settings.m_centerFrequency + buddyNCOFreq); m_settings.m_centerFrequency + buddyNCOFreq);
(*itSource)->getDeviceEngineInputMessageQueue()->push(notif); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSource)->getSampleSourceGUIMessageQueue())
{
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
m_settings.m_log2HardDecim); m_settings.m_log2HardDecim);
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
}
} }
// send to sink buddies // send to sink buddies
@ -1086,8 +1104,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
m_settings.m_devSampleRate/(1<<buddyLog2Interp), m_settings.m_devSampleRate/(1<<buddyLog2Interp),
buddyCenterFreq + buddyNCOFreq); // do not change center frequency buddyCenterFreq + buddyNCOFreq); // do not change center frequency
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif); (*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSink)->getSampleSinkGUIMessageQueue())
{
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate); DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
}
} }
} }
else if (forwardChangeRxDSP) else if (forwardChangeRxDSP)
@ -1111,11 +1133,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq); DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq);
(*itSource)->getDeviceEngineInputMessageQueue()->push(notif); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif);
if ((*itSource)->getSampleSourceGUIMessageQueue())
{
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
m_settings.m_log2HardDecim); m_settings.m_log2HardDecim);
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
}
} }
} }
else if (forwardChangeOwnDSP) else if (forwardChangeOwnDSP)

View File

@ -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; return false;
} }
@ -160,78 +236,12 @@ void LimeSDRInputGUI::handleInputMessages()
delete message; delete message;
} }
else 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
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())));
}
else else
{ {
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); if (handleMessage(*message)) {
delete message;
} }
} }
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
}
} }
} }

View File

@ -17,6 +17,7 @@
#include <plugin/plugininstanceui.h> #include <plugin/plugininstanceui.h>
#include "device/devicesinkapi.h" #include "device/devicesinkapi.h"
#include "device/devicesourceapi.h" #include "device/devicesourceapi.h"
#include "dsp/devicesamplesink.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
#include "gui/glspectrum.h" #include "gui/glspectrum.h"
@ -127,9 +128,14 @@ MessageQueue *DeviceSinkAPI::getDeviceEngineInputMessageQueue()
return m_deviceSinkEngine->getInputMessageQueue(); 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() GLSpectrum *DeviceSinkAPI::getSpectrum()

View File

@ -59,7 +59,8 @@ public:
QString errorMessage(); //!< Return the current device engine error message QString errorMessage(); //!< Return the current device engine error message
uint getDeviceUID() const; //!< Return the current device engine unique ID uint getDeviceUID() const; //!< Return the current device engine unique ID
MessageQueue *getDeviceEngineInputMessageQueue(); MessageQueue *getDeviceEngineInputMessageQueue();
MessageQueue *getDeviceEngineOutputMessageQueue(); MessageQueue *getSampleSinkInputMessageQueue();
MessageQueue *getSampleSinkGUIMessageQueue();
// device related stuff // device related stuff
GLSpectrum *getSpectrum(); //!< Direct spectrum getter GLSpectrum *getSpectrum(); //!< Direct spectrum getter
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum

View File

@ -17,6 +17,7 @@
#include <plugin/plugininstanceui.h> #include <plugin/plugininstanceui.h>
#include "device/devicesourceapi.h" #include "device/devicesourceapi.h"
#include "device/devicesinkapi.h" #include "device/devicesinkapi.h"
#include "dsp/devicesamplesource.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
#include "gui/glspectrum.h" #include "gui/glspectrum.h"
@ -113,11 +114,17 @@ MessageQueue *DeviceSourceAPI::getDeviceEngineInputMessageQueue()
return m_deviceSourceEngine->getInputMessageQueue(); 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) void DeviceSourceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
{ {
m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection); m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);

View File

@ -58,7 +58,8 @@ public:
QString errorMessage(); //!< Return the current device engine error message QString errorMessage(); //!< Return the current device engine error message
uint getDeviceUID() const; //!< Return the current device engine unique ID uint getDeviceUID() const; //!< Return the current device engine unique ID
MessageQueue *getDeviceEngineInputMessageQueue(); MessageQueue *getDeviceEngineInputMessageQueue();
MessageQueue *getDeviceEngineOutputMessageQueue(); MessageQueue *getSampleSourceInputMessageQueue();
MessageQueue *getSampleSourceGUIMessageQueue();
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
// device related stuff // device related stuff

View File

@ -414,9 +414,11 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
m_spectrumSink->handleMessage(notif); m_spectrumSink->handleMessage(notif);
// pass data to listeners // pass data to listeners
if (m_deviceSampleSink->getMessageQueueToGUI())
{
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
m_outputMessageQueue.push(rep); m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
}
return StReady; return StReady;
} }
@ -663,9 +665,11 @@ void DSPDeviceSinkEngine::handleInputMessages()
} }
// forward changes to listeners on DSP output queue // forward changes to listeners on DSP output queue
if (m_deviceSampleSink->getMessageQueueToGUI())
{
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
m_outputMessageQueue.push(rep); m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
}
delete message; delete message;
} }

View File

@ -54,7 +54,6 @@ public:
uint32_t getUID() const { return m_uid; } uint32_t getUID() const { return m_uid; }
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
void start(); //!< This thread start void start(); //!< This thread start
void stop(); //!< This thread stop void stop(); //!< This thread stop
@ -87,7 +86,6 @@ private:
uint32_t m_uid; //!< unique ID uint32_t m_uid; //!< unique ID
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here. MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
State m_state; State m_state;

View File

@ -414,9 +414,11 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
} }
// pass data to listeners // pass data to listeners
if (m_deviceSampleSource->getMessageQueueToGUI())
{
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
m_outputMessageQueue.push(rep); m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
}
return StReady; return StReady;
} }

View File

@ -50,7 +50,6 @@ public:
uint getUID() const { return m_uid; } uint getUID() const { return m_uid; }
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
void start(); //!< This thread start void start(); //!< This thread start
void stop(); //!< This thread stop void stop(); //!< This thread stop
@ -80,7 +79,6 @@ private:
uint m_uid; //!< unique ID uint m_uid; //!< unique ID
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here. MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
State m_state; State m_state;

View File

@ -344,6 +344,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object // deletes old UI and output object
m_deviceUIs.back()->m_deviceSinkAPI->freeChannels(); m_deviceUIs.back()->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->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI()); m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
m_deviceUIs.back()->m_deviceSinkAPI->resetSampleSinkId(); m_deviceUIs.back()->m_deviceSinkAPI->resetSampleSinkId();
@ -922,6 +923,7 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked __attribute__((unused
deviceUI->m_deviceSinkAPI->stopGeneration(); deviceUI->m_deviceSinkAPI->stopGeneration();
// deletes old UI and output object // 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->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI()); deviceUI->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
deviceUI->m_deviceSinkAPI->resetSampleSinkId(); deviceUI->m_deviceSinkAPI->resetSampleSinkId();