Switched to new cleaner argument system

This commit is contained in:
AlexandreRouma
2022-02-24 20:49:53 +01:00
parent 5c138aa4a5
commit 2779516378
50 changed files with 777 additions and 205 deletions

View File

@ -6,7 +6,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/smgui.h>
#include <airspy.h>
@ -610,7 +609,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/airspy_config.json");
config.setPath(core::args["root"].s() + "/airspy_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -5,7 +5,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/smgui.h>
#include <airspyhf.h>
#include <gui/widgets/stepped_slider.h>
@ -407,7 +406,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/airspyhf_config.json");
config.setPath(core::args["root"].s() + "/airspyhf_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -6,7 +6,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <libbladeRF.h>
#include <dsp/processing.h>
@ -610,7 +609,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/bladerf_config.json");
config.setPath(core::args["root"].s() + "/bladerf_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -5,7 +5,6 @@
#include <signal_path/signal_path.h>
#include <wavreader.h>
#include <core.h>
#include <options.h>
#include <gui/widgets/file_select.h>
#include <filesystem>
#include <regex>
@ -28,7 +27,7 @@ public:
FileSourceModule(std::string name) : fileSelect("", { "Wav IQ Files (*.wav)", "*.wav", "All Files", "*" }) {
this->name = name;
if (options::opts.serverMode) { return; }
if (core::args["server"].b()) { return; }
config.acquire();
fileSelect.setPath(config.conf["path"], true);
@ -200,7 +199,7 @@ private:
MOD_EXPORT void _INIT_() {
json def = json({});
def["path"] = "";
config.setPath(options::opts.root + "/file_source_config.json");
config.setPath(core::args["root"].s() + "/file_source_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -6,7 +6,6 @@
#include <gui/style.h>
#include <config.h>
#include <gui/widgets/stepped_slider.h>
#include <options.h>
#include <gui/smgui.h>
#ifndef __ANDROID__
@ -416,7 +415,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/hackrf_config.json");
config.setPath(core::args["root"].s() + "/hackrf_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -5,7 +5,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/smgui.h>
#include <lime/LimeSuite.h>
@ -522,7 +521,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/limesdr_config.json");
config.setPath(core::args["root"].s() + "/limesdr_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -7,7 +7,6 @@
#include <gui/smgui.h>
#include <iio.h>
#include <ad9361.h>
#include <options.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -298,7 +297,7 @@ MOD_EXPORT void _INIT_() {
defConf["sampleRate"] = 4000000.0f;
defConf["gainMode"] = 0;
defConf["gain"] = 0.0f;
config.setPath(options::opts.root + "/plutosdr_source_config.json");
config.setPath(core::args["root"].s() + "/plutosdr_source_config.json");
config.load(defConf);
config.enableAutoSave();
}

View File

@ -7,7 +7,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <utils/optionlist.h>
#include <gui/smgui.h>
@ -326,7 +325,7 @@ MOD_EXPORT void _INIT_() {
def["hostname"] = "192.168.0.111";
def["port"] = 50000;
def["devices"] = json::object();
config.setPath(options::opts.root + "/rfspace_source_config.json");
config.setPath(core::args["root"].s() + "/rfspace_source_config.json");
config.load(def);
config.enableAutoSave();

View File

@ -5,7 +5,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/smgui.h>
#include <rtl-sdr.h>
@ -60,6 +59,8 @@ public:
RTLSDRSourceModule(std::string name) {
this->name = name;
serverMode = core::args["server"];
sampleRate = sampleRates[0];
handler.ctx = this;
@ -425,7 +426,7 @@ private:
SmGui::ForceSync();
// TODO: FIND ANOTHER WAY
if (options::opts.serverMode) {
if (serverMode) {
if (SmGui::SliderInt(CONCAT("##_rtlsdr_gain_", _this->name), &_this->gainId, 0, _this->gainList.size() - 1, SmGui::FMT_STR_NONE)) {
_this->updateGainTxt();
if (_this->running) {
@ -539,6 +540,7 @@ private:
int srId = 0;
int devCount = 0;
std::thread workerThread;
bool serverMode = false;
#ifdef __ANDROID__
int devFd = -1;
@ -571,7 +573,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = 0;
config.setPath(options::opts.root + "/rtl_sdr_config.json");
config.setPath(core::args["root"].s() + "/rtl_sdr_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -5,7 +5,6 @@
#include <gui/gui.h>
#include <signal_path/signal_path.h>
#include <core.h>
#include <options.h>
#include <gui/smgui.h>
#include <gui/style.h>
@ -337,7 +336,7 @@ private:
};
MOD_EXPORT void _INIT_() {
config.setPath(options::opts.root + "/rtl_tcp_config.json");
config.setPath(core::args["root"].s() + "/rtl_tcp_config.json");
json defConf;
defConf["host"] = "localhost";
defConf["port"] = 1234;

View File

@ -6,7 +6,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <libsddc.h>
@ -29,7 +28,7 @@ public:
AirspyHFSourceModule(std::string name) {
this->name = name;
if (options::opts.serverMode) { return; }
if (core::args["server"].b()) { return; }
sampleRate = 768000.0;
@ -229,7 +228,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/sddc_config.json");
config.setPath(core::args["root"].s() + "/sddc_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -6,7 +6,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <sdrplay_api.h>
#include <gui/smgui.h>
@ -1207,7 +1206,7 @@ MOD_EXPORT void _INIT_() {
json def = json({});
def["devices"] = json({});
def["device"] = "";
config.setPath(options::opts.root + "/sdrplay_config.json");
config.setPath(core::args["root"].s() + "/sdrplay_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -7,7 +7,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <utils/optionlist.h>
#include <gui/dialogs/dialog_box.h>
@ -30,7 +29,7 @@ public:
this->name = name;
// Yeah no server-ception, sorry...
if (options::opts.serverMode) { return; }
if (core::args["server"].b()) { return; }
// Initialize lists
sampleTypeList.define("Int8", dsp::PCM_TYPE_I8);
@ -282,7 +281,7 @@ MOD_EXPORT void _INIT_() {
def["hostname"] = "localhost";
def["port"] = 5259;
def["servers"] = json::object();
config.setPath(options::opts.root + "/sdrpp_server_source_config.json");
config.setPath(core::args["root"].s() + "/sdrpp_server_source_config.json");
config.load(def);
config.enableAutoSave();
}

View File

@ -10,7 +10,6 @@
#include <SoapySDR/Logger.hpp>
#include <core.h>
#include <gui/style.h>
#include <options.h>
#include <gui/smgui.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -525,7 +524,7 @@ private:
};
MOD_EXPORT void _INIT_() {
config.setPath(options::opts.root + "/soapy_source_config.json");
config.setPath(core::args["root"].s() + "/soapy_source_config.json");
json defConf;
defConf["device"] = "";
defConf["devices"] = json({});

View File

@ -7,7 +7,6 @@
#include <core.h>
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <gui/smgui.h>
@ -308,7 +307,7 @@ MOD_EXPORT void _INIT_() {
def["hostname"] = "localhost";
def["port"] = 5555;
def["devices"] = json::object();
config.setPath(options::opts.root + "/spyserver_config.json");
config.setPath(core::args["root"].s() + "/spyserver_config.json");
config.load(def);
config.enableAutoSave();