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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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