1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

UDPSink plugin: implemented reset read index button

This commit is contained in:
f4exb 2017-08-18 17:51:11 +02:00
parent 130759fba7
commit 83026bea59
5 changed files with 62 additions and 2 deletions

View File

@ -23,6 +23,7 @@
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message)
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) : UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
m_uiMessageQueue(uiMessageQueue), m_uiMessageQueue(uiMessageQueue),
@ -343,6 +344,16 @@ bool UDPSink::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgResetReadIndex::match(cmd))
{
m_settingsMutex.lock();
m_udpHandler.resetReadIndex();
m_settingsMutex.unlock();
qDebug() << "UDPSink::handleMessage: MsgResetReadIndex";
return true;
}
else else
{ {
if(m_spectrum != 0) if(m_spectrum != 0)
@ -389,6 +400,12 @@ void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
messageQueue->push(cmd); messageQueue->push(cmd);
} }
void UDPSink::resetReadIndex(MessageQueue* messageQueue)
{
Message* cmd = MsgResetReadIndex::create();
messageQueue->push(cmd);
}
void UDPSink::apply(bool force) void UDPSink::apply(bool force)
{ {

View File

@ -72,6 +72,7 @@ public:
bool squelchEnabled, bool squelchEnabled,
bool force = false); bool force = false);
void setSpectrum(MessageQueue* messageQueue, bool enabled); void setSpectrum(MessageQueue* messageQueue, bool enabled);
void resetReadIndex(MessageQueue* messageQueue);
signals: 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 { struct Config {
int m_basebandSampleRate; int m_basebandSampleRate;
Real m_outputSampleRate; Real m_outputSampleRate;

View File

@ -488,6 +488,11 @@ void UDPSinkGUI::on_applyBtn_clicked()
applySettings(); applySettings();
} }
void UDPSinkGUI::on_resetUDPReadIndex_clicked()
{
m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
}
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown) void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{ {
if ((widget == ui->spectrumBox) && (m_udpSink != 0)) if ((widget == ui->spectrumBox) && (m_udpSink != 0))

View File

@ -70,6 +70,7 @@ private slots:
void on_gain_valueChanged(int value); void on_gain_valueChanged(int value);
void on_squelch_valueChanged(int value); void on_squelch_valueChanged(int value);
void on_channelMute_toggled(bool checked); void on_channelMute_toggled(bool checked);
void on_resetUDPReadIndex_clicked();
void tick(); void tick();
private: private:

View File

@ -544,7 +544,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>14</height> <height>12</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@ -585,7 +585,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>14</height> <height>12</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@ -625,6 +625,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="resetUDPReadIndex">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">