renamed SpyServer source module class AirspyHFSourceModule -> SpyServerSourceModule, so that it does not collide with the original Airspy HF source module causing massive memory corruption

This commit is contained in:
Thomas Gimpel 2021-10-08 22:24:09 +02:00
parent 4b2f3e4f60
commit 3fd4294afa

View File

@ -46,9 +46,9 @@ const int streamFormatsBitCount[] = {
ConfigManager config; ConfigManager config;
class AirspyHFSourceModule : public ModuleManager::Instance { class SpyServerSourceModule : public ModuleManager::Instance {
public: public:
AirspyHFSourceModule(std::string name) { SpyServerSourceModule(std::string name) {
this->name = name; this->name = name;
config.acquire(); config.acquire();
@ -70,7 +70,7 @@ public:
sigpath::sourceManager.registerSource("SpyServer", &handler); sigpath::sourceManager.registerSource("SpyServer", &handler);
} }
~AirspyHFSourceModule() { ~SpyServerSourceModule() {
stop(this); stop(this);
sigpath::sourceManager.unregisterSource("SpyServer"); sigpath::sourceManager.unregisterSource("SpyServer");
} }
@ -105,20 +105,20 @@ private:
} }
static void menuSelected(void* ctx) { static void menuSelected(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
core::setInputSampleRate(_this->sampleRate); core::setInputSampleRate(_this->sampleRate);
gui::mainWindow.playButtonLocked = !(_this->client && _this->client->isOpen()); gui::mainWindow.playButtonLocked = !(_this->client && _this->client->isOpen());
spdlog::info("AirspyHFSourceModule '{0}': Menu Select!", _this->name); spdlog::info("SpyServerSourceModule '{0}': Menu Select!", _this->name);
} }
static void menuDeselected(void* ctx) { static void menuDeselected(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
gui::mainWindow.playButtonLocked = false; gui::mainWindow.playButtonLocked = false;
spdlog::info("AirspyHFSourceModule '{0}': Menu Deselect!", _this->name); spdlog::info("SpyServerSourceModule '{0}': Menu Deselect!", _this->name);
} }
static void start(void* ctx) { static void start(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) { return; } if (_this->running) { return; }
int srvBits = streamFormatsBitCount[_this->iqType]; int srvBits = streamFormatsBitCount[_this->iqType];
@ -131,30 +131,30 @@ private:
_this->client->startStream(); _this->client->startStream();
_this->running = true; _this->running = true;
spdlog::info("AirspyHFSourceModule '{0}': Start!", _this->name); spdlog::info("SpyServerSourceModule '{0}': Start!", _this->name);
} }
static void stop(void* ctx) { static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (!_this->running) { return; } if (!_this->running) { return; }
_this->client->stopStream(); _this->client->stopStream();
_this->running = false; _this->running = false;
spdlog::info("AirspyHFSourceModule '{0}': Stop!", _this->name); spdlog::info("SpyServerSourceModule '{0}': Stop!", _this->name);
} }
static void tune(double freq, void* ctx) { static void tune(double freq, void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) { if (_this->running) {
_this->client->setSetting(SPYSERVER_SETTING_IQ_FREQUENCY, freq); _this->client->setSetting(SPYSERVER_SETTING_IQ_FREQUENCY, freq);
} }
_this->freq = freq; _this->freq = freq;
spdlog::info("AirspyHFSourceModule '{0}': Tune: {1}!", _this->name, freq); spdlog::info("SpyServerSourceModule '{0}': Tune: {1}!", _this->name, freq);
} }
static void menuHandler(void* ctx) { static void menuHandler(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth(); float menuWidth = ImGui::GetContentRegionAvailWidth();
bool connected = (_this->client && _this->client->isOpen()); bool connected = (_this->client && _this->client->isOpen());
@ -321,11 +321,11 @@ MOD_EXPORT void _INIT_() {
} }
MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) { MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) {
return new AirspyHFSourceModule(name); return new SpyServerSourceModule(name);
} }
MOD_EXPORT void _DELETE_INSTANCE_(ModuleManager::Instance* instance) { MOD_EXPORT void _DELETE_INSTANCE_(ModuleManager::Instance* instance) {
delete (AirspyHFSourceModule*)instance; delete (SpyServerSourceModule*)instance;
} }
MOD_EXPORT void _END_() { MOD_EXPORT void _END_() {