diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index ff2cd43..ec6bc3f 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -810,9 +810,19 @@ void AppFrame::updateDeviceParams() { antennaMenuItems[wxID_ANTENNA_CURRENT]->SetItemLabel(getSettingsLabel("Antenna", antennaChecked)); } } - + + //Add an informative, read-only menu entry to display the current TX selected antenna, if any. + if (devInfo->getAntennaNames(SOAPY_SDR_TX, 0).size() > 1) { + + currentTXantennaName = devInfo->getAntennaName(SOAPY_SDR_TX, 0); + + newSettingsMenu->AppendSeparator(); + + antennaMenuItems[wxID_ANTENNA_CURRENT_TX] = newSettingsMenu->Append(wxID_ANTENNA_CURRENT_TX, getSettingsLabel("TX Antenna", currentTXantennaName)); + antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->Enable(false); + } + //Runtime settings part - SoapySDR::ArgInfoList::const_iterator args_i; settingArgs = soapyDev->getSettingInfo(); @@ -1688,6 +1698,16 @@ void AppFrame::OnIdle(wxIdleEvent& event) { if (deviceChanged.load()) { updateDeviceParams(); } + + //Refresh the current TX antenna on, if any: + if (devInfo) { + std::string actualTxAntenna = devInfo->getAntennaName(SOAPY_SDR_TX, 0); + + if (currentTXantennaName != actualTxAntenna) { + currentTXantennaName = actualTxAntenna; + antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->SetItemLabel(getSettingsLabel("TX Antenna", currentTXantennaName)); + } + } //try to garbage collect the retired demodulators. wxGetApp().getDemodMgr().garbageCollect(); diff --git a/src/AppFrame.h b/src/AppFrame.h index a32f1e1..2cab9d6 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -65,7 +65,8 @@ #define wxID_SETTINGS_BASE 2300 #define wxID_ANTENNA_CURRENT 2500 -#define wxID_ANTENNAS_BASE 2501 +#define wxID_ANTENNA_CURRENT_TX 2501 +#define wxID_ANTENNAS_BASE 2502 #define wxID_DEVICE_ID 3500 @@ -222,6 +223,8 @@ private: long manualSampleRate = -1; std::vector antennaNames; + + std::string currentTXantennaName; std::string currentSessionFile; diff --git a/src/sdr/SDRDeviceInfo.cpp b/src/sdr/SDRDeviceInfo.cpp index 34c3c9b..8542a9a 100644 --- a/src/sdr/SDRDeviceInfo.cpp +++ b/src/sdr/SDRDeviceInfo.cpp @@ -191,10 +191,26 @@ std::vector SDRDeviceInfo::getSampleRates(int direction, size_t channel) { } std::vector SDRDeviceInfo::getAntennaNames(int direction, size_t channel) { + SoapySDR::Device *dev = getSoapyDevice(); - return dev->listAntennas(direction, channel); - + if (dev) { + + return dev->listAntennas(direction, channel); + } + + return std::vector(); +} + +std::string SDRDeviceInfo::getAntennaName(int direction, size_t channel) { + SoapySDR::Device *dev = getSoapyDevice(); + + if (dev) { + return dev->getAntenna(direction, channel); + } + + return std::string(""); + } long SDRDeviceInfo::getSampleRateNear(int direction, size_t channel, long sampleRate_in) { diff --git a/src/sdr/SDRDeviceInfo.h b/src/sdr/SDRDeviceInfo.h index d0bf831..e5d9bc2 100644 --- a/src/sdr/SDRDeviceInfo.h +++ b/src/sdr/SDRDeviceInfo.h @@ -85,6 +85,8 @@ public: std::vector getSampleRates(int direction, size_t channel); std::vector getAntennaNames(int direction, size_t channel); + + std::string getAntennaName(int direction, size_t channel); long getSampleRateNear(int direction, size_t channel, long sampleRate_in);