More bugfix

This commit is contained in:
Ryzerth 2021-07-26 04:16:00 +02:00
parent 85de72a859
commit fa9347f2ee
13 changed files with 45 additions and 83 deletions

View File

@ -239,9 +239,7 @@ private:
static void start(void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (_this->selectedSerial == 0) {
spdlog::error("Tried to start Airspy source with null serial");
return;
@ -296,9 +294,7 @@ private:
static void stop(void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
airspy_close(_this->openDev);

View File

@ -215,9 +215,7 @@ private:
static void start(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (_this->selectedSerial == 0) {
spdlog::error("Tried to start AirspyHF+ source with null serial");
return;
@ -248,9 +246,7 @@ private:
static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
airspyhf_close(_this->openDev);

View File

@ -313,9 +313,7 @@ private:
static void start(void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (_this->devCount == 0) { return; }
// Open device
@ -360,9 +358,7 @@ private:
static void stop(void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();

View File

@ -24,33 +24,35 @@ namespace module_manager_menu {
}
void draw(void* ctx) {
ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg);
ImGui::TableSetupColumn("Name");
ImGui::TableSetupColumn("Type");
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 10);
ImGui::TableHeadersRow();
if (ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) {
ImGui::TableSetupColumn("Name");
ImGui::TableSetupColumn("Type");
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 10);
ImGui::TableHeadersRow();
float height = ImGui::CalcTextSize("-").y;
float height = ImGui::CalcTextSize("-").y;
for (auto& [name, inst] : core::moduleManager.instances) {
ImGui::TableNextRow();
for (auto& [name, inst] : core::moduleManager.instances) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text(name.c_str());
ImGui::TableSetColumnIndex(0);
ImGui::Text(name.c_str());
ImGui::TableSetColumnIndex(1);
ImGui::Text(inst.module.info->name);
ImGui::TableSetColumnIndex(1);
ImGui::Text(inst.module.info->name);
ImGui::TableSetColumnIndex(2);
ImVec2 origPos = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(origPos.x - 3, origPos.y));
if (ImGui::Button(("##module_mgr_"+name).c_str(), ImVec2(height,height))) {
core::moduleManager.deleteInstance(name);
ImGui::TableSetColumnIndex(2);
ImVec2 origPos = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(origPos.x - 3, origPos.y));
if (ImGui::Button(("##module_mgr_"+name).c_str(), ImVec2(height,height))) {
core::moduleManager.deleteInstance(name);
}
ImGui::SetCursorPos(ImVec2(origPos.x + 2, origPos.y - 5));
ImGui::Text("_");
}
ImGui::SetCursorPos(ImVec2(origPos.x + 2, origPos.y - 5));
ImGui::Text("_");
ImGui::EndTable();
}
ImGui::EndTable();
// Add module row with slightly different settings
ImGui::BeginTable("Module Manager Add Table", 3);

View File

@ -223,9 +223,7 @@ private:
static void start(void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (_this->selectedSerial == "") {
spdlog::error("Tried to start HackRF source with empty serial");
return;
@ -254,9 +252,7 @@ private:
static void stop(void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
// TODO: Stream stop

View File

@ -315,9 +315,7 @@ private:
static void start(void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
// Open device
_this->openDev = NULL;
@ -355,9 +353,7 @@ private:
static void stop(void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->streamRunning = false;

View File

@ -85,9 +85,7 @@ private:
static void start(void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
// TODO: INIT CONTEXT HERE
_this->ctx = iio_create_context_from_uri(_this->ip);
@ -126,9 +124,7 @@ private:
static void stop(void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
_this->workerThread.join();

View File

@ -241,9 +241,7 @@ private:
static void start(void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (_this->selectedDevName == "") {
spdlog::error("No device selected");
return;
@ -282,9 +280,7 @@ private:
static void stop(void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
rtlsdr_cancel_async(_this->openDev);

View File

@ -119,9 +119,7 @@ private:
static void start(void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
if (!_this->client.connectToRTL(_this->ip, _this->port)) {
spdlog::error("Could not connect to {0}:{1}", _this->ip, _this->port);
return;
@ -142,9 +140,7 @@ private:
static void stop(void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
_this->workerThread.join();

View File

@ -156,9 +156,7 @@ private:
static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();

View File

@ -478,9 +478,7 @@ private:
static void start(void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
// First, acquire device
sdrplay_api_ErrT err;
@ -599,9 +597,7 @@ private:
static void stop(void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();

View File

@ -295,6 +295,7 @@ private:
static void start(void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
if (_this->running) { return; }
_this->dev = SoapySDR::Device::make(_this->devArgs);
_this->dev->setSampleRate(SOAPY_SDR_RX, _this->channelId, _this->sampleRate);
@ -329,6 +330,7 @@ private:
static void stop(void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
if (!_this->running) { return; }
_this->running = false;
_this->dev->deactivateStream(_this->devStream);
_this->dev->closeStream(_this->devStream);

View File

@ -119,9 +119,7 @@ private:
static void start(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) {
return;
}
if (_this->running) { return; }
int srvBits = streamFormatsBitCount[_this->iqType];
_this->client->setSetting(SPYSERVER_SETTING_IQ_FORMAT, streamFormats[_this->iqType]);
@ -138,9 +136,7 @@ private:
static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (!_this->running) {
return;
}
if (!_this->running) { return; }
_this->client->stopStream();