| 5769 | } |
| 5770 | |
| 5771 | MainWindow::BandStackPreselectResult MainWindow::preselectBandStackForTune( |
| 5772 | SliceModel* slice, double mhz, const char* source) |
| 5773 | { |
| 5774 | if (!slice || slice->panId().isEmpty()) |
| 5775 | return BandStackPreselectResult::NotNeeded; |
| 5776 | if (mhz <= 54.0 && slice->frequency() <= 54.0) |
| 5777 | return BandStackPreselectResult::NotNeeded; |
| 5778 | |
| 5779 | const QString targetBand = BandSettings::bandForFrequency(mhz); |
| 5780 | const QString currentBand = BandSettings::bandForFrequency(slice->frequency()); |
| 5781 | if (targetBand == currentBand) |
| 5782 | return BandStackPreselectResult::NotNeeded; |
| 5783 | |
| 5784 | const auto xvtrs = xvtrPolicyBandsFrom(m_radioModel.xvtrList()); |
| 5785 | const auto stackKeyResult = |
| 5786 | XvtrPolicy::resolveBandStackKey(targetBand, xvtrs, m_radioModel.capabilities()); |
| 5787 | if (!stackKeyResult.isSupported()) { |
| 5788 | QString unsupportedReason = stackKeyResult.unsupportedReason; |
| 5789 | if (mhz > 54.0 && xvtrs.isEmpty()) { |
| 5790 | unsupportedReason = |
| 5791 | QString("Band %1 requires a configured XVTR before Aether can tune it.") |
| 5792 | .arg(targetBand); |
| 5793 | } |
| 5794 | qCWarning(lcProtocol).noquote().nospace() |
| 5795 | << "MainWindow: direct tune cannot preselect band stack source=" |
| 5796 | << (source ? source : "(unknown)") |
| 5797 | << " pan=" << slice->panId() |
| 5798 | << " from_band=" << currentBand |
| 5799 | << " to_band=" << targetBand |
| 5800 | << " freq_mhz=" << QString::number(mhz, 'f', 6) |
| 5801 | << " reason=" << unsupportedReason |
| 5802 | << " available_xvtrs=" << xvtrListSummary(xvtrs); |
| 5803 | statusBar()->showMessage(unsupportedReason, 5000); |
| 5804 | return BandStackPreselectResult::Unsupported; |
| 5805 | } |
| 5806 | |
| 5807 | qCDebug(lcProtocol).noquote().nospace() |
| 5808 | << "MainWindow: direct tune preselecting band stack source=" |
| 5809 | << (source ? source : "(unknown)") |
| 5810 | << " pan=" << slice->panId() |
| 5811 | << " from_band=" << currentBand |
| 5812 | << " to_band=" << targetBand |
| 5813 | << " key=" << stackKeyResult.key; |
| 5814 | clearSwrSweepForBandChange(-1, slice->panId(), targetBand); |
| 5815 | m_bandSettings.setCurrentBand(targetBand); |
| 5816 | m_radioModel.sendCommand( |
| 5817 | QString("display pan set %1 band=%2").arg(slice->panId(), stackKeyResult.key)); |
| 5818 | QTimer::singleShot(300, this, [this, panId = slice->panId()]() { |
| 5819 | reassertUnmutedSliceAudioForPan(panId); |
| 5820 | }); |
| 5821 | return BandStackPreselectResult::Selected; |
| 5822 | } |
| 5823 | |
| 5824 | bool MainWindow::tuneBlockedByGuards(SliceModel* slice) |
| 5825 | { |
nothing calls this directly
no test coverage detected