1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Moved message to GUI to ChannelAPI. Prepares #769

This commit is contained in:
f4exb 2021-02-08 21:52:47 +01:00
parent 19f3c284ba
commit b62cf26b22
16 changed files with 24 additions and 19 deletions

View File

@ -115,7 +115,7 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_basebandSink->getMagSqLevels(avg, peak, nbSamples); }
void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}

View File

@ -112,7 +112,7 @@ public:
float getFrequencyOffset() const { return m_basebandSink->getFrequencyOffset(); }
bool isSync() const { return m_basebandSink->isSync(); }
void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}

View File

@ -116,7 +116,7 @@ public:
bool getSquelchOpen() const { return m_basebandSink->getSquelchOpen(); }
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_basebandSink->getMagSqLevels(avg, peak, nbSamples); }
void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}
int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); }

View File

@ -115,7 +115,7 @@ public:
m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
}
/* void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/

View File

@ -92,7 +92,7 @@ public:
}
void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}
uint32_t getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); }

View File

@ -121,7 +121,7 @@ public:
m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
}
void setMessageQueueToGUI(MessageQueue* queue) override {
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}

View File

@ -86,7 +86,7 @@ SigMFFileSink::~SigMFFileSink()
void SigMFFileSink::setMessageQueueToGUI(MessageQueue* queue)
{
BasebandSampleSink::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}

View File

@ -613,7 +613,7 @@ void FileSource::getMagSqLevels(double& avg, double& peak, int& nbSamples) const
}
void FileSource::setMessageQueueToGUI(MessageQueue* queue) {
BasebandSampleSource::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSource->setMessageQueueToGUI(queue);
}

View File

@ -762,6 +762,6 @@ void ATVMod::getCameraNumbers(std::vector<int>& numbers)
}
void ATVMod::setMessageQueueToGUI(MessageQueue* queue) {
BasebandSampleSource::setMessageQueueToGUI(queue);
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSource->setMessageQueueToGUI(queue);
}

View File

@ -22,6 +22,7 @@
#include "maincore.h"
ChannelAPI::ChannelAPI(const QString& uri, StreamType streamType) :
m_guiMessageQueue(nullptr),
m_streamType(streamType),
m_name(uri),
m_uri(uri),

View File

@ -30,6 +30,7 @@
#include "pipes/pipeendpoint.h"
class DeviceAPI;
class MessageQueue;
namespace SWGSDRangel
{
@ -61,6 +62,9 @@ public:
virtual QByteArray serialize() const = 0;
virtual bool deserialize(const QByteArray& data) = 0;
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
/**
* API adapter for the channel settings GET requests
*/
@ -125,6 +129,9 @@ public:
virtual int getNbSourceStreams() const = 0;
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const = 0;
protected:
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
private:
StreamType m_streamType;
/** Unique identifier in a device set used for sorting. Used when there is no GUI.

View File

@ -19,8 +19,7 @@
#include "basebandsamplesink.h"
BasebandSampleSink::BasebandSampleSink() :
m_guiMessageQueue(0)
BasebandSampleSink::BasebandSampleSink()
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
}

View File

@ -38,8 +38,6 @@ public:
virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
virtual void feed(const Complex *begin, unsigned int length) //!< Special feed directly with complex array
{
@ -49,7 +47,6 @@ public:
protected:
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
protected slots:
void handleInputMessages();

View File

@ -19,8 +19,7 @@
#include "dsp/basebandsamplesource.h"
#include "util/message.h"
BasebandSampleSource::BasebandSampleSource() :
m_guiMessageQueue(nullptr)
BasebandSampleSource::BasebandSampleSource()
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
}

View File

@ -39,12 +39,9 @@ public:
virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
protected:
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
protected slots:
void handleInputMessages();

View File

@ -132,6 +132,9 @@ public:
virtual void stop();
virtual bool handleMessage(const Message& message);
void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
int webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const;
int webapiSpectrumSettingsPutPatch(
bool force,
@ -207,6 +210,8 @@ private:
Real m_powFFTDiv;
static const Real m_mult;
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
QMutex m_mutex;
void setRunning(bool running) { m_running = running; }