diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp index 9b58566e3..4012f8e41 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp @@ -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() diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h index ab32292f9..0ab9b5f8d 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h @@ -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; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui index 533483b86..c3eb16c25 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui @@ -309,7 +309,7 @@ false - Frames complete + Frames status: green = all original received, blue = some recovered by FEC, none = some lost ... @@ -449,6 +449,32 @@ + + + + Qt::Vertical + + + + + + + + 52 + 0 + + + + Nominal number of blocks per frame: Total/FEC + + + 000/000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h index 01ce8a510..68e37ccbc 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h @@ -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) { } }; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp index 57b531aae..55f232d2f 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp @@ -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); } }