| 2691 | } |
| 2692 | |
| 2693 | void NetworkDiagnosticsDialog::refresh() |
| 2694 | { |
| 2695 | const NetworkDiagnosticsSample sample = m_history ? m_history->latestSample() : NetworkDiagnosticsSample{}; |
| 2696 | |
| 2697 | // Status and RTT |
| 2698 | m_statusLabel->setText(m_model->networkQuality()); |
| 2699 | m_targetIpLabel->setText(m_model->targetRadioIp().isEmpty() |
| 2700 | ? "Not connected" |
| 2701 | : m_model->targetRadioIp()); |
| 2702 | m_sourcePathLabel->setText(m_model->selectedSourcePath()); |
| 2703 | m_tcpEndpointLabel->setText(m_model->localTcpEndpoint()); |
| 2704 | m_udpEndpointLabel->setText(m_model->localUdpEndpoint()); |
| 2705 | m_udpSeenLabel->setText(m_model->firstUdpPacketSeen() ? "Yes" : "No"); |
| 2706 | |
| 2707 | const int rtt = m_model->lastPingRtt(); |
| 2708 | m_rttLabel->setText(rtt < 1 ? "< 1 ms" : QString("%1 ms").arg(rtt)); |
| 2709 | m_overviewStatusValue->setText(m_model->networkQuality()); |
| 2710 | m_overviewLatencyValue->setText(rtt < 1 ? "< 1 ms" : QString("%1 ms").arg(rtt)); |
| 2711 | |
| 2712 | const int maxRtt = m_model->maxPingRtt(); |
| 2713 | m_maxRttLabel->setText(maxRtt < 1 ? "< 1 ms" : QString("%1 ms").arg(maxRtt)); |
| 2714 | |
| 2715 | // Per-category rates |
| 2716 | static constexpr PanadapterStream::StreamCategory cats[] = { |
| 2717 | PanadapterStream::CatAudio, PanadapterStream::CatFFT, |
| 2718 | PanadapterStream::CatWaterfall, PanadapterStream::CatMeter |
| 2719 | }; |
| 2720 | QLabel* rateLabels[] = { m_audioRateLabel, m_fftRateLabel, m_wfRateLabel, m_meterRateLabel }; |
| 2721 | QLabel* dropLabels[] = { m_audioDropLabel, m_fftDropLabel, m_wfDropLabel, m_meterDropLabel }; |
| 2722 | |
| 2723 | for (int i = 0; i < 4; ++i) { |
| 2724 | PanadapterStream::CategoryStats cs = m_model->categoryStats(cats[i]); |
| 2725 | double rateKbps = 0.0; |
| 2726 | if (cats[i] == PanadapterStream::CatAudio) { |
| 2727 | rateKbps = sample.audioKbps; |
| 2728 | } else if (cats[i] == PanadapterStream::CatFFT) { |
| 2729 | rateKbps = sample.fftKbps; |
| 2730 | } else if (cats[i] == PanadapterStream::CatWaterfall) { |
| 2731 | rateKbps = sample.waterfallKbps; |
| 2732 | } else if (cats[i] == PanadapterStream::CatMeter) { |
| 2733 | rateKbps = sample.meterKbps; |
| 2734 | } |
| 2735 | rateLabels[i]->setText(QString("%1 kbps").arg(static_cast<int>(rateKbps))); |
| 2736 | dropLabels[i]->setText(formatDrop(cs)); |
| 2737 | } |
| 2738 | |
| 2739 | // DAX traffic |
| 2740 | { |
| 2741 | PanadapterStream::CategoryStats cs = m_model->categoryStats(PanadapterStream::CatDAX); |
| 2742 | m_daxRateLabel->setText(QString("%1 kbps").arg(static_cast<int>(sample.daxKbps))); |
| 2743 | m_daxDropLabel->setText(formatDrop(cs)); |
| 2744 | } |
| 2745 | |
| 2746 | // Total RX: all UDP bytes received on our VITA-49 socket |
| 2747 | m_rxRateLabel->setText(QString("%1 kbps").arg(static_cast<int>(sample.rxKbps))); |
| 2748 | m_txRateLabel->setText(QString("%1 kbps").arg(static_cast<int>(sample.txKbps))); |
| 2749 | |
| 2750 | // Total dropped (across all owned streams) |
nothing calls this directly
no test coverage detected