1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

UDP source and sink: align message names

This commit is contained in:
f4exb 2018-09-12 15:46:42 +02:00
parent 5771ef4783
commit da963179fb
7 changed files with 77 additions and 75 deletions

6
debian/changelog vendored
View File

@ -1,8 +1,10 @@
sdrangel (4.1.0-1) unstable; urgency=medium sdrangel (4.1.0-1) unstable; urgency=medium
* Integrated SDRdaemon * Integrated SDRdaemon with a pair of new channel plugins
* Exchanged UDP sink and source names for better consistency
* Fixed AudioFifo to prevent deadlocks. Fixes issue #210
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 02 Sep 2018 21:14:18 +0200 -- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 16 Sep 2018 21:14:18 +0200
sdrangel (4.0.7-1) unstable; urgency=medium sdrangel (4.0.7-1) unstable; urgency=medium

View File

@ -34,9 +34,9 @@
const Real UDPSink::m_agcTarget = 16384.0f; const Real UDPSink::m_agcTarget = 16384.0f;
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSrc, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSource, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSrcSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
const QString UDPSink::m_channelIdURI = "sdrangel.channel.udpsink"; const QString UDPSink::m_channelIdURI = "sdrangel.channel.udpsink";
const QString UDPSink::m_channelId = "UDPSink"; const QString UDPSink::m_channelId = "UDPSink";
@ -129,7 +129,7 @@ UDPSink::~UDPSink()
void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled) void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
{ {
Message* cmd = MsgUDPSrcSpectrum::create(enabled); Message* cmd = MsgUDPSinkSpectrum::create(enabled);
messageQueue->push(cmd); messageQueue->push(cmd);
} }
@ -356,22 +356,22 @@ bool UDPSink::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgConfigureUDPSrc::match(cmd)) else if (MsgConfigureUDPSource::match(cmd))
{ {
MsgConfigureUDPSrc& cfg = (MsgConfigureUDPSrc&) cmd; MsgConfigureUDPSource& cfg = (MsgConfigureUDPSource&) cmd;
qDebug("UDPSink::handleMessage: MsgConfigureUDPSrc"); qDebug("UDPSink::handleMessage: MsgConfigureUDPSource");
applySettings(cfg.getSettings(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getForce());
return true; return true;
} }
else if (MsgUDPSrcSpectrum::match(cmd)) else if (MsgUDPSinkSpectrum::match(cmd))
{ {
MsgUDPSrcSpectrum& spc = (MsgUDPSrcSpectrum&) cmd; MsgUDPSinkSpectrum& spc = (MsgUDPSinkSpectrum&) cmd;
m_spectrumEnabled = spc.getEnabled(); m_spectrumEnabled = spc.getEnabled();
qDebug() << "UDPSink::handleMessage: MsgUDPSrcSpectrum: m_spectrumEnabled: " << m_spectrumEnabled; qDebug() << "UDPSink::handleMessage: MsgUDPSinkSpectrum: m_spectrumEnabled: " << m_spectrumEnabled;
return true; return true;
} }
@ -629,14 +629,14 @@ bool UDPSink::deserialize(const QByteArray& data)
{ {
if (m_settings.deserialize(data)) if (m_settings.deserialize(data))
{ {
MsgConfigureUDPSrc *msg = MsgConfigureUDPSrc::create(m_settings, true); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(m_settings, true);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
return true; return true;
} }
else else
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
MsgConfigureUDPSrc *msg = MsgConfigureUDPSrc::create(m_settings, true); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(m_settings, true);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
return false; return false;
} }
@ -729,13 +729,13 @@ int UDPSink::webapiSettingsPutPatch(
m_inputMessageQueue.push(msgChan); m_inputMessageQueue.push(msgChan);
} }
MsgConfigureUDPSrc *msg = MsgConfigureUDPSrc::create(settings, force); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(settings, force);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
qDebug("getUdpSinkSettings::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue); qDebug("getUdpSinkSettings::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
if (m_guiMessageQueue) // forward to GUI if any if (m_guiMessageQueue) // forward to GUI if any
{ {
MsgConfigureUDPSrc *msgToGUI = MsgConfigureUDPSrc::create(settings, force); MsgConfigureUDPSource *msgToGUI = MsgConfigureUDPSource::create(settings, force);
m_guiMessageQueue->push(msgToGUI); m_guiMessageQueue->push(msgToGUI);
} }

View File

@ -45,23 +45,23 @@ class UDPSink : public BasebandSampleSink, public ChannelSinkAPI {
Q_OBJECT Q_OBJECT
public: public:
class MsgConfigureUDPSrc : public Message { class MsgConfigureUDPSource : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
const UDPSinkSettings& getSettings() const { return m_settings; } const UDPSinkSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; } bool getForce() const { return m_force; }
static MsgConfigureUDPSrc* create(const UDPSinkSettings& settings, bool force) static MsgConfigureUDPSource* create(const UDPSinkSettings& settings, bool force)
{ {
return new MsgConfigureUDPSrc(settings, force); return new MsgConfigureUDPSource(settings, force);
} }
private: private:
UDPSinkSettings m_settings; UDPSinkSettings m_settings;
bool m_force; bool m_force;
MsgConfigureUDPSrc(const UDPSinkSettings& settings, bool force) : MsgConfigureUDPSource(const UDPSinkSettings& settings, bool force) :
Message(), Message(),
m_settings(settings), m_settings(settings),
m_force(force) m_force(force)
@ -136,21 +136,21 @@ public slots:
void audioReadyRead(); void audioReadyRead();
protected: protected:
class MsgUDPSrcSpectrum : public Message { class MsgUDPSinkSpectrum : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
bool getEnabled() const { return m_enabled; } bool getEnabled() const { return m_enabled; }
static MsgUDPSrcSpectrum* create(bool enabled) static MsgUDPSinkSpectrum* create(bool enabled)
{ {
return new MsgUDPSrcSpectrum(enabled); return new MsgUDPSinkSpectrum(enabled);
} }
private: private:
bool m_enabled; bool m_enabled;
MsgUDPSrcSpectrum(bool enabled) : MsgUDPSinkSpectrum(bool enabled) :
Message(), Message(),
m_enabled(enabled) m_enabled(enabled)
{ } { }

View File

@ -90,9 +90,9 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
bool UDPSinkGUI::handleMessage(const Message& message ) bool UDPSinkGUI::handleMessage(const Message& message )
{ {
if (UDPSink::MsgConfigureUDPSrc::match(message)) if (UDPSink::MsgConfigureUDPSource::match(message))
{ {
const UDPSink::MsgConfigureUDPSrc& cfg = (UDPSink::MsgConfigureUDPSrc&) message; const UDPSink::MsgConfigureUDPSource& cfg = (UDPSink::MsgConfigureUDPSource&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
@ -391,7 +391,7 @@ void UDPSinkGUI::applySettingsImmediate(bool force)
{ {
if (m_doApplySettings) if (m_doApplySettings)
{ {
UDPSink::MsgConfigureUDPSrc* message = UDPSink::MsgConfigureUDPSrc::create( m_settings, force); UDPSink::MsgConfigureUDPSource* message = UDPSink::MsgConfigureUDPSource::create( m_settings, force);
m_udpSink->getInputMessageQueue()->push(message); m_udpSink->getInputMessageQueue()->push(message);
} }
} }
@ -404,7 +404,7 @@ void UDPSinkGUI::applySettings(bool force)
m_settings.m_outputSampleRate, m_channelMarker.getCenterFrequency()); m_settings.m_outputSampleRate, m_channelMarker.getCenterFrequency());
m_udpSink->getInputMessageQueue()->push(channelConfigMsg); m_udpSink->getInputMessageQueue()->push(channelConfigMsg);
UDPSink::MsgConfigureUDPSrc* message = UDPSink::MsgConfigureUDPSrc::create( m_settings, force); UDPSink::MsgConfigureUDPSource* message = UDPSink::MsgConfigureUDPSource::create( m_settings, force);
m_udpSink->getInputMessageQueue()->push(message); m_udpSink->getInputMessageQueue()->push(message);
ui->applyBtn->setEnabled(false); ui->applyBtn->setEnabled(false);

View File

@ -29,9 +29,9 @@
#include "udpsource.h" #include "udpsource.h"
#include "udpsourcemsg.h" #include "udpsourcemsg.h"
MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureUDPSink, Message) MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureUDPSource, Message)
MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(UDPSource::MsgUDPSinkSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSource::MsgUDPSourceSpectrum, Message)
MESSAGE_CLASS_DEFINITION(UDPSource::MsgResetReadIndex, Message) MESSAGE_CLASS_DEFINITION(UDPSource::MsgResetReadIndex, Message)
const QString UDPSource::m_channelIdURI = "sdrangel.channeltx.udpsource"; const QString UDPSource::m_channelIdURI = "sdrangel.channeltx.udpsource";
@ -342,10 +342,10 @@ bool UDPSource::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgConfigureUDPSink::match(cmd)) else if (MsgConfigureUDPSource::match(cmd))
{ {
MsgConfigureUDPSink& cfg = (MsgConfigureUDPSink&) cmd; MsgConfigureUDPSource& cfg = (MsgConfigureUDPSource&) cmd;
qDebug() << "UDPSource::handleMessage: MsgConfigureUDPSink"; qDebug() << "UDPSource::handleMessage: MsgConfigureUDPSource";
applySettings(cfg.getSettings(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getForce());
@ -403,11 +403,11 @@ bool UDPSource::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgUDPSinkSpectrum::match(cmd)) else if (MsgUDPSourceSpectrum::match(cmd))
{ {
MsgUDPSinkSpectrum& spc = (MsgUDPSinkSpectrum&) cmd; MsgUDPSourceSpectrum& spc = (MsgUDPSourceSpectrum&) cmd;
m_spectrumEnabled = spc.getEnabled(); m_spectrumEnabled = spc.getEnabled();
qDebug() << "UDPSource::handleMessage: MsgUDPSinkSpectrum: m_spectrumEnabled: " << m_spectrumEnabled; qDebug() << "UDPSource::handleMessage: MsgUDPSourceSpectrum: m_spectrumEnabled: " << m_spectrumEnabled;
return true; return true;
} }
@ -440,7 +440,7 @@ bool UDPSource::handleMessage(const Message& cmd)
void UDPSource::setSpectrum(bool enabled) void UDPSource::setSpectrum(bool enabled)
{ {
Message* cmd = MsgUDPSinkSpectrum::create(enabled); Message* cmd = MsgUDPSourceSpectrum::create(enabled);
getInputMessageQueue()->push(cmd); getInputMessageQueue()->push(cmd);
} }
@ -584,14 +584,14 @@ bool UDPSource::deserialize(const QByteArray& data)
{ {
if (m_settings.deserialize(data)) if (m_settings.deserialize(data))
{ {
MsgConfigureUDPSink *msg = MsgConfigureUDPSink::create(m_settings, true); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(m_settings, true);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
return true; return true;
} }
else else
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
MsgConfigureUDPSink *msg = MsgConfigureUDPSink::create(m_settings, true); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(m_settings, true);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
return false; return false;
} }
@ -684,12 +684,12 @@ int UDPSource::webapiSettingsPutPatch(
m_inputMessageQueue.push(msgChan); m_inputMessageQueue.push(msgChan);
} }
MsgConfigureUDPSink *msg = MsgConfigureUDPSink::create(settings, force); MsgConfigureUDPSource *msg = MsgConfigureUDPSource::create(settings, force);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any if (m_guiMessageQueue) // forward to GUI if any
{ {
MsgConfigureUDPSink *msgToGUI = MsgConfigureUDPSink::create(settings, force); MsgConfigureUDPSource *msgToGUI = MsgConfigureUDPSource::create(settings, force);
m_guiMessageQueue->push(msgToGUI); m_guiMessageQueue->push(msgToGUI);
} }

View File

@ -39,23 +39,23 @@ class UDPSource : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT Q_OBJECT
public: public:
class MsgConfigureUDPSink : public Message { class MsgConfigureUDPSource : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
const UDPSourceSettings& getSettings() const { return m_settings; } const UDPSourceSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; } bool getForce() const { return m_force; }
static MsgConfigureUDPSink* create(const UDPSourceSettings& settings, bool force) static MsgConfigureUDPSource* create(const UDPSourceSettings& settings, bool force)
{ {
return new MsgConfigureUDPSink(settings, force); return new MsgConfigureUDPSource(settings, force);
} }
private: private:
UDPSourceSettings m_settings; UDPSourceSettings m_settings;
bool m_force; bool m_force;
MsgConfigureUDPSink(const UDPSourceSettings& settings, bool force) : MsgConfigureUDPSource(const UDPSourceSettings& settings, bool force) :
Message(), Message(),
m_settings(settings), m_settings(settings),
m_force(force) m_force(force)
@ -139,21 +139,21 @@ signals:
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples); void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
private: private:
class MsgUDPSinkSpectrum : public Message { class MsgUDPSourceSpectrum : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
bool getEnabled() const { return m_enabled; } bool getEnabled() const { return m_enabled; }
static MsgUDPSinkSpectrum* create(bool enabled) static MsgUDPSourceSpectrum* create(bool enabled)
{ {
return new MsgUDPSinkSpectrum(enabled); return new MsgUDPSourceSpectrum(enabled);
} }
private: private:
bool m_enabled; bool m_enabled;
MsgUDPSinkSpectrum(bool enabled) : MsgUDPSourceSpectrum(bool enabled) :
Message(), Message(),
m_enabled(enabled) m_enabled(enabled)
{ } { }

View File

@ -86,9 +86,9 @@ bool UDPSourceGUI::deserialize(const QByteArray& data)
bool UDPSourceGUI::handleMessage(const Message& message) bool UDPSourceGUI::handleMessage(const Message& message)
{ {
if (UDPSource::MsgConfigureUDPSink::match(message)) if (UDPSource::MsgConfigureUDPSource::match(message))
{ {
const UDPSource::MsgConfigureUDPSink& cfg = (UDPSource::MsgConfigureUDPSink&) message; const UDPSource::MsgConfigureUDPSource& cfg = (UDPSource::MsgConfigureUDPSource&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
@ -199,7 +199,7 @@ void UDPSourceGUI::applySettings(bool force)
m_settings.m_inputFrequencyOffset); m_settings.m_inputFrequencyOffset);
m_udpSource->getInputMessageQueue()->push(msgChan); m_udpSource->getInputMessageQueue()->push(msgChan);
UDPSource::MsgConfigureUDPSink* message = UDPSource::MsgConfigureUDPSink::create( m_settings, force); UDPSource::MsgConfigureUDPSource* message = UDPSource::MsgConfigureUDPSource::create( m_settings, force);
m_udpSource->getInputMessageQueue()->push(message); m_udpSource->getInputMessageQueue()->push(message);
ui->applyBtn->setEnabled(false); ui->applyBtn->setEnabled(false);