1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-16 13:32:27 -04:00

UDPSink plugin: implemented forced configuration

This commit is contained in:
f4exb 2017-08-16 09:53:23 +02:00
parent edcf3a9d63
commit 2cff745cda
4 changed files with 23 additions and 13 deletions

View File

@ -150,7 +150,7 @@ bool UDPSink::handleMessage(const Message& cmd)
m_config.m_udpPort = cfg.getUDPPort(); m_config.m_udpPort = cfg.getUDPPort();
m_config.m_channelMute = cfg.getChannelMute(); m_config.m_channelMute = cfg.getChannelMute();
apply(false); apply(cfg.getForce());
m_settingsMutex.unlock(); m_settingsMutex.unlock();
@ -183,7 +183,8 @@ void UDPSink::configure(MessageQueue* messageQueue,
int fmDeviation, int fmDeviation,
QString& udpAddress, QString& udpAddress,
int udpPort, int udpPort,
bool channelMute) bool channelMute,
bool force)
{ {
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat, Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
outputSampleRate, outputSampleRate,
@ -191,7 +192,8 @@ void UDPSink::configure(MessageQueue* messageQueue,
fmDeviation, fmDeviation,
udpAddress, udpAddress,
udpPort, udpPort,
channelMute); channelMute,
force);
messageQueue->push(cmd); messageQueue->push(cmd);
} }

View File

@ -64,7 +64,8 @@ public:
int fmDeviation, int fmDeviation,
QString& udpAddress, QString& udpAddress,
int udpPort, int udpPort,
bool channelMute); bool channelMute,
bool force = false);
void setSpectrum(MessageQueue* messageQueue, bool enabled); void setSpectrum(MessageQueue* messageQueue, bool enabled);
private: private:
@ -79,6 +80,7 @@ private:
const QString& getUDPAddress() const { return m_udpAddress; } const QString& getUDPAddress() const { return m_udpAddress; }
int getUDPPort() const { return m_udpPort; } int getUDPPort() const { return m_udpPort; }
bool getChannelMute() const { return m_channelMute; } bool getChannelMute() const { return m_channelMute; }
bool getForce() const { return m_force; }
static MsgUDPSinkConfigure* create(SampleFormat static MsgUDPSinkConfigure* create(SampleFormat
sampleFormat, sampleFormat,
@ -87,7 +89,8 @@ private:
int fmDeviation, int fmDeviation,
QString& udpAddress, QString& udpAddress,
int udpPort, int udpPort,
bool channelMute) bool channelMute,
bool force)
{ {
return new MsgUDPSinkConfigure(sampleFormat, return new MsgUDPSinkConfigure(sampleFormat,
inputSampleRate, inputSampleRate,
@ -95,7 +98,8 @@ private:
fmDeviation, fmDeviation,
udpAddress, udpAddress,
udpPort, udpPort,
channelMute); channelMute,
force);
} }
private: private:
@ -106,6 +110,7 @@ private:
QString m_udpAddress; QString m_udpAddress;
int m_udpPort; int m_udpPort;
bool m_channelMute; bool m_channelMute;
bool m_force;
MsgUDPSinkConfigure(SampleFormat sampleFormat, MsgUDPSinkConfigure(SampleFormat sampleFormat,
Real inputSampleRate, Real inputSampleRate,
@ -113,7 +118,8 @@ private:
int fmDeviation, int fmDeviation,
QString& udpAddress, QString& udpAddress,
int udpPort, int udpPort,
bool channelMute) : bool channelMute,
bool force) :
Message(), Message(),
m_sampleFormat(sampleFormat), m_sampleFormat(sampleFormat),
m_inputSampleRate(inputSampleRate), m_inputSampleRate(inputSampleRate),
@ -121,7 +127,8 @@ private:
m_fmDeviation(fmDeviation), m_fmDeviation(fmDeviation),
m_udpAddress(udpAddress), m_udpAddress(udpAddress),
m_udpPort(udpPort), m_udpPort(udpPort),
m_channelMute(channelMute) m_channelMute(channelMute),
m_force(force)
{ } { }
}; };

View File

@ -178,7 +178,7 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettings(); applySettings(true);
return true; return true;
} }
else else
@ -257,7 +257,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget*
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
applySettings(); applySettings(true);
connect(m_udpSink->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(m_udpSink->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
} }
@ -278,7 +278,7 @@ void UDPSinkGUI::blockApplySettings(bool block)
m_doApplySettings = !block; m_doApplySettings = !block;
} }
void UDPSinkGUI::applySettings() void UDPSinkGUI::applySettings(bool force)
{ {
if (m_doApplySettings) if (m_doApplySettings)
{ {
@ -385,7 +385,8 @@ void UDPSinkGUI::applySettings()
fmDeviation, fmDeviation,
m_udpAddress, m_udpAddress,
udpPort, udpPort,
ui->channelMute->isChecked()); ui->channelMute->isChecked(),
force);
ui->applyBtn->setEnabled(false); ui->applyBtn->setEnabled(false);
} }

View File

@ -97,7 +97,7 @@ private:
virtual ~UDPSinkGUI(); virtual ~UDPSinkGUI();
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(); void applySettings(bool force = false);
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);