1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-06 23:27:48 -04:00

SDRDaemonSink: GUI: completed status display

This commit is contained in:
f4exb 2018-08-30 08:45:57 +02:00
parent e20e14ac75
commit 829299cb74
3 changed files with 49 additions and 0 deletions

View File

@ -55,6 +55,9 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
{ {
m_countUnrecoverable = 0; m_countUnrecoverable = 0;
m_countRecovered = 0; m_countRecovered = 0;
m_lastCountUnrecoverable = 0;
m_lastCountRecovered = 0;
m_resetCounts = true;
m_paletteGreenText.setColor(QPalette::WindowText, Qt::green); m_paletteGreenText.setColor(QPalette::WindowText, Qt::green);
m_paletteRedText.setColor(QPalette::WindowText, Qt::red); m_paletteRedText.setColor(QPalette::WindowText, Qt::red);
@ -68,6 +71,8 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(7, 32000U, 9000000U); ui->sampleRate->setValueRange(7, 32000U, 9000000U);
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
connect(&(m_deviceUISet->m_deviceSinkAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&(m_deviceUISet->m_deviceSinkAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -428,6 +433,23 @@ void SDRdaemonSinkGui::displayEventCounts()
ui->eventRecText->setText(nstr); ui->eventRecText->setText(nstr);
} }
void SDRdaemonSinkGui::displayEventStatus(int recoverableCount, int unrecoverableCount)
{
if (unrecoverableCount == 0)
{
if (recoverableCount == 0) {
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : green; }");
} else {
ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
}
else
{
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : red; }");
}
}
void SDRdaemonSinkGui::displayEventTimer() void SDRdaemonSinkGui::displayEventTimer()
{ {
int elapsedTimeMillis = m_time.elapsed(); int elapsedTimeMillis = m_time.elapsed();
@ -473,6 +495,7 @@ void SDRdaemonSinkGui::networkManagerFinished(QNetworkReply *reply)
{ {
if (reply->error()) if (reply->error())
{ {
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
qDebug() << "SDRdaemonSinkGui::networkManagerFinished" << reply->errorString(); qDebug() << "SDRdaemonSinkGui::networkManagerFinished" << reply->errorString();
return; return;
} }
@ -487,16 +510,19 @@ void SDRdaemonSinkGui::networkManagerFinished(QNetworkReply *reply)
if (error.error == QJsonParseError::NoError) if (error.error == QJsonParseError::NoError)
{ {
ui->apiAddressLabel->setStyleSheet("QLabel { background-color : green; }");
analyzeChannelReport(doc.object()); analyzeChannelReport(doc.object());
} }
else else
{ {
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
QString errorMsg = QString("Reply JSON error: ") + error.errorString() + QString(" at offset ") + QString::number(error.offset); QString errorMsg = QString("Reply JSON error: ") + error.errorString() + QString(" at offset ") + QString::number(error.offset);
qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg; qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
} }
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
QString errorMsg = QString("Error parsing request: ") + ex.what(); QString errorMsg = QString("Error parsing request: ") + ex.what();
qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg; qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
} }
@ -513,5 +539,21 @@ void SDRdaemonSinkGui::analyzeChannelReport(const QJsonObject& jsonObject)
QString queueLengthText = QString("%1/%2").arg(queueLength).arg(queueSize); QString queueLengthText = QString("%1/%2").arg(queueLength).arg(queueSize);
ui->queueLengthText->setText(queueLengthText); ui->queueLengthText->setText(queueLengthText);
ui->queueLengthGauge->setValue((queueLength*100)/queueSize); ui->queueLengthGauge->setValue((queueLength*100)/queueSize);
int unrecoverableCount = report["uncorrectableErrorsCount"].toInt();
int recoverableCount = report["correctableErrorsCount"].toInt();
if (!m_resetCounts)
{
int recoverableCountDelta = recoverableCount - m_lastCountRecovered;
int unrecoverableCountDelta = unrecoverableCount - m_lastCountUnrecoverable;
displayEventStatus(recoverableCountDelta, unrecoverableCountDelta);
m_countRecovered += recoverableCountDelta;
m_countUnrecoverable += unrecoverableCountDelta;
displayEventCounts();
}
m_resetCounts = false;
m_lastCountRecovered = recoverableCount;
m_lastCountUnrecoverable = unrecoverableCount;
} }
} }

View File

@ -79,6 +79,9 @@ private:
uint32_t m_countUnrecoverable; uint32_t m_countUnrecoverable;
uint32_t m_countRecovered; uint32_t m_countRecovered;
uint32_t m_lastCountUnrecoverable;
uint32_t m_lastCountRecovered;
bool m_resetCounts;
QTime m_time; QTime m_time;
QPalette m_paletteGreenText; QPalette m_paletteGreenText;
@ -99,6 +102,7 @@ private:
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void updateTxDelayTooltip(); void updateTxDelayTooltip();
void displayEventCounts(); void displayEventCounts();
void displayEventStatus(int recoverableCount, int unrecoverableCount);
void displayEventTimer(); void displayEventTimer();
void analyzeChannelReport(const QJsonObject& jsonObject); void analyzeChannelReport(const QJsonObject& jsonObject);

View File

@ -498,6 +498,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Green if communication OK else KO</string>
</property>
<property name="text"> <property name="text">
<string>API</string> <string>API</string>
</property> </property>