mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-25 02:18:30 +01:00
work
This commit is contained in:
parent
c95c7b18af
commit
b65da2fd49
@ -59,6 +59,7 @@ option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependen
|
|||||||
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
|
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
|
||||||
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
|
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
|
||||||
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
|
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
|
||||||
|
option(OPT_BUILD_RIGCTL_CLIENT "Rigctl client to make SDR++ act as a panadapter" ON)
|
||||||
option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON)
|
option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON)
|
||||||
option(OPT_BUILD_SCANNER "Frequency scanner" ON)
|
option(OPT_BUILD_SCANNER "Frequency scanner" ON)
|
||||||
option(OPT_BUILD_SCHEDULER "Build the scheduler" OFF)
|
option(OPT_BUILD_SCHEDULER "Build the scheduler" OFF)
|
||||||
@ -189,6 +190,10 @@ if (OPT_BUILD_RECORDER)
|
|||||||
add_subdirectory("misc_modules/recorder")
|
add_subdirectory("misc_modules/recorder")
|
||||||
endif (OPT_BUILD_RECORDER)
|
endif (OPT_BUILD_RECORDER)
|
||||||
|
|
||||||
|
if (OPT_BUILD_RIGCTL_CLIENT)
|
||||||
|
add_subdirectory("misc_modules/rigctl_client")
|
||||||
|
endif (OPT_BUILD_RIGCTL_CLIENT)
|
||||||
|
|
||||||
if (OPT_BUILD_RIGCTL_SERVER)
|
if (OPT_BUILD_RIGCTL_SERVER)
|
||||||
add_subdirectory("misc_modules/rigctl_server")
|
add_subdirectory("misc_modules/rigctl_server")
|
||||||
endif (OPT_BUILD_RIGCTL_SERVER)
|
endif (OPT_BUILD_RIGCTL_SERVER)
|
||||||
|
@ -84,7 +84,9 @@ void SourceManager::tune(double freq) {
|
|||||||
if (selectedHandler == NULL) {
|
if (selectedHandler == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedHandler->tuneHandler(freq + tuneOffset, selectedHandler->ctx);
|
// TODO: No need to always retune the hardware in panadpter mode
|
||||||
|
selectedHandler->tuneHandler((tuneMode == TuningMode::NORMAL) ? (freq + tuneOffset) : ifFreq, selectedHandler->ctx);
|
||||||
|
onRetune.emit(freq);
|
||||||
currentFreq = freq;
|
currentFreq = freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,3 +94,13 @@ void SourceManager::setTuningOffset(double offset) {
|
|||||||
tuneOffset = offset;
|
tuneOffset = offset;
|
||||||
tune(currentFreq);
|
tune(currentFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SourceManager::setTuningMode(TuningMode mode) {
|
||||||
|
tuneMode = mode;
|
||||||
|
tune(currentFreq);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceManager::setPanadpterIF(double freq) {
|
||||||
|
ifFreq = freq;
|
||||||
|
tune(currentFreq);
|
||||||
|
}
|
@ -21,6 +21,11 @@ public:
|
|||||||
void* ctx;
|
void* ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TuningMode {
|
||||||
|
NORMAL,
|
||||||
|
PANADAPTER
|
||||||
|
};
|
||||||
|
|
||||||
void registerSource(std::string name, SourceHandler* handler);
|
void registerSource(std::string name, SourceHandler* handler);
|
||||||
void unregisterSource(std::string name);
|
void unregisterSource(std::string name);
|
||||||
void selectSource(std::string name);
|
void selectSource(std::string name);
|
||||||
@ -29,12 +34,15 @@ public:
|
|||||||
void stop();
|
void stop();
|
||||||
void tune(double freq);
|
void tune(double freq);
|
||||||
void setTuningOffset(double offset);
|
void setTuningOffset(double offset);
|
||||||
|
void setTuningMode(TuningMode mode);
|
||||||
|
void setPanadpterIF(double freq);
|
||||||
|
|
||||||
std::vector<std::string> getSourceNames();
|
std::vector<std::string> getSourceNames();
|
||||||
|
|
||||||
Event<std::string> onSourceRegistered;
|
Event<std::string> onSourceRegistered;
|
||||||
Event<std::string> onSourceUnregister;
|
Event<std::string> onSourceUnregister;
|
||||||
Event<std::string> onSourceUnregistered;
|
Event<std::string> onSourceUnregistered;
|
||||||
|
Event<double> onRetune;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, SourceHandler*> sources;
|
std::map<std::string, SourceHandler*> sources;
|
||||||
@ -42,5 +50,7 @@ private:
|
|||||||
SourceHandler* selectedHandler = NULL;
|
SourceHandler* selectedHandler = NULL;
|
||||||
double tuneOffset;
|
double tuneOffset;
|
||||||
double currentFreq;
|
double currentFreq;
|
||||||
|
double ifFreq = 0.0;
|
||||||
|
TuningMode tuneMode;
|
||||||
dsp::stream<dsp::complex_t> nullSource;
|
dsp::stream<dsp::complex_t> nullSource;
|
||||||
};
|
};
|
24
misc_modules/rigctl_client/CMakeLists.txt
Normal file
24
misc_modules/rigctl_client/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(rigctl_client)
|
||||||
|
|
||||||
|
file(GLOB SRC "src/*.cpp")
|
||||||
|
|
||||||
|
add_library(rigctl_client SHARED ${SRC})
|
||||||
|
target_link_libraries(rigctl_client PRIVATE sdrpp_core)
|
||||||
|
set_target_properties(rigctl_client PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
target_include_directories(rigctl_client PRIVATE "src/")
|
||||||
|
target_include_directories(rigctl_client PRIVATE "../recorder/src")
|
||||||
|
target_include_directories(rigctl_client PRIVATE "../../decoder_modules/meteor_demodulator/src")
|
||||||
|
target_include_directories(rigctl_client PRIVATE "../../decoder_modules/radio/src")
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(rigctl_client PRIVATE /O2 /Ob2 /std:c++17 /EHsc)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
target_compile_options(rigctl_client PRIVATE -O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
|
||||||
|
else ()
|
||||||
|
target_compile_options(rigctl_client PRIVATE -O3 -std=c++17)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Install directives
|
||||||
|
install(TARGETS rigctl_client DESTINATION lib/sdrpp/plugins)
|
104
misc_modules/rigctl_client/src/main.cpp
Normal file
104
misc_modules/rigctl_client/src/main.cpp
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#include <utils/networking.h>
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <module.h>
|
||||||
|
#include <gui/gui.h>
|
||||||
|
#include <gui/style.h>
|
||||||
|
#include <signal_path/signal_path.h>
|
||||||
|
#include <core.h>
|
||||||
|
#include <recorder_interface.h>
|
||||||
|
#include <meteor_demodulator_interface.h>
|
||||||
|
#include <config.h>
|
||||||
|
#include <cctype>
|
||||||
|
#include <radio_interface.h>
|
||||||
|
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||||
|
|
||||||
|
#define MAX_COMMAND_LENGTH 8192
|
||||||
|
|
||||||
|
SDRPP_MOD_INFO{
|
||||||
|
/* Name: */ "rigctl_client",
|
||||||
|
/* Description: */ "My fancy new module",
|
||||||
|
/* Author: */ "Ryzerth",
|
||||||
|
/* Version: */ 0, 1, 0,
|
||||||
|
/* Max instances */ 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
RECORDER_TYPE_RECORDER,
|
||||||
|
RECORDER_TYPE_METEOR_DEMODULATOR
|
||||||
|
};
|
||||||
|
|
||||||
|
ConfigManager config;
|
||||||
|
|
||||||
|
class SigctlServerModule : public ModuleManager::Instance {
|
||||||
|
public:
|
||||||
|
SigctlServerModule(std::string name) {
|
||||||
|
this->name = name;
|
||||||
|
|
||||||
|
_retuneHandler.ctx = this;
|
||||||
|
_retuneHandler.handler = retuneHandler;
|
||||||
|
|
||||||
|
sigpath::sourceManager.onRetune.bindHandler(&_retuneHandler);
|
||||||
|
gui::menu.registerEntry(name, menuHandler, this, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
~SigctlServerModule() {
|
||||||
|
gui::menu.removeEntry(name);
|
||||||
|
sigpath::sourceManager.onRetune.unbindHandler(&_retuneHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void postInit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void enable() {
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void disable() {
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void menuHandler(void* ctx) {
|
||||||
|
SigctlServerModule* _this = (SigctlServerModule*)ctx;
|
||||||
|
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Panadapter Mode", &_this->panMode)) {
|
||||||
|
sigpath::sourceManager.setPanadpterIF(8830000.0);
|
||||||
|
sigpath::sourceManager.setTuningMode(_this->panMode ? SourceManager::TuningMode::PANADAPTER : SourceManager::TuningMode::NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void retuneHandler(double freq, void* ctx) {
|
||||||
|
spdlog::warn("PAN RETUNE: {0}", freq);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
bool enabled = true;
|
||||||
|
bool panMode = false;
|
||||||
|
|
||||||
|
EventHandler<double> _retuneHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
MOD_EXPORT void _INIT_() {
|
||||||
|
config.setPath(core::args["root"].s() + "/rigctl_client_config.json");
|
||||||
|
config.load(json::object());
|
||||||
|
config.enableAutoSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) {
|
||||||
|
return new SigctlServerModule(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
|
||||||
|
delete (SigctlServerModule*)instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
MOD_EXPORT void _END_() {
|
||||||
|
config.disableAutoSave();
|
||||||
|
config.save();
|
||||||
|
}
|
10
misc_modules/rigctl_client/src/rigctl_client.h
Normal file
10
misc_modules/rigctl_client/src/rigctl_client.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <utils/networking.h>
|
||||||
|
|
||||||
|
class RigCTLClient {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user