mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 03:54:30 -04:00
Finalized the new source/sink GUI messaging scheme
This commit is contained in:
@@ -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<DeviceSourceAPI*>& 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<<buddyLog2Decim),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
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)
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user