mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-26 12:27:51 +02:00
Backend abstraction + added android support + partial high DPI scaling
This commit is contained in:
@ -22,6 +22,16 @@ if (MSVC)
|
||||
target_link_directories(rtl_sdr_source PRIVATE "C:/Program Files/PothosSDR/bin/")
|
||||
|
||||
target_link_libraries(rtl_sdr_source PRIVATE rtlsdr)
|
||||
elseif (ANDROID)
|
||||
target_include_directories(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/libusb/libusb
|
||||
/mnt/android_sdr/librtlsdr/include
|
||||
)
|
||||
|
||||
target_link_libraries(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so
|
||||
/mnt/android_sdr/output/librtlsdr/${ANDROID_ABI}/librtlsdr.so
|
||||
)
|
||||
else (MSVC)
|
||||
find_package(PkgConfig)
|
||||
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include <gui/smgui.h>
|
||||
#include <rtl-sdr.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android_backend.h>
|
||||
#endif
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
@ -114,6 +117,7 @@ public:
|
||||
devNames.clear();
|
||||
devListTxt = "";
|
||||
|
||||
#ifndef __ANDROID__
|
||||
devCount = rtlsdr_get_device_count();
|
||||
char buf[1024];
|
||||
for (int i = 0; i < devCount; i++) {
|
||||
@ -123,6 +127,20 @@ public:
|
||||
devListTxt += buf;
|
||||
devListTxt += '\0';
|
||||
}
|
||||
#else
|
||||
// Check for device connection
|
||||
devCount = 0;
|
||||
int vid, pid;
|
||||
devFd = backend::getDeviceFD(vid, pid, backend::RTL_SDR_VIDPIDS);
|
||||
if (devFd < 0) { return; }
|
||||
|
||||
// Generate fake device info
|
||||
devCount = 1;
|
||||
std::string fakeName = "RTL-SDR Dongle USB";
|
||||
devNames.push_back(fakeName);
|
||||
devListTxt += fakeName;
|
||||
devListTxt += '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void selectFirst() {
|
||||
@ -144,9 +162,15 @@ public:
|
||||
void selectById(int id) {
|
||||
selectedDevName = devNames[id];
|
||||
|
||||
if (rtlsdr_open(&openDev, id) < 0) {
|
||||
#ifndef __ANDROID__
|
||||
int oret = rtlsdr_open(&openDev, id);
|
||||
#else
|
||||
int oret = rtlsdr_open(&openDev, devFd);
|
||||
#endif
|
||||
|
||||
if (oret < 0) {
|
||||
selectedDevName = "";
|
||||
spdlog::error("Could not open RTL-SDR");
|
||||
spdlog::error("Could not open RTL-SDR: {0}", oret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,7 +276,13 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtlsdr_open(&_this->openDev, _this->devId) < 0) {
|
||||
#ifndef __ANDROID__
|
||||
int oret = rtlsdr_open(&_this->openDev, _this->devId);
|
||||
#else
|
||||
int oret = rtlsdr_open(&_this->openDev, _this->devFd);
|
||||
#endif
|
||||
|
||||
if (oret < 0) {
|
||||
spdlog::error("Could not open RTL-SDR");
|
||||
return;
|
||||
}
|
||||
@ -510,6 +540,10 @@ private:
|
||||
int devCount = 0;
|
||||
std::thread workerThread;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
int devFd = -1;
|
||||
#endif
|
||||
|
||||
int ppm = 0;
|
||||
|
||||
bool biasT = false;
|
||||
|
Reference in New Issue
Block a user