mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Finalized the new source/sink GUI messaging scheme
This commit is contained in:
parent
2af1f56fea
commit
512900d98c
@ -1,104 +1,104 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
|
||||
#define DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include "devicelimesdrparam.h"
|
||||
#include "util/message.h"
|
||||
|
||||
/**
|
||||
* Structure shared by a buddy with other buddies
|
||||
*/
|
||||
class DeviceLimeSDRShared
|
||||
{
|
||||
public:
|
||||
class MsgCrossReportToGUI : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
|
||||
static MsgCrossReportToGUI* create(int sampleRate)
|
||||
{
|
||||
return new MsgCrossReportToGUI(sampleRate);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_sampleRate;
|
||||
|
||||
MsgCrossReportToGUI(int sampleRate) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDeviceInfo : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
float getTemperature() const { return m_temperature; }
|
||||
|
||||
static MsgReportDeviceInfo* create(float temperature)
|
||||
{
|
||||
return new MsgReportDeviceInfo(temperature);
|
||||
}
|
||||
|
||||
private:
|
||||
float m_temperature;
|
||||
|
||||
MsgReportDeviceInfo(float temperature) :
|
||||
Message(),
|
||||
m_temperature(temperature)
|
||||
{ }
|
||||
};
|
||||
|
||||
class ThreadInterface
|
||||
{
|
||||
public:
|
||||
virtual void startWork() = 0;
|
||||
virtual void stopWork() = 0;
|
||||
virtual void setDeviceSampleRate(int sampleRate) = 0;
|
||||
virtual bool isRunning() = 0;
|
||||
};
|
||||
|
||||
DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters
|
||||
int m_channel; //!< logical device channel number (-1 if none)
|
||||
ThreadInterface *m_thread; //!< holds the thread address if started else 0
|
||||
int m_ncoFrequency;
|
||||
uint64_t m_centerFrequency;
|
||||
uint32_t m_log2Soft;
|
||||
bool m_threadWasRunning; //!< flag to know if thread needs to be resumed after suspend
|
||||
|
||||
static const float m_sampleFifoLengthInSeconds;
|
||||
static const int m_sampleFifoMinSize;
|
||||
|
||||
DeviceLimeSDRShared() :
|
||||
m_deviceParams(0),
|
||||
m_channel(-1),
|
||||
m_thread(0),
|
||||
m_ncoFrequency(0),
|
||||
m_centerFrequency(0),
|
||||
m_log2Soft(0),
|
||||
m_threadWasRunning(false)
|
||||
{}
|
||||
|
||||
~DeviceLimeSDRShared()
|
||||
{}
|
||||
};
|
||||
|
||||
#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
|
||||
#define DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include "devicelimesdrparam.h"
|
||||
#include "util/message.h"
|
||||
|
||||
/**
|
||||
* Structure shared by a buddy with other buddies
|
||||
*/
|
||||
class DeviceLimeSDRShared
|
||||
{
|
||||
public:
|
||||
class MsgCrossReportToGUI : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
|
||||
static MsgCrossReportToGUI* create(int sampleRate)
|
||||
{
|
||||
return new MsgCrossReportToGUI(sampleRate);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_sampleRate;
|
||||
|
||||
MsgCrossReportToGUI(int sampleRate) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDeviceInfo : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
float getTemperature() const { return m_temperature; }
|
||||
|
||||
static MsgReportDeviceInfo* create(float temperature)
|
||||
{
|
||||
return new MsgReportDeviceInfo(temperature);
|
||||
}
|
||||
|
||||
private:
|
||||
float m_temperature;
|
||||
|
||||
MsgReportDeviceInfo(float temperature) :
|
||||
Message(),
|
||||
m_temperature(temperature)
|
||||
{ }
|
||||
};
|
||||
|
||||
class ThreadInterface
|
||||
{
|
||||
public:
|
||||
virtual void startWork() = 0;
|
||||
virtual void stopWork() = 0;
|
||||
virtual void setDeviceSampleRate(int sampleRate) = 0;
|
||||
virtual bool isRunning() = 0;
|
||||
};
|
||||
|
||||
DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters
|
||||
int m_channel; //!< logical device channel number (-1 if none)
|
||||
ThreadInterface *m_thread; //!< holds the thread address if started else 0
|
||||
int m_ncoFrequency;
|
||||
uint64_t m_centerFrequency;
|
||||
uint32_t m_log2Soft;
|
||||
bool m_threadWasRunning; //!< flag to know if thread needs to be resumed after suspend
|
||||
|
||||
static const float m_sampleFifoLengthInSeconds;
|
||||
static const int m_sampleFifoMinSize;
|
||||
|
||||
DeviceLimeSDRShared() :
|
||||
m_deviceParams(0),
|
||||
m_channel(-1),
|
||||
m_thread(0),
|
||||
m_ncoFrequency(0),
|
||||
m_centerFrequency(0),
|
||||
m_log2Soft(0),
|
||||
m_threadWasRunning(false)
|
||||
{}
|
||||
|
||||
~DeviceLimeSDRShared()
|
||||
{}
|
||||
};
|
||||
|
||||
#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -66,9 +66,7 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
displaySettings();
|
||||
|
||||
m_deviceSampleSink = (FileSinkOutput*) m_deviceAPI->getSampleSink();
|
||||
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
|
||||
|
||||
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
FileSinkGui::~FileSinkGui()
|
||||
@ -147,38 +145,30 @@ bool FileSinkGui::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
void FileSinkGui::handleDSPMessages()
|
||||
void FileSinkGui::handleInputMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
|
||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||
{
|
||||
qDebug("FileSinkGui::handleDSPMessages: message: %s", message->getIdentifier());
|
||||
qDebug("FileSinkGui::handleInputMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||
qDebug("FileSinkGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
qDebug("FileSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
m_sampleRate = notif->getSampleRate();
|
||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||
updateSampleRateAndFrequency();
|
||||
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileSinkGui::handleSinkMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
|
||||
{
|
||||
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (handleMessage(*message))
|
||||
else
|
||||
{
|
||||
delete message;
|
||||
if (handleMessage(*message))
|
||||
{
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -428,33 +428,39 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
|
||||
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
|
||||
{
|
||||
MsgReportStreamInfo *report = MsgReportStreamInfo::create(
|
||||
true, // Success
|
||||
status.active,
|
||||
status.fifoFilledCount,
|
||||
status.fifoSize,
|
||||
status.underrun,
|
||||
status.overrun,
|
||||
status.droppedPackets,
|
||||
status.sampleRate,
|
||||
status.linkRate,
|
||||
status.timestamp);
|
||||
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
if (m_deviceAPI->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
MsgReportStreamInfo *report = MsgReportStreamInfo::create(
|
||||
true, // Success
|
||||
status.active,
|
||||
status.fifoFilledCount,
|
||||
status.fifoSize,
|
||||
status.underrun,
|
||||
status.overrun,
|
||||
status.droppedPackets,
|
||||
status.sampleRate,
|
||||
status.linkRate,
|
||||
status.timestamp);
|
||||
m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgReportStreamInfo *report = MsgReportStreamInfo::create(
|
||||
false, // Success
|
||||
false, // status.active,
|
||||
0, // status.fifoFilledCount,
|
||||
16384, // status.fifoSize,
|
||||
0, // status.underrun,
|
||||
0, // status.overrun,
|
||||
0, // status.droppedPackets,
|
||||
0, // status.sampleRate,
|
||||
0, // status.linkRate,
|
||||
0); // status.timestamp);
|
||||
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
if (m_deviceAPI->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
MsgReportStreamInfo *report = MsgReportStreamInfo::create(
|
||||
false, // Success
|
||||
false, // status.active,
|
||||
0, // status.fifoFilledCount,
|
||||
16384, // status.fifoSize,
|
||||
0, // status.underrun,
|
||||
0, // status.overrun,
|
||||
0, // status.droppedPackets,
|
||||
0, // status.sampleRate,
|
||||
0, // status.linkRate,
|
||||
0); // status.timestamp);
|
||||
m_deviceAPI->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -473,8 +479,10 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
}
|
||||
|
||||
// send to oneself
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
m_deviceAPI->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
if (getMessageQueueToGUI()) {
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
getMessageQueueToGUI()->push(report);
|
||||
}
|
||||
|
||||
// send to source buddies
|
||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||
@ -482,8 +490,11 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
|
||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
if ((*itSource)->getSampleSourceGUIMessageQueue())
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
(*itSource)->getSampleSourceGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
||||
// send to sink buddies
|
||||
@ -492,8 +503,11 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
|
||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
if ((*itSink)->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
|
||||
(*itSink)->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -903,11 +917,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
m_settings.m_devSampleRate/(1<<buddyLog2SoftInterp),
|
||||
m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency
|
||||
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardInterp);
|
||||
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
|
||||
if ((*itSink)->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardInterp);
|
||||
(*itSink)->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
|
||||
(*itSource)->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
|
||||
if ((*itSource)->getSampleSourceGUIMessageQueue())
|
||||
{
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
|
||||
(*itSource)->getSampleSourceGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (forwardChangeTxDSP)
|
||||
@ -950,11 +972,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency
|
||||
(*itSink)->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardInterp);
|
||||
(*itSink)->getDeviceEngineOutputMessageQueue()->push(report);
|
||||
|
||||
if ((*itSink)->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardInterp);
|
||||
(*itSink)->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (forwardChangeOwnDSP)
|
||||
|
@ -75,7 +75,7 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||
|
||||
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleMessagesToGUI()), Qt::QueuedConnection);
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
LimeSDROutputGUI::~LimeSDROutputGUI()
|
||||
@ -137,100 +137,110 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
bool LimeSDROutputGUI::handleMessage(const Message& message __attribute__((unused))) // TODO: does not seem to be really useful in any of the source (+sink?) plugins
|
||||
bool LimeSDROutputGUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (LimeSDROutput::MsgReportLimeSDRToGUI::match(message))
|
||||
{
|
||||
qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message.getIdentifier());
|
||||
LimeSDROutput::MsgReportLimeSDRToGUI& report = (LimeSDROutput::MsgReportLimeSDRToGUI&) message;
|
||||
|
||||
m_settings.m_centerFrequency = report.getCenterFrequency();
|
||||
m_settings.m_devSampleRate = report.getSampleRate();
|
||||
m_settings.m_log2HardInterp = report.getLog2HardInterp();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI& report = (DeviceLimeSDRShared::MsgCrossReportToGUI&) message;
|
||||
m_settings.m_devSampleRate = report.getSampleRate();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (LimeSDROutput::MsgReportStreamInfo::match(message))
|
||||
{
|
||||
LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message;
|
||||
|
||||
if (report.getSuccess())
|
||||
{
|
||||
ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
|
||||
ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3)));
|
||||
|
||||
if (report.getUnderrun() > 0) {
|
||||
ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
if (report.getOverrun() > 0) {
|
||||
ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
if (report.getDroppedPackets() > 0) {
|
||||
ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
ui->fifoBar->setMaximum(report.getFifoSize());
|
||||
ui->fifoBar->setValue(report.getFifoFilledCount());
|
||||
ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize())));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message;
|
||||
ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0)));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LimeSDROutputGUI::handleMessagesToGUI()
|
||||
void LimeSDROutputGUI::handleInputMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
|
||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||
{
|
||||
if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
|
||||
qDebug("LimeSDROutputGUI::handleInputMessages: message: %s", message->getIdentifier());
|
||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||
m_sampleRate = notif->getSampleRate();
|
||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||
qDebug("LimeSDROutputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
qDebug("LimeSDROutputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
updateSampleRateAndFrequency();
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (LimeSDROutput::MsgReportLimeSDRToGUI::match(*message))
|
||||
else
|
||||
{
|
||||
qDebug("LimeSDROutputGUI::handleMessagesToGUI: message: %s", message->getIdentifier());
|
||||
LimeSDROutput::MsgReportLimeSDRToGUI *report = (LimeSDROutput::MsgReportLimeSDRToGUI *) message;
|
||||
|
||||
m_settings.m_centerFrequency = report->getCenterFrequency();
|
||||
m_settings.m_devSampleRate = report->getSampleRate();
|
||||
m_settings.m_log2HardInterp = report->getLog2HardInterp();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSink->getInputMessageQueue()->push(conf);
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message;
|
||||
m_settings.m_devSampleRate = report->getSampleRate();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSink->getInputMessageQueue()->push(conf);
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (LimeSDROutput::MsgReportStreamInfo::match(*message))
|
||||
{
|
||||
LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message;
|
||||
|
||||
if (report->getSuccess())
|
||||
{
|
||||
ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }");
|
||||
ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report->getLinkRate() / 1000000.0f, 'f', 3)));
|
||||
|
||||
if (report->getUnderrun() > 0) {
|
||||
ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
if (report->getOverrun() > 0) {
|
||||
ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
if (report->getDroppedPackets() > 0) {
|
||||
ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
|
||||
} else {
|
||||
ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
ui->fifoBar->setMaximum(report->getFifoSize());
|
||||
ui->fifoBar->setValue(report->getFifoFilledCount());
|
||||
ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report->getFifoFilledCount())).arg(QString::number(report->getFifoSize())));
|
||||
if (handleMessage(*message)) {
|
||||
delete message;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
}
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
|
||||
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -84,9 +84,8 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
m_statusTimer.start(500);
|
||||
|
||||
m_deviceSampleSink = (SDRdaemonSinkOutput*) m_deviceAPI->getSampleSink();
|
||||
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
|
||||
|
||||
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
|
||||
m_time.start();
|
||||
displayEventCounts();
|
||||
@ -183,38 +182,29 @@ bool SDRdaemonSinkGui::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::handleDSPMessages()
|
||||
void SDRdaemonSinkGui::handleInputMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
|
||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||
{
|
||||
qDebug("SDRdaemonSinkGui::handleDSPMessages: message: %s", message->getIdentifier());
|
||||
qDebug("SDRdaemonSinkGui::handleInputMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||
qDebug("SDRdaemonSinkGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
m_sampleRate = notif->getSampleRate();
|
||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||
updateSampleRateAndFrequency();
|
||||
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::handleSinkMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
|
||||
{
|
||||
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (handleMessage(*message))
|
||||
else
|
||||
{
|
||||
delete message;
|
||||
if (handleMessage(*message)) {
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -312,8 +312,13 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
|
||||
if (m_settings.m_linkTxFrequency && (m_deviceAPI->getSinkBuddies().size() > 0))
|
||||
{
|
||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency);
|
||||
buddy->getDeviceEngineOutputMessageQueue()->push(deltaMsg);
|
||||
|
||||
if (buddy->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(settings.m_centerFrequency - m_settings.m_centerFrequency);
|
||||
buddy->getSampleSinkGUIMessageQueue()->push(deltaMsg);
|
||||
}
|
||||
// TODO: send to buddy sample sink
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -414,9 +414,11 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
|
||||
m_spectrumSink->handleMessage(notif);
|
||||
|
||||
// pass data to listeners
|
||||
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
|
||||
m_outputMessageQueue.push(rep);
|
||||
if (m_deviceSampleSink->getMessageQueueToGUI())
|
||||
{
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
|
||||
m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
|
||||
}
|
||||
|
||||
return StReady;
|
||||
}
|
||||
@ -663,9 +665,11 @@ void DSPDeviceSinkEngine::handleInputMessages()
|
||||
}
|
||||
|
||||
// forward changes to listeners on DSP output queue
|
||||
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
|
||||
m_outputMessageQueue.push(rep);
|
||||
if (m_deviceSampleSink->getMessageQueueToGUI())
|
||||
{
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
|
||||
m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
|
||||
}
|
||||
|
||||
delete message;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -414,9 +414,11 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
|
||||
}
|
||||
|
||||
// pass data to listeners
|
||||
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
|
||||
m_outputMessageQueue.push(rep);
|
||||
if (m_deviceSampleSource->getMessageQueueToGUI())
|
||||
{
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
|
||||
m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
|
||||
}
|
||||
|
||||
return StReady;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user