1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -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::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)
{

View File

@ -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;

View File

@ -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))

View File

@ -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:

View File

@ -544,7 +544,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>14</height>
<height>12</height>
</size>
</property>
<property name="toolTip">
@ -585,7 +585,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>14</height>
<height>12</height>
</size>
</property>
<property name="toolTip">
@ -625,6 +625,25 @@
</property>
</widget>
</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>
<spacer name="horizontalSpacer_2">
<property name="orientation">