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(hackrf_source PRIVATE "C:/Program Files/PothosSDR/bin/")
|
||||
|
||||
target_link_libraries(hackrf_source PRIVATE hackrf)
|
||||
elseif (ANDROID)
|
||||
target_include_directories(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/libusb/libusb
|
||||
/mnt/android_sdr/hackrf/host/libhackrf/src
|
||||
)
|
||||
|
||||
target_link_libraries(sdrpp_core PUBLIC
|
||||
/mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so
|
||||
/mnt/android_sdr/output/libhackrf/${ANDROID_ABI}/libhackrf.so
|
||||
)
|
||||
else (MSVC)
|
||||
find_package(PkgConfig)
|
||||
|
||||
|
@ -5,11 +5,18 @@
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
#include <config.h>
|
||||
#include <libhackrf/hackrf.h>
|
||||
#include <gui/widgets/stepped_slider.h>
|
||||
#include <options.h>
|
||||
#include <gui/smgui.h>
|
||||
|
||||
#ifndef __ANDROID__
|
||||
#include <libhackrf/hackrf.h>
|
||||
#else
|
||||
#include <android_backend.h>
|
||||
#include <spdlog/sinks/android_sink.h>
|
||||
#include <hackrf.h>
|
||||
#endif
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
SDRPP_MOD_INFO{
|
||||
@ -127,6 +134,7 @@ public:
|
||||
devList.clear();
|
||||
devListTxt = "";
|
||||
|
||||
#ifndef __ANDROID__
|
||||
uint64_t serials[256];
|
||||
hackrf_device_list_t* _devList = hackrf_device_list();
|
||||
|
||||
@ -137,6 +145,15 @@ public:
|
||||
}
|
||||
|
||||
hackrf_device_list_free(_devList);
|
||||
#else
|
||||
int vid, pid;
|
||||
devFd = backend::getDeviceFD(vid, pid, backend::HACKRF_VIDPIDS);
|
||||
if (devFd < 0) { return; }
|
||||
std::string fakeName = "HackRF USB";
|
||||
devList.push_back("fake_serial");
|
||||
devListTxt += fakeName;
|
||||
devListTxt += '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void selectFirst() {
|
||||
@ -229,7 +246,11 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
hackrf_error err = (hackrf_error)hackrf_open_by_serial(_this->selectedSerial.c_str(), &_this->openDev);
|
||||
#else
|
||||
hackrf_error err = (hackrf_error)hackrf_open_by_fd(&_this->openDev, _this->devFd);
|
||||
#endif
|
||||
if (err != HACKRF_SUCCESS) {
|
||||
spdlog::error("Could not open HackRF {0}: {1}", _this->selectedSerial, hackrf_error_name(err));
|
||||
return;
|
||||
@ -383,6 +404,10 @@ private:
|
||||
float lna = 0;
|
||||
float vga = 0;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
int devFd = -1;
|
||||
#endif
|
||||
|
||||
std::vector<std::string> devList;
|
||||
std::string devListTxt;
|
||||
};
|
||||
|
Reference in New Issue
Block a user