mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-27 04:47:51 +02:00
Backend abstraction + added android support + partial high DPI scaling
This commit is contained in:
@ -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)
|
||||
|
||||
|
@ -10,6 +10,10 @@
|
||||
#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 +79,7 @@ public:
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
#ifndef __ANDROID__
|
||||
devList.clear();
|
||||
devListTxt = "";
|
||||
|
||||
@ -88,6 +93,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 +129,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 +266,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 +596,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;
|
||||
|
Reference in New Issue
Block a user