Added bias-t support to rtl_tcp source

This commit is contained in:
Ryzerth 2021-07-21 15:42:01 +02:00
parent fb32b4d55a
commit 8d3f646aec
2 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,7 @@ public:
rtlAGC = config.conf["rtlAGC"]; rtlAGC = config.conf["rtlAGC"];
tunerAGC = config.conf["tunerAGC"]; tunerAGC = config.conf["tunerAGC"];
gain = config.conf["gainIndex"]; gain = config.conf["gainIndex"];
biasTee = config.conf["biasTee"];
hostStr = hostStr.substr(0, 1023); hostStr = hostStr.substr(0, 1023);
strcpy(ip, hostStr.c_str()); strcpy(ip, hostStr.c_str());
config.release(); config.release();
@ -128,6 +129,7 @@ private:
_this->client.setDirectSampling(_this->directSamplingMode); _this->client.setDirectSampling(_this->directSamplingMode);
_this->client.setAGCMode(_this->rtlAGC); _this->client.setAGCMode(_this->rtlAGC);
_this->client.setGainIndex(_this->gain); _this->client.setGainIndex(_this->gain);
_this->client.setBiasTee(_this->biasTee);
_this->running = true; _this->running = true;
_this->workerThread = std::thread(worker, _this); _this->workerThread = std::thread(worker, _this);
spdlog::info("RTLTCPSourceModule '{0}': Start!", _this->name); spdlog::info("RTLTCPSourceModule '{0}': Start!", _this->name);
@ -218,6 +220,12 @@ private:
} }
} }
if (_this->tunerAGC) { style::endDisabled(); } if (_this->tunerAGC) { style::endDisabled(); }
if (ImGui::Checkbox(CONCAT("##_biast_select_", _this->name), &_this->biasTee)) {
if (_this->running) {
_this->client.setBiasTee(_this->biasTee);
}
}
} }
static void worker(void* ctx) { static void worker(void* ctx) {
@ -254,6 +262,7 @@ private:
bool tunerAGC = false; bool tunerAGC = false;
int directSamplingMode = 0; int directSamplingMode = 0;
int srId = 0; int srId = 0;
bool biasTee = false;
std::string srTxt = ""; std::string srTxt = "";
}; };
@ -267,8 +276,15 @@ MOD_EXPORT void _INIT_() {
defConf["rtlAGC"] = false; defConf["rtlAGC"] = false;
defConf["tunerAGC"] = false; defConf["tunerAGC"] = false;
defConf["gainIndex"] = 0; defConf["gainIndex"] = 0;
defConf["biasTee"] = false;
config.load(defConf); config.load(defConf);
config.enableAutoSave(); config.enableAutoSave();
config.acquire();
if (!config.conf.contains("biasTee")) {
config.conf["biasTee"] = false;
}
config.release(true);
} }
MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) { MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) {

View File

@ -172,6 +172,10 @@ public:
sendCommand(13, index); sendCommand(13, index);
} }
void setBiasTee(bool enabled) {
sendCommand(14, index);
}
private: private:
#ifdef _WIN32 #ifdef _WIN32
SOCKET sock; SOCKET sock;