SDRdaemonFEC plugin: fixed GUI

pull/27/head
f4exb 2016-07-18 00:39:35 +02:00
rodzic 85d9a101bf
commit 29240f66dd
7 zmienionych plików z 100 dodań i 88 usunięć

Wyświetl plik

@ -29,7 +29,10 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) :
m_frameHead(0),
m_decoderIndexHead(nbDecoderSlots/2),
m_curNbBlocks(0),
m_minNbBlocks(256),
m_curNbRecovery(0),
m_maxNbRecovery(0),
m_framesDecoded(true),
m_throttlemsNominal(throttlems),
m_readIndex(0),
m_readBuffer(0),
@ -79,11 +82,23 @@ void SDRdaemonFECBuffer::initDecodeAllSlots()
void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
{
// collect stats before voiding the slot
m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount;
m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount;
m_avgNbBlocks(m_curNbBlocks);
m_avgNbRecovery(m_curNbRecovery);
m_framesDecoded = m_framesDecoded && m_decoderSlots[slotIndex].m_decoded;
if (m_curNbBlocks < m_minNbBlocks) {
m_minNbBlocks = m_curNbBlocks;
}
if (m_curNbRecovery > m_maxNbRecovery) {
m_maxNbRecovery = m_curNbRecovery;
}
// void the slot
m_decoderSlots[slotIndex].m_blockCount = 0;
m_decoderSlots[slotIndex].m_originalCount = 0;
m_decoderSlots[slotIndex].m_recoveryCount = 0;

Wyświetl plik

@ -93,11 +93,33 @@ public:
const MetaDataFEC& getCurrentMeta() const { return m_currentMeta; }
// stats
int getCurNbBlocks() const { return m_curNbBlocks; }
int getCurNbBlocks() const { return m_curNbBlocks; }
int getCurNbRecovery() const { return m_curNbRecovery; }
float getAvgNbBlocks() const { return m_avgNbBlocks; }
float getAvgNbRecovery() const { return m_avgNbRecovery; }
int getMinNbBlocks()
{
int minNbBlocks = m_minNbBlocks;
m_minNbBlocks = 256;
return minNbBlocks;
}
int getMaxNbRecovery()
{
int maxNbRecovery = m_maxNbRecovery;
m_maxNbRecovery = 0;
return maxNbRecovery;
}
bool allFramesDecoded()
{
bool framesDecoded = m_framesDecoded;
m_framesDecoded = true;
return framesDecoded;
}
float getBufferLengthInSecs() const { return m_bufferLenSec; }
int32_t getRWBalanceCorrection() const { return m_balCorrection; }
@ -157,9 +179,12 @@ private:
int m_decoderIndexHead; //!< index of the current head frame slot in decoding slots
int m_frameHead; //!< index of the current head frame sent
int m_curNbBlocks; //!< (stats) instantaneous number of blocks received
int m_minNbBlocks; //!< (stats) minimum number of blocks received since last poll
int m_curNbRecovery; //!< (stats) instantaneous number of recovery blocks used
int m_maxNbRecovery; //!< (stats) maximum number of recovery blocks used since last poll
MovingAverage<int, int, 10> m_avgNbBlocks; //!< (stats) average number of blocks received
MovingAverage<int, int, 10> m_avgNbRecovery; //!< (stats) average number of recovery blocks used
bool m_framesDecoded; //!< [stats] true if all frames were decoded since last poll
int m_readIndex; //!< current byte read index in frames buffer
int m_wrDeltaEstimate; //!< Sampled estimate of write to read indexes difference
int m_readNbBytes; //!< Nominal number of bytes per read (50ms)

Wyświetl plik

@ -50,7 +50,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceAPI *deviceAPI, QWidget* parent) :
m_lastEngineState((DSPDeviceEngine::State)-1),
m_sampleRate(0),
m_centerFrequency(0),
m_framesComplete(false),
m_allFramesDecoded(false),
m_bufferLengthInSecs(0.0),
m_bufferGauge(-50),
m_samplesCount(0),
@ -285,11 +285,11 @@ 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_framesComplete = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getFramesComplete();
m_allFramesDecoded = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAllFramesDecoded();
m_bufferLengthInSecs = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferLengthInSecs();
m_bufferGauge = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferGauge();
m_curNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getCurNbBlocks();
m_curNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getCurNbRecovery();
m_minNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbBlocks();
m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getmAXNbRecovery();
m_avgNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbBlocks();
m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery();
@ -581,8 +581,6 @@ void SDRdaemonFECGui::updateWithAcquisition()
void SDRdaemonFECGui::updateWithStreamData()
{
ui->centerFrequency->setValue(m_centerFrequency / 1000);
QString s1 = QString::number(m_sampleRate/1000.0, 'f', 3);
ui->sampleRateText->setText(tr("%1").arg(s1));
updateWithStreamTime();
}
@ -599,10 +597,10 @@ void SDRdaemonFECGui::updateWithStreamTime()
QString s_date = dt.toString("yyyy-MM-dd hh:mm:ss.zzz");
ui->absTimeText->setText(s_date);
if (m_framesComplete) {
ui->framesComplete->setStyleSheet("QToolButton { background-color : green; }");
if (m_allFramesDecoded) {
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : green; }");
} else {
ui->framesComplete->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
QString s = QString::number(m_bufferLengthInSecs, 'f', 1);
@ -614,13 +612,13 @@ void SDRdaemonFECGui::updateWithStreamTime()
ui->bufferGaugeNegative->setValue((m_bufferGauge < 0 ? -m_bufferGauge : 0));
ui->bufferGaugePositive->setValue((m_bufferGauge < 0 ? 0 : m_bufferGauge));
s = QString::number(m_curNbBlocks, 'f', 0);
ui->avgNbBlocksText->setText(tr("%1").arg(s));
s = QString::number(m_minNbBlocks, 'f', 0);
ui->minNbBlocksText->setText(tr("%1").arg(s));
s = QString::number(m_avgNbBlocks, 'f', 1);
ui->avgNbBlocksText->setText(tr("%1").arg(s));
s = QString::number(m_curNbRecovery, 'f', 0);
s = QString::number(m_maxNbRecovery, 'f', 0);
ui->curNbRecoveryText->setText(tr("%1").arg(s));
s = QString::number(m_avgNbRecovery, 'f', 1);

Wyświetl plik

@ -64,11 +64,11 @@ private:
int m_sampleRate;
quint64 m_centerFrequency;
struct timeval m_startingTimeStamp;
bool m_framesComplete;
bool m_allFramesDecoded;
float m_bufferLengthInSecs;
int32_t m_bufferGauge;
int m_curNbBlocks;
int m_curNbRecovery;
int m_minNbBlocks;
int m_maxNbRecovery;
float m_avgNbBlocks;
float m_avgNbRecovery;

Wyświetl plik

@ -304,7 +304,7 @@
<item>
<layout class="QHBoxLayout" name="streamLayout">
<item>
<widget class="QToolButton" name="framesComplete">
<widget class="QToolButton" name="allFramesDecoded">
<property name="enabled">
<bool>false</bool>
</property>
@ -321,59 +321,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateText">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Actual sample rate (kS/s)</string>
</property>
<property name="text">
<string>00000.000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineStream1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="bufferRWBalanceText">
<property name="minimumSize">
<size>
<width>22</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Main buffer read/write positions unbalance (%): positive means read leads</string>
</property>
<property name="text">
<string>-00</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">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="curNbBlocksText">
<widget class="QLabel" name="minNbBlocksText">
<property name="minimumSize">
<size>
<width>24</width>
@ -381,10 +329,10 @@
</size>
</property>
<property name="toolTip">
<string>Total number of blocks retrieved per frame</string>
<string>Minimum number of blocks retrieved per frame</string>
</property>
<property name="text">
<string>128</string>
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -433,7 +381,7 @@
</size>
</property>
<property name="toolTip">
<string>Number of recovery blocks used per frame</string>
<string>Maximum number of recovery blocks used per frame</string>
</property>
<property name="text">
<string>000</string>
@ -501,6 +449,32 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineStream2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="bufferRWBalanceText">
<property name="minimumSize">
<size>
<width>22</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Main buffer read/write positions unbalance (%): positive means read leads</string>
</property>
<property name="text">
<string>-00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

Wyświetl plik

@ -166,11 +166,11 @@ public:
public:
uint32_t get_tv_sec() const { return m_tv_sec; }
uint32_t get_tv_usec() const { return m_tv_usec; }
bool getFramesComplete() const { return m_framesComplete; }
bool getAllFramesDecoded() const { return m_allFramesDecoded; }
float getBufferLengthInSecs() const { return m_bufferLenSec; }
int32_t getBufferGauge() const { return m_bufferGauge; }
int getCurNbBlocks() const { return m_curNbBlocks; }
int getCurNbRecovery() const { return m_curNbRecovery; }
int getMinNbBlocks() const { return m_minNbBlocks; }
int getmAXNbRecovery() const { return m_maxNbRecovery; }
float getAvgNbBlocks() const { return m_avgNbBlocks; }
float getAvgNbRecovery() const { return m_avgNbRecovery; }
@ -178,7 +178,7 @@ public:
uint32_t tv_usec,
float bufferLenSec,
int32_t bufferGauge,
int nbOriginalBlocks,
bool allFramesDecoded,
int curNbBlocks,
int curNbRecovery,
float avgNbBlocks,
@ -188,7 +188,7 @@ public:
tv_usec,
bufferLenSec,
bufferGauge,
nbOriginalBlocks,
allFramesDecoded,
curNbBlocks,
curNbRecovery,
avgNbBlocks,
@ -198,11 +198,11 @@ public:
protected:
uint32_t m_tv_sec;
uint32_t m_tv_usec;
bool m_framesComplete;
bool m_allFramesDecoded;
float m_bufferLenSec;
int32_t m_bufferGauge;
int m_curNbBlocks;
int m_curNbRecovery;
int m_minNbBlocks;
int m_maxNbRecovery;
float m_avgNbBlocks;
float m_avgNbRecovery;
@ -210,7 +210,7 @@ public:
uint32_t tv_usec,
float bufferLenSec,
int32_t bufferGauge,
int nbOriginalBlocks,
bool allFramesDecoded,
int curNbBlocks,
int curNbRecovery,
float avgNbBlocks,
@ -218,11 +218,11 @@ public:
Message(),
m_tv_sec(tv_sec),
m_tv_usec(tv_usec),
m_framesComplete(curNbBlocks == nbOriginalBlocks),
m_allFramesDecoded(allFramesDecoded),
m_bufferLenSec(bufferLenSec),
m_bufferGauge(bufferGauge),
m_curNbBlocks(curNbBlocks),
m_curNbRecovery(curNbRecovery),
m_minNbBlocks(curNbBlocks),
m_maxNbRecovery(curNbRecovery),
m_avgNbBlocks(avgNbBlocks),
m_avgNbRecovery(avgNbRecovery)
{ }

Wyświetl plik

@ -227,9 +227,9 @@ void SDRdaemonFECUDPHandler::tick()
m_tv_usec,
m_sdrDaemonBuffer.getBufferLengthInSecs(),
m_sdrDaemonBuffer.getBufferGauge(),
SDRdaemonFECBuffer::m_nbOriginalBlocks,
m_sdrDaemonBuffer.getCurNbBlocks(),
m_sdrDaemonBuffer.getCurNbRecovery(),
m_sdrDaemonBuffer.allFramesDecoded(),
m_sdrDaemonBuffer.getMinNbBlocks(),
m_sdrDaemonBuffer.getMaxNbRecovery(),
m_sdrDaemonBuffer.getAvgNbBlocks(),
m_sdrDaemonBuffer.getAvgNbRecovery());
m_outputMessageQueueToGUI->push(report);