mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
SDRDaemonSink GUI: enhanced status reporting
This commit is contained in:
parent
829299cb74
commit
90fb223b01
@ -57,6 +57,7 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_countRecovered = 0;
|
||||
m_lastCountUnrecoverable = 0;
|
||||
m_lastCountRecovered = 0;
|
||||
m_lastSampleCount = 0;
|
||||
m_resetCounts = true;
|
||||
|
||||
m_paletteGreenText.setColor(QPalette::WindowText, Qt::green);
|
||||
@ -335,6 +336,10 @@ void SDRdaemonSinkGui::on_apiAddress_returnPressed()
|
||||
{
|
||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||
sendSettings();
|
||||
|
||||
QString infoURL = QString("http://%1:%2/sdrdaemon").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::on_apiPort_returnPressed()
|
||||
@ -352,6 +357,10 @@ void SDRdaemonSinkGui::on_apiPort_returnPressed()
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
|
||||
QString infoURL = QString("http://%1:%2/sdrdaemon").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::on_dataAddress_returnPressed()
|
||||
@ -390,6 +399,10 @@ void SDRdaemonSinkGui::on_apiApplyButton_clicked(bool checked __attribute__((unu
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
|
||||
QString infoURL = QString("http://%1:%2/sdrdaemon").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::on_dataApplyButton_clicked(bool checked __attribute__((unused)))
|
||||
@ -496,7 +509,7 @@ void SDRdaemonSinkGui::networkManagerFinished(QNetworkReply *reply)
|
||||
if (reply->error())
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
qDebug() << "SDRdaemonSinkGui::networkManagerFinished" << reply->errorString();
|
||||
ui->statusText->setText(reply->errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -511,25 +524,30 @@ void SDRdaemonSinkGui::networkManagerFinished(QNetworkReply *reply)
|
||||
if (error.error == QJsonParseError::NoError)
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background-color : green; }");
|
||||
analyzeChannelReport(doc.object());
|
||||
ui->statusText->setText(QString("API OK"));
|
||||
analyzeApiReply(doc.object());
|
||||
}
|
||||
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);
|
||||
qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
ui->statusText->setText(QString("JSON error. See log"));
|
||||
qInfo().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
QString errorMsg = QString("Error parsing request: ") + ex.what();
|
||||
qDebug().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
ui->statusText->setText("Error parsing request. See log for details");
|
||||
qInfo().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::analyzeChannelReport(const QJsonObject& jsonObject)
|
||||
void SDRdaemonSinkGui::analyzeApiReply(const QJsonObject& jsonObject)
|
||||
{
|
||||
QString infoLine;
|
||||
|
||||
if (jsonObject.contains("SDRDaemonChannelSourceReport"))
|
||||
{
|
||||
QJsonObject report = jsonObject["SDRDaemonChannelSourceReport"].toObject();
|
||||
@ -541,6 +559,8 @@ void SDRdaemonSinkGui::analyzeChannelReport(const QJsonObject& jsonObject)
|
||||
ui->queueLengthGauge->setValue((queueLength*100)/queueSize);
|
||||
int unrecoverableCount = report["uncorrectableErrorsCount"].toInt();
|
||||
int recoverableCount = report["correctableErrorsCount"].toInt();
|
||||
int sampleCount = report["samplesCount"].toInt();
|
||||
uint64_t timestampUs = report["tvSec"].toInt()*1000000ULL + report["tvUSec"].toInt();
|
||||
|
||||
if (!m_resetCounts)
|
||||
{
|
||||
@ -552,8 +572,41 @@ void SDRdaemonSinkGui::analyzeChannelReport(const QJsonObject& jsonObject)
|
||||
displayEventCounts();
|
||||
}
|
||||
|
||||
if ((sampleCount - m_lastSampleCount) == 0) {
|
||||
ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
}
|
||||
|
||||
double remoteStreamRate = (sampleCount - m_lastSampleCount) / (double) (timestampUs - m_lastTimestampUs);
|
||||
ui->remoteStreamRateText->setText(QString("%1").arg(remoteStreamRate * 1e6, 0, 'f', 0));
|
||||
|
||||
m_resetCounts = false;
|
||||
m_lastCountRecovered = recoverableCount;
|
||||
m_lastCountUnrecoverable = unrecoverableCount;
|
||||
m_lastSampleCount = sampleCount;
|
||||
m_lastTimestampUs = timestampUs;
|
||||
}
|
||||
|
||||
if (jsonObject.contains("version")) {
|
||||
infoLine = "v" + jsonObject["version"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("qtVersion")) {
|
||||
infoLine += " Qt" + jsonObject["qtVersion"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("architecture")) {
|
||||
infoLine += " " + jsonObject["architecture"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("os")) {
|
||||
infoLine += " " + jsonObject["os"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("dspRxBits") && jsonObject.contains("dspTxBits")) {
|
||||
infoLine += QString(" %1/%2b").arg(jsonObject["dspRxBits"].toInt()).arg(jsonObject["dspTxBits"].toInt());
|
||||
}
|
||||
|
||||
if (infoLine.size() > 0) {
|
||||
ui->infoText->setText(infoLine);
|
||||
}
|
||||
}
|
||||
|
@ -75,12 +75,12 @@ private:
|
||||
bool m_doApplySettings;
|
||||
bool m_forceSettings;
|
||||
|
||||
int m_nnSender;
|
||||
|
||||
uint32_t m_countUnrecoverable;
|
||||
uint32_t m_countRecovered;
|
||||
uint32_t m_lastCountUnrecoverable;
|
||||
uint32_t m_lastCountRecovered;
|
||||
uint32_t m_lastSampleCount;
|
||||
uint64_t m_lastTimestampUs;
|
||||
bool m_resetCounts;
|
||||
QTime m_time;
|
||||
|
||||
@ -104,7 +104,7 @@ private:
|
||||
void displayEventCounts();
|
||||
void displayEventStatus(int recoverableCount, int unrecoverableCount);
|
||||
void displayEventTimer();
|
||||
void analyzeChannelReport(const QJsonObject& jsonObject);
|
||||
void analyzeApiReply(const QJsonObject& jsonObject);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>237</height>
|
||||
<height>270</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,7 +19,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>190</height>
|
||||
<height>270</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -358,7 +358,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Frames status: green = all original received, none = some recovered by FEC, red = some lost</string>
|
||||
<string>Frames status: green = all original received, none = some recovered by FEC, red = some lost, blue = remote not streaming</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -369,6 +369,38 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="remoteStreamRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remote stream rate (S/s)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0000000</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="remoteStreamRateUnits">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="eventCountsReset">
|
||||
<property name="maximumSize">
|
||||
@ -673,6 +705,28 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="statusLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusText">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="infoLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoText">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="padLayout">
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user