1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -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];
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;
}
}
}
}

View File

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

View File

@ -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,40 +145,32 @@ 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)
else
{
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
}
}
void FileSinkGui::updateSampleRateAndFrequency()

View File

@ -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);

View File

@ -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;
}
}
}
}

View File

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

View File

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

View File

@ -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)
{
return false;
}
void LimeSDROutputGUI::handleMessagesToGUI()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
if (LimeSDROutput::MsgReportLimeSDRToGUI::match(message))
{
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();
qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message.getIdentifier());
LimeSDROutput::MsgReportLimeSDRToGUI& report = (LimeSDROutput::MsgReportLimeSDRToGUI&) message;
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();
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);
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;
m_settings.m_devSampleRate = report->getSampleRate();
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);
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->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; }");
} else {
ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
if (report->getOverrun() > 0) {
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) {
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())));
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))
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message))
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message;
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);
private slots:
void handleMessagesToGUI();
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_centerFrequency_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_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,40 +182,31 @@ 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
{
if (handleMessage(*message)) {
delete message;
}
}
}
}
void SDRdaemonSinkGui::updateSampleRateAndFrequency()

View File

@ -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);

View File

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

View File

@ -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

View File

@ -17,6 +17,7 @@
#include <plugin/plugininstanceui.h>
#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);

View File

@ -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

View File

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

View File

@ -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; //<! Input message queue. Post here.
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
State m_state;

View File

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

View File

@ -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; //<! Input message queue. Post here.
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
State m_state;

View File

@ -344,6 +344,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object
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->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();