diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp
index 37cd9e8dd..0351869d8 100644
--- a/plugins/channeltx/udpsink/udpsink.cpp
+++ b/plugins/channeltx/udpsink/udpsink.cpp
@@ -23,6 +23,7 @@
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
+MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message)
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
m_uiMessageQueue(uiMessageQueue),
@@ -343,6 +344,16 @@ bool UDPSink::handleMessage(const Message& cmd)
return true;
}
+ else if (MsgResetReadIndex::match(cmd))
+ {
+ m_settingsMutex.lock();
+ m_udpHandler.resetReadIndex();
+ m_settingsMutex.unlock();
+
+ qDebug() << "UDPSink::handleMessage: MsgResetReadIndex";
+
+ return true;
+ }
else
{
if(m_spectrum != 0)
@@ -389,6 +400,12 @@ void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
messageQueue->push(cmd);
}
+void UDPSink::resetReadIndex(MessageQueue* messageQueue)
+{
+ Message* cmd = MsgResetReadIndex::create();
+ messageQueue->push(cmd);
+}
+
void UDPSink::apply(bool force)
{
diff --git a/plugins/channeltx/udpsink/udpsink.h b/plugins/channeltx/udpsink/udpsink.h
index a4cfe0f13..8bf8e1614 100644
--- a/plugins/channeltx/udpsink/udpsink.h
+++ b/plugins/channeltx/udpsink/udpsink.h
@@ -72,6 +72,7 @@ public:
bool squelchEnabled,
bool force = false);
void setSpectrum(MessageQueue* messageQueue, bool enabled);
+ void resetReadIndex(MessageQueue* messageQueue);
signals:
/**
@@ -184,6 +185,23 @@ private:
{ }
};
+ class MsgResetReadIndex : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+
+ static MsgResetReadIndex* create()
+ {
+ return new MsgResetReadIndex();
+ }
+
+ private:
+
+ MsgResetReadIndex() :
+ Message()
+ { }
+ };
+
struct Config {
int m_basebandSampleRate;
Real m_outputSampleRate;
diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp
index 45dec33f6..997ffbabb 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.cpp
+++ b/plugins/channeltx/udpsink/udpsinkgui.cpp
@@ -488,6 +488,11 @@ void UDPSinkGUI::on_applyBtn_clicked()
applySettings();
}
+void UDPSinkGUI::on_resetUDPReadIndex_clicked()
+{
+ m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
+}
+
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h
index 79e5759d0..70ad678bc 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.h
+++ b/plugins/channeltx/udpsink/udpsinkgui.h
@@ -70,6 +70,7 @@ private slots:
void on_gain_valueChanged(int value);
void on_squelch_valueChanged(int value);
void on_channelMute_toggled(bool checked);
+ void on_resetUDPReadIndex_clicked();
void tick();
private:
diff --git a/plugins/channeltx/udpsink/udpsinkgui.ui b/plugins/channeltx/udpsink/udpsinkgui.ui
index 7a35f66f0..1be8afcb9 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.ui
+++ b/plugins/channeltx/udpsink/udpsinkgui.ui
@@ -544,7 +544,7 @@
16777215
- 14
+ 12
@@ -585,7 +585,7 @@
16777215
- 14
+ 12
@@ -625,6 +625,25 @@
+ -
+
+
+
+ 0
+ 22
+
+
+
+
+ 22
+ 16777215
+
+
+
+ R
+
+
+
-