1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 18:15:45 -05:00

SDRdaemonFEC plugin: GUI enhancements

This commit is contained in:
f4exb 2016-07-24 11:09:11 +02:00
parent fac8465575
commit bbccea9432
5 changed files with 78 additions and 19 deletions

View File

@ -50,7 +50,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceAPI *deviceAPI, QWidget* parent) :
m_lastEngineState((DSPDeviceEngine::State)-1),
m_sampleRate(0),
m_centerFrequency(0),
m_allFramesDecoded(false),
m_framesDecodingStatus(0),
m_bufferLengthInSecs(0.0),
m_bufferGauge(-50),
m_samplesCount(0),
@ -62,7 +62,9 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceAPI *deviceAPI, QWidget* parent) :
m_dataPortEdited(false),
m_initSendConfiguration(false),
m_dcBlock(false),
m_iqCorrection(false)
m_iqCorrection(false),
m_nbOriginalBlocks(128),
m_nbFECBlocks(0)
{
m_sender = nn_socket(AF_SP, NN_PAIR);
assert(m_sender != -1);
@ -285,13 +287,15 @@ bool SDRdaemonFECGui::handleMessage(const Message& message)
{
m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_sec();
m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_usec();
m_allFramesDecoded = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAllFramesDecoded();
m_framesDecodingStatus = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getFramesDecodingStatus();
m_bufferLengthInSecs = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferLengthInSecs();
m_bufferGauge = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferGauge();
m_minNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbBlocks();
m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getmAXNbRecovery();
m_avgNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbBlocks();
m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery();
m_nbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbOriginalBlocksPerFrame();
m_nbFECBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbFECBlocksPerFrame();
updateWithStreamTime();
return true;
@ -598,8 +602,10 @@ void SDRdaemonFECGui::updateWithStreamTime()
QString s_date = dt.toString("yyyy-MM-dd hh:mm:ss.zzz");
ui->absTimeText->setText(s_date);
if (m_allFramesDecoded) {
if (m_framesDecodingStatus == 2) {
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : green; }");
} else if (m_framesDecodingStatus == 1) {
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : blue; }");
} else {
ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
@ -624,6 +630,10 @@ void SDRdaemonFECGui::updateWithStreamTime()
s = QString::number(m_avgNbRecovery, 'f', 1);
ui->avgNbRecoveryText->setText(tr("%1").arg(s));
s = QString::number(m_nbOriginalBlocks + m_nbFECBlocks, 'f', 0);
QString s1 = QString::number(m_nbFECBlocks, 'f', 0);
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
}
void SDRdaemonFECGui::updateStatus()

View File

@ -64,13 +64,15 @@ private:
int m_sampleRate;
quint64 m_centerFrequency;
struct timeval m_startingTimeStamp;
bool m_allFramesDecoded;
int m_framesDecodingStatus;
float m_bufferLengthInSecs;
int32_t m_bufferGauge;
int m_minNbBlocks;
int m_maxNbRecovery;
float m_avgNbBlocks;
float m_avgNbRecovery;
int m_nbOriginalBlocks;
int m_nbFECBlocks;
int m_samplesCount;
std::size_t m_tickCount;

View File

@ -309,7 +309,7 @@
<bool>false</bool>
</property>
<property name="toolTip">
<string>Frames complete</string>
<string>Frames status: green = all original received, blue = some recovered by FEC, none = some lost</string>
</property>
<property name="text">
<string>...</string>
@ -449,6 +449,32 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineStream7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nominalNbBlocksText">
<property name="minimumSize">
<size>
<width>52</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Nominal number of blocks per frame: Total/FEC</string>
</property>
<property name="text">
<string>000/000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineStream2">
<property name="orientation">

View File

@ -166,65 +166,77 @@ public:
public:
uint32_t get_tv_sec() const { return m_tv_sec; }
uint32_t get_tv_usec() const { return m_tv_usec; }
bool getAllFramesDecoded() const { return m_allFramesDecoded; }
int getFramesDecodingStatus() const { return m_framesDecodingStatus; }
float getBufferLengthInSecs() const { return m_bufferLenSec; }
int32_t getBufferGauge() const { return m_bufferGauge; }
int getMinNbBlocks() const { return m_minNbBlocks; }
int getmAXNbRecovery() const { return m_maxNbRecovery; }
float getAvgNbBlocks() const { return m_avgNbBlocks; }
float getAvgNbRecovery() const { return m_avgNbRecovery; }
int getNbOriginalBlocksPerFrame() const { return m_nbOriginalBlocksPerFrame; }
int getNbFECBlocksPerFrame() const { return m_nbFECBlocksPerFrame; }
static MsgReportSDRdaemonFECStreamTiming* create(uint32_t tv_sec,
uint32_t tv_usec,
float bufferLenSec,
int32_t bufferGauge,
bool allFramesDecoded,
int framesDecodingStatus,
int curNbBlocks,
int curNbRecovery,
float avgNbBlocks,
float avgNbRecovery)
float avgNbRecovery,
int nbOriginalBlocksPerFrame,
int nbFECBlocksPerFrame)
{
return new MsgReportSDRdaemonFECStreamTiming(tv_sec,
tv_usec,
bufferLenSec,
bufferGauge,
allFramesDecoded,
framesDecodingStatus,
curNbBlocks,
curNbRecovery,
avgNbBlocks,
avgNbRecovery);
avgNbRecovery,
nbOriginalBlocksPerFrame,
nbFECBlocksPerFrame);
}
protected:
uint32_t m_tv_sec;
uint32_t m_tv_usec;
bool m_allFramesDecoded;
int m_framesDecodingStatus;
float m_bufferLenSec;
int32_t m_bufferGauge;
int m_minNbBlocks;
int m_maxNbRecovery;
float m_avgNbBlocks;
float m_avgNbRecovery;
int m_nbOriginalBlocksPerFrame;
int m_nbFECBlocksPerFrame;
MsgReportSDRdaemonFECStreamTiming(uint32_t tv_sec,
uint32_t tv_usec,
float bufferLenSec,
int32_t bufferGauge,
bool allFramesDecoded,
int framesDecodingStatus,
int curNbBlocks,
int curNbRecovery,
float avgNbBlocks,
float avgNbRecovery) :
float avgNbRecovery,
int nbOriginalBlocksPerFrame,
int nbFECBlocksPerFrame) :
Message(),
m_tv_sec(tv_sec),
m_tv_usec(tv_usec),
m_allFramesDecoded(allFramesDecoded),
m_framesDecodingStatus(framesDecodingStatus),
m_bufferLenSec(bufferLenSec),
m_bufferGauge(bufferGauge),
m_minNbBlocks(curNbBlocks),
m_maxNbRecovery(curNbRecovery),
m_avgNbBlocks(avgNbBlocks),
m_avgNbRecovery(avgNbRecovery)
m_avgNbRecovery(avgNbRecovery),
m_nbOriginalBlocksPerFrame(nbOriginalBlocksPerFrame),
m_nbFECBlocksPerFrame(nbFECBlocksPerFrame)
{ }
};

View File

@ -221,17 +221,26 @@ void SDRdaemonFECUDPHandler::tick()
}
else
{
int framesDecodingStatus;
int minNbBlocks = m_sdrDaemonBuffer.getMinNbBlocks();
int nbOriginalBlocks = m_sdrDaemonBuffer.getCurrentMeta().m_nbOriginalBlocks;
int nbFECblocks = m_sdrDaemonBuffer.getCurrentMeta().m_nbFECBlocks;
m_tickCount = 0;
framesDecodingStatus = (minNbBlocks < nbOriginalBlocks ? 0 : (minNbBlocks < nbOriginalBlocks + nbFECblocks ? 1 : 2));
SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming *report = SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming::create(
m_tv_sec,
m_tv_usec,
m_sdrDaemonBuffer.getBufferLengthInSecs(),
m_sdrDaemonBuffer.getBufferGauge(),
m_sdrDaemonBuffer.allFramesDecoded(),
m_sdrDaemonBuffer.getMinNbBlocks(),
framesDecodingStatus,
minNbBlocks,
m_sdrDaemonBuffer.getMaxNbRecovery(),
m_sdrDaemonBuffer.getAvgNbBlocks(),
m_sdrDaemonBuffer.getAvgNbRecovery());
m_sdrDaemonBuffer.getAvgNbRecovery(),
nbOriginalBlocks,
nbFECblocks);
m_outputMessageQueueToGUI->push(report);
}
}