Skip to content

Commit

Permalink
disable soapysdr runtime setting for SoapySDR API below 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-sholohov committed Apr 16, 2024
1 parent 2d0d24b commit a30d73c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source_modules/soapy_source/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@
#include <SoapySDR/Device.hpp>
#include <SoapySDR/Modules.hpp>
#include <SoapySDR/Logger.hpp>
#include <SoapySDR/Version.hpp>
#include <core.h>
#include <gui/style.h>
#include <gui/smgui.h>

#define CONCAT(a, b) ((std::string(a) + b).c_str())

#if defined(SOAPY_SDR_API_VERSION) && (SOAPY_SDR_API_VERSION >= 0x00080000)
#define ENABLE_SOAPYSDR_RUNTIME_SETTINGS
#endif

SDRPP_MOD_INFO{
/* Name: */ "soapy_source",
/* Description: */ "SoapySDR source module for SDR++",
Expand Down Expand Up @@ -238,7 +243,9 @@ class SoapyModule : public ModuleManager::Instance {

hasAgc = dev->hasGainMode(SOAPY_SDR_RX, channelId);

#ifdef ENABLE_SOAPYSDR_RUNTIME_SETTINGS
settings = dev->getSettingInfo();
#endif

SoapySDR::Device::unmake(dev);

Expand Down Expand Up @@ -316,6 +323,7 @@ class SoapyModule : public ModuleManager::Instance {
if (hasAgc) {
conf["agc"] = agc;
}
#ifdef ENABLE_SOAPYSDR_RUNTIME_SETTINGS
if (running) {
for (const SoapySDR::ArgInfo& argInfo : settings) {
std::string val = dev->readSetting(argInfo.key);
Expand All @@ -325,6 +333,7 @@ class SoapyModule : public ModuleManager::Instance {
}
}
}
#endif
config.acquire();
config.conf["devices"][devArgs["label"]] = conf;
config.release(true);
Expand Down Expand Up @@ -539,6 +548,7 @@ class SoapyModule : public ModuleManager::Instance {
}
}

#ifdef ENABLE_SOAPYSDR_RUNTIME_SETTINGS
for (const SoapySDR::ArgInfo& argInfo : _this->settings) {
if (!_this->running)
break;
Expand Down Expand Up @@ -624,6 +634,7 @@ class SoapyModule : public ModuleManager::Instance {
ImGui::SetTooltip("%s", argInfo.description.c_str());
} */
}
#endif
}

static void _worker(SoapyModule* _this) {
Expand Down Expand Up @@ -671,7 +682,9 @@ class SoapyModule : public ModuleManager::Instance {
int uiBandwidthId = 0;
std::vector<float> bandwidthList;
std::string txtBwList;
#ifdef ENABLE_SOAPYSDR_RUNTIME_SETTINGS
SoapySDR::ArgInfoList settings;
#endif
char stringSettingVal[1024];
std::unordered_map<std::string, std::string> configSettings;
char txtExtraDeviceArgs[256];
Expand Down

0 comments on commit a30d73c

Please sign in to comment.