1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Deep redesign: Init sequence review phase #3: Implement sample source input messages handler

This commit is contained in:
f4exb 2015-08-19 01:45:06 +02:00
parent 9be9f2d807
commit fc3e9efa8a
4 changed files with 23 additions and 2 deletions

View File

@ -24,7 +24,8 @@
#include "util/messagequeue.h"
#include "util/export.h"
class SDRANGELOVE_API SampleSource {
class SDRANGELOVE_API SampleSource : public QObject {
Q_OBJECT
public:
SampleSource();
virtual ~SampleSource();
@ -43,6 +44,9 @@ public:
MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; }
SampleFifo* getSampleFifo() { return &m_sampleFifo; }
protected slots:
void handleInputMessages();
protected:
SampleFifo m_sampleFifo;
MessageQueue m_inputMessageQueue;

View File

@ -276,6 +276,7 @@ void BladerfGui::on_xb200_currentIndexChanged(int index)
void BladerfGui::updateHardware()
{
qDebug() << "BladerfGui::updateHardware";
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create( m_settings);
m_sampleSource->getInputMessageQueue()->push(message);
m_updateTimer.stop();

View File

@ -237,9 +237,11 @@ quint64 BladerfInput::getCenterFrequency() const
bool BladerfInput::handleMessage(const Message& message)
{
qDebug() << "BladerfInput::handleMessage";
if (MsgConfigureBladerf::match(message))
{
qDebug() << "BladerfInput::handleMessage: MsgConfigureBladerf";
qDebug() << " - MsgConfigureBladerf";
MsgConfigureBladerf& conf = (MsgConfigureBladerf&) message;

View File

@ -19,8 +19,22 @@
SampleSource::SampleSource()
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
}
SampleSource::~SampleSource()
{
}
void SampleSource::handleInputMessages()
{
Message* message;
while ((message = m_inputMessageQueue.pop()) != 0)
{
if (handleMessage(*message))
{
delete message;
}
}
}