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

pull/6/head
f4exb 2015-08-19 01:45:06 +02:00
rodzic 9be9f2d807
commit fc3e9efa8a
4 zmienionych plików z 23 dodań i 2 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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