mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-27 03:06:09 +02:00
Merge pull request #649 from AlexandreRouma/backend_abstraction
Backend abstraction and android support
This commit is contained in:
.gitignoreCMakeLists.txtreadme.md
android
core
CMakeLists.txt
backends
android
glfw
src
backend.hcommand_args.cppcommand_args.hcore.cppcore.hcredits.cppglfw_window.h
gui
imgui
imgui.cppimgui.himgui_demo.cppimgui_draw.cppimgui_impl_glfw.cppimgui_impl_opengl3.cppimgui_impl_opengl3_loader.himgui_internal.himgui_tables.cppimgui_widgets.cpp
module.cppoptions.cppoptions.hserver.cppsignal_path
utils
version.hdecoder_modules
falcon9_decoder
src
kg_sstv_decoder
m17_decoder
src
meteor_demodulator
src
radio
weather_sat_decoder
misc_modules
frequency_manager
src
recorder
src
rigctl_server
src
scheduler
root/res/bandplans
sink_modules
android_audio_sink
audio_sink
src
network_sink
src
new_portaudio_sink
src
portaudio_sink
src
source_modules
airspy_source
airspyhf_source
bladerf_source
src
file_source
src
hackrf_source
limesdr_source
src
plutosdr_source
rfspace_source
src
rtl_sdr_source
rtl_tcp_source
src
sddc_source
src
sdrplay_source
src
sdrpp_server_source
src
soapy_source
src
spyserver_source
src
@ -24,6 +24,16 @@ if (MSVC)
|
||||
target_include_directories(airspy_source PUBLIC "C:/Program Files/PothosSDR/include/libairspy/")
|
||||
|
||||
target_link_libraries(airspy_source PRIVATE airspy)
|
||||
elseif (ANDROID)
|
||||
target_include_directories(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/libusb/libusb
|
||||
/mnt/android_sdr/airspyone_host/libairspy/src
|
||||
)
|
||||
|
||||
target_link_libraries(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so
|
||||
/mnt/android_sdr/output/libairspy/${ANDROID_ABI}/libairspy.so
|
||||
)
|
||||
else (MSVC)
|
||||
find_package(PkgConfig)
|
||||
|
||||
|
@ -6,10 +6,13 @@
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
#include <config.h>
|
||||
#include <options.h>
|
||||
#include <gui/smgui.h>
|
||||
#include <airspy.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android_backend.h>
|
||||
#endif
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
SDRPP_MOD_INFO{
|
||||
@ -75,6 +78,7 @@ public:
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
#ifndef __ANDROID__
|
||||
devList.clear();
|
||||
devListTxt = "";
|
||||
|
||||
@ -88,6 +92,18 @@ public:
|
||||
devListTxt += buf;
|
||||
devListTxt += '\0';
|
||||
}
|
||||
#else
|
||||
// Check for device presence
|
||||
int vid, pid;
|
||||
devFd = backend::getDeviceFD(vid, pid, backend::AIRSPY_VIDPIDS);
|
||||
if (devFd < 0) { return; }
|
||||
|
||||
// Get device info
|
||||
std::string fakeName = "Airspy USB";
|
||||
devList.push_back(0xDEADBEEF);
|
||||
devListTxt += fakeName;
|
||||
devListTxt += '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void selectFirst() {
|
||||
@ -112,7 +128,11 @@ public:
|
||||
void selectBySerial(uint64_t serial) {
|
||||
airspy_device* dev;
|
||||
try {
|
||||
#ifndef __ANDROID__
|
||||
int err = airspy_open_sn(&dev, serial);
|
||||
#else
|
||||
int err = airspy_open_sn(&dev, devFd);
|
||||
#endif
|
||||
if (err != 0) {
|
||||
char buf[1024];
|
||||
sprintf(buf, "%016" PRIX64, serial);
|
||||
@ -245,7 +265,11 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
int err = airspy_open_sn(&_this->openDev, _this->selectedSerial);
|
||||
#else
|
||||
int err = airspy_open_sn(&_this->openDev, _this->devFd);
|
||||
#endif
|
||||
if (err != 0) {
|
||||
char buf[1024];
|
||||
sprintf(buf, "%016" PRIX64, _this->selectedSerial);
|
||||
@ -571,6 +595,10 @@ private:
|
||||
bool lnaAgc = false;
|
||||
bool mixerAgc = false;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
int devFd = 0;
|
||||
#endif
|
||||
|
||||
std::vector<uint64_t> devList;
|
||||
std::string devListTxt;
|
||||
std::vector<uint32_t> sampleRateList;
|
||||
@ -581,7 +609,7 @@ MOD_EXPORT void _INIT_() {
|
||||
json def = json({});
|
||||
def["devices"] = json({});
|
||||
def["device"] = "";
|
||||
config.setPath(options::opts.root + "/airspy_config.json");
|
||||
config.setPath(core::args["root"].s() + "/airspy_config.json");
|
||||
config.load(def);
|
||||
config.enableAutoSave();
|
||||
}
|
||||
|
Reference in New Issue
Block a user