1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Merge pull request #2288 from srcejon/android_fixes

Fix Android build
This commit is contained in:
Edouard Griffiths 2024-10-22 17:01:58 +02:00 committed by GitHub
commit ed89eea72c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 125 additions and 68 deletions

View File

@ -277,6 +277,7 @@ set(INSTALL_PLUGINSSRV_DIR "${INSTALL_LIB_DIR}/pluginssrv")
if(ANDROID) if(ANDROID)
set(PLUGINS_PREFIX "sdrangel_plugins_") set(PLUGINS_PREFIX "sdrangel_plugins_")
set(PLUGINSSRV_PREFIX "sdrangel_pluginssrv_") set(PLUGINSSRV_PREFIX "sdrangel_pluginssrv_")
set(ANDROID_PACKAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/android/qt6 CACHE INTERNAL "")
else() else()
set(PLUGINS_PREFIX "") set(PLUGINS_PREFIX "")
set(PLUGINSSRV_PREFIX "") set(PLUGINSSRV_PREFIX "")
@ -428,7 +429,7 @@ elseif (WIN32)
elseif(ANDROID) elseif(ANDROID)
set(EXTERNAL_LIBRARY_FOLDER "${CMAKE_SOURCE_DIR}/external/android") set(EXTERNAL_LIBRARY_FOLDER "${CMAKE_SOURCE_DIR}/external/android")
set(Boost_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/ndk_21_boost_1.72.0/include" CACHE INTERNAL "") set(Boost_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/ndk_26b_boost_1.83.0/include" CACHE INTERNAL "")
set(FFTW3F_FOUND ON CACHE INTERNAL "") set(FFTW3F_FOUND ON CACHE INTERNAL "")
set(FFTW3F_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/fftw-3/include" CACHE INTERNAL "") set(FFTW3F_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/fftw-3/include" CACHE INTERNAL "")
@ -485,6 +486,14 @@ elseif(ANDROID)
set(SWSCALE_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/include" CACHE INTERNAL "") set(SWSCALE_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/include" CACHE INTERNAL "")
set(SWSCALE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/lib/libswscale.so" CACHE INTERNAL "") set(SWSCALE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/lib/libswscale.so" CACHE INTERNAL "")
set(GGMORSE_FOUND ON CACHE INTERNAL "")
set(GGMORSE_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ggmorse/include/" CACHE INTERNAL "")
set(GGMORSE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ggmorse/lib/static/libggmorse.a" CACHE INTERNAL "")
set(FLAC_FOUND ON CACHE INTERNAL "")
set(FLAC_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/flac/include/" CACHE INTERNAL "")
set(FLAC_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/flac/lib/libFLAC.so" CACHE INTERNAL "")
set(LIBUSB_FOUND ON CACHE INTERNAL "") set(LIBUSB_FOUND ON CACHE INTERNAL "")
set(LIBUSB_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/include/" CACHE INTERNAL "") set(LIBUSB_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/include/" CACHE INTERNAL "")
set(LIBUSB_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libusb1.0.so" CACHE INTERNAL "") set(LIBUSB_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libusb1.0.so" CACHE INTERNAL "")
@ -507,11 +516,6 @@ elseif(ANDROID)
if (ENABLE_QT6) if (ENABLE_QT6)
set(ANDROID_EXTRA_LIBS set(ANDROID_EXTRA_LIBS
${Qt6_DIR}/../../../android_arm64_v8a/lib/libQt6Charts_arm64-v8a.so
${Qt6_DIR}/../../../android_arm64_v8a/lib/libQt6Concurrent_arm64-v8a.so
${Qt6_DIR}/../../../android_arm64_v8a/lib/libQt6MultimediaWidgets_arm64-v8a.so
${Qt6_DIR}/../../../android_arm64_v8a/lib/libQt6SerialPort_arm64-v8a.so
${Qt6_DIR}/../../../android_arm64_v8a/lib/libQt6TextToSpeech_arm64-v8a.so
${EXTERNAL_LIBRARY_FOLDER}/android_openssl/latest/arm64/libssl_1_1.so ${EXTERNAL_LIBRARY_FOLDER}/android_openssl/latest/arm64/libssl_1_1.so
${EXTERNAL_LIBRARY_FOLDER}/android_openssl/latest/arm64/libcrypto_1_1.so ${EXTERNAL_LIBRARY_FOLDER}/android_openssl/latest/arm64/libcrypto_1_1.so
${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/lib/libavcodec.so ${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/ffmpeg/lib/libavcodec.so
@ -526,6 +530,7 @@ elseif(ANDROID)
${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/dsdcc/lib/libdsdcc.so ${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/dsdcc/lib/libdsdcc.so
${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libunrooted_android.so ${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libunrooted_android.so
${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libusb1.0.so ${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/libusb/lib/libusb1.0.so
${EXTERNAL_LIBRARY_FOLDER}/${ANDROID_ABI}/flac/lib/libFLAC.so
CACHE INTERNAL "" CACHE INTERNAL ""
) )
else() else()
@ -576,6 +581,7 @@ elseif(ANDROID)
${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/dsdcc/lib/libdsdcc.so ${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/dsdcc/lib/libdsdcc.so
${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/libusb/lib/libunrooted_android.so ${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/libusb/lib/libunrooted_android.so
${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/libusb/lib/libusb1.0.so ${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/libusb/lib/libusb1.0.so
${EXTERNAL_LIBRARY_FOLDER}/arm64-v8a/flac/lib/libFLAC.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavcodec.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavcodec.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavdevice.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavdevice.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavfilter.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/ffmpeg/lib/libavfilter.so
@ -588,6 +594,7 @@ elseif(ANDROID)
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/dsdcc/lib/libdsdcc.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/dsdcc/lib/libdsdcc.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/libusb/lib/libunrooted_android.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/libusb/lib/libunrooted_android.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/libusb/lib/libusb1.0.so ${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/libusb/lib/libusb1.0.so
${EXTERNAL_LIBRARY_FOLDER}/armeabi-v7a/flac/lib/libFLAC.so
CACHE INTERNAL "" CACHE INTERNAL ""
) )
endif() endif()
@ -650,8 +657,7 @@ if(ENABLE_QT6)
MultimediaWidgets MultimediaWidgets
Positioning Positioning
Charts Charts
SerialPort SerialPort)
Core5Compat)
else() else()
find_package(Qt5 5.15 find_package(Qt5 5.15
REQUIRED COMPONENTS REQUIRED COMPONENTS
@ -679,7 +685,8 @@ if (BUILD_GUI)
QuickWidgets QuickWidgets
TextToSpeech TextToSpeech
Svg Svg
SvgWidgets) SvgWidgets
StateMachine)
else() else()
find_package(Qt5 find_package(Qt5
REQUIRED COMPONENTS REQUIRED COMPONENTS

View File

@ -22,7 +22,6 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QApplication> #include <QApplication>
#include <QTextCodec>
#include <QProxyStyle> #include <QProxyStyle>
#include <QStyleFactory> #include <QStyleFactory>
#include <QFontDatabase> #include <QFontDatabase>
@ -48,10 +47,6 @@
static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger) static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger)
{ {
/*
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
*/
QCoreApplication::setOrganizationName(COMPANY); QCoreApplication::setOrganizationName(COMPANY);
QCoreApplication::setApplicationName(APPLICATION_NAME); QCoreApplication::setApplicationName(APPLICATION_NAME);
QCoreApplication::setApplicationVersion(SDRANGEL_VERSION); QCoreApplication::setApplicationVersion(SDRANGEL_VERSION);

View File

@ -19,7 +19,7 @@
#include <QDockWidget> #include <QDockWidget>
#include <QDebug> #include <QDebug>
#include <QAction> #include <QAction>
#include <QRegExp> #include <QRegularExpression>
#include <QClipboard> #include <QClipboard>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
@ -433,15 +433,15 @@ void PagerDemodGUI::filterRow(int row)
bool hidden = false; bool hidden = false;
if (m_settings.m_filterAddress != "") if (m_settings.m_filterAddress != "")
{ {
QRegExp re(m_settings.m_filterAddress); QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterAddress));
QTableWidgetItem *fromItem = ui->messages->item(row, PagerDemodSettings::MESSAGE_COL_ADDRESS); QTableWidgetItem *fromItem = ui->messages->item(row, PagerDemodSettings::MESSAGE_COL_ADDRESS);
if (!re.exactMatch(fromItem->text())) { QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch()) {
hidden = true; hidden = true;
} }
} }
ui->messages->setRowHidden(row, hidden); ui->messages->setRowHidden(row, hidden);
} }
void PagerDemodGUI::filter() void PagerDemodGUI::filter()
{ {
for (int i = 0; i < ui->messages->rowCount(); i++) { for (int i = 0; i < ui->messages->rowCount(); i++) {

View File

@ -41,11 +41,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR}) set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif() endif()
add_library(${TARGET_NAME} SHARED if(NOT Qt6_FOUND)
${antennatools_SOURCES} add_library(${TARGET_NAME} ${antennatools_SOURCES})
) else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME AntennaToolsPlugin ${antennatools_SOURCES})
endif()
target_link_libraries(${TARGET_NAME} if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core Qt::Core
${TARGET_LIB} ${TARGET_LIB}
sdrbase sdrbase

View File

@ -60,6 +60,9 @@ target_link_libraries(${TARGET_NAME} PRIVATE
${TARGET_LIB_GUI} ${TARGET_LIB_GUI}
${LIMESUITE_LIBRARY} ${LIMESUITE_LIBRARY}
) )
if(ANDROID)
target_link_libraries(${TARGET_NAME} PRIVATE ${LIBUSB_LIBRARIES} log)
endif()
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER}) install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -91,7 +91,8 @@ if(NOT SERVER_MODE)
set(TARGET_LIB ${TARGET_LIB} Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets) set(TARGET_LIB ${TARGET_LIB} Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets)
elseif(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngineCore_FOUND) elseif(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngineCore_FOUND)
set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets Qt::WebEngineCore Qt::WebEngineWidgets) set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets Qt::WebEngineCore Qt::WebEngineWidgets)
else() elseif(Qt6_FOUND)
# Not on Qt5 Android?
set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets) set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets)
endif() endif()
else() else()

View File

@ -211,6 +211,7 @@ void MapSettings::resetToDefaults()
m_displayfoF2 = false; m_displayfoF2 = false;
m_displayRain = false; m_displayRain = false;
m_displayClouds = false; m_displayClouds = false;
m_displayRailways = false;
m_displaySeaMarks = false; m_displaySeaMarks = false;
m_displayNASAGlobalImagery = false; m_displayNASAGlobalImagery = false;
m_nasaGlobalImageryIdentifier = ""; m_nasaGlobalImageryIdentifier = "";

View File

@ -26,7 +26,7 @@
#include <QNetworkDatagram> #include <QNetworkDatagram>
#include <QEventLoop> #include <QEventLoop>
#include <QTimer> #include <QTimer>
#include <QRegExp> #include <QRegularExpression>
#include "util/ax25.h" #include "util/ax25.h"
@ -205,11 +205,12 @@ void PERTesterWorker::rx()
void PERTesterWorker::tx() void PERTesterWorker::tx()
{ {
QRegExp ax25Dst("^%\\{ax25\\.dst=([A-Za-z0-9-]+)\\}"); QRegularExpression ax25Dst("^%\\{ax25\\.dst=([A-Za-z0-9-]+)\\}");
QRegExp ax25Src("^%\\{ax25\\.src=([A-Za-z0-9-]+)\\}"); QRegularExpression ax25Src("^%\\{ax25\\.src=([A-Za-z0-9-]+)\\}");
QRegExp num("^%\\{num\\}"); QRegularExpression num("^%\\{num\\}");
QRegExp data("^%\\{data=([0-9]+),([0-9]+)\\}"); QRegularExpression data("^%\\{data=([0-9]+),([0-9]+)\\}");
QRegExp hex("^(0x)?([0-9a-fA-F]?[0-9a-fA-F])"); QRegularExpression hex("^(0x)?([0-9a-fA-F]?[0-9a-fA-F])");
QRegularExpressionMatch match;
QByteArray bytes; QByteArray bytes;
int pos = 0; int pos = 0;
@ -217,34 +218,34 @@ void PERTesterWorker::tx()
{ {
if (m_settings.m_packet[pos] == '%') if (m_settings.m_packet[pos] == '%')
{ {
if (ax25Dst.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1) if ((match = ax25Dst.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
{ {
// AX.25 destination callsign & SSID // AX.25 destination callsign & SSID
QString address = ax25Dst.capturedTexts()[1]; QString address = match.captured(1);
bytes.append(AX25Packet::encodeAddress(address)); bytes.append(AX25Packet::encodeAddress(address));
pos += ax25Dst.matchedLength(); pos += match.capturedLength();
} }
else if (ax25Src.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1) else if ((match = ax25Src.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
{ {
// AX.25 source callsign & SSID // AX.25 source callsign & SSID
QString address = ax25Src.capturedTexts()[1]; QString address = match.captured(1);
bytes.append(AX25Packet::encodeAddress(address, 1)); bytes.append(AX25Packet::encodeAddress(address, 1));
pos += ax25Src.matchedLength(); pos += match.capturedLength();
} }
else if (num.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1) else if ((match = num.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
{ {
// Big endian packet number // Big endian packet number
bytes.append((m_tx >> 24) & 0xff); bytes.append((m_tx >> 24) & 0xff);
bytes.append((m_tx >> 16) & 0xff); bytes.append((m_tx >> 16) & 0xff);
bytes.append((m_tx >> 8) & 0xff); bytes.append((m_tx >> 8) & 0xff);
bytes.append(m_tx & 0xff); bytes.append(m_tx & 0xff);
pos += num.matchedLength(); pos += match.capturedLength();
} }
else if (data.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1) else if ((match = data.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
{ {
// Constrained random number of random bytes // Constrained random number of random bytes
int minBytes = data.capturedTexts()[1].toInt(); int minBytes = match.captured(1).toInt();
int maxBytes = data.capturedTexts()[2].toInt(); int maxBytes = match.captured(2).toInt();
std::random_device rd; std::random_device rd;
std::mt19937 gen(rd()); std::mt19937 gen(rd());
std::uniform_int_distribution<> distr0(minBytes, maxBytes); std::uniform_int_distribution<> distr0(minBytes, maxBytes);
@ -252,7 +253,7 @@ void PERTesterWorker::tx()
int count = distr0(gen); int count = distr0(gen);
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
bytes.append(distr1(gen)); bytes.append(distr1(gen));
pos += data.matchedLength(); pos += match.capturedLength();
} }
else else
{ {
@ -278,12 +279,12 @@ void PERTesterWorker::tx()
break; break;
} }
} }
else if (hex.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1) else if ((match = hex.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
{ {
// Hex byte // Hex byte
int value = hex.capturedTexts()[2].toInt(nullptr, 16); int value = match.captured(2).toInt(nullptr, 16);
bytes.append(value); bytes.append(value);
pos += hex.matchedLength(); pos += match.capturedLength();
} }
else if ((m_settings.m_packet[pos] == ' ') || (m_settings.m_packet[pos] == ',') || (m_settings.m_packet[pos] == ':')) else if ((m_settings.m_packet[pos] == ' ') || (m_settings.m_packet[pos] == ',') || (m_settings.m_packet[pos] == ':'))
{ {

View File

@ -82,9 +82,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE
${TARGET_LIB_GUI} ${TARGET_LIB_GUI}
${SGP4_LIBRARIES} ${SGP4_LIBRARIES}
) )
if (Qt6_FOUND)
target_link_libraries(${TARGET_NAME} PRIVATE Qt::Core5Compat)
endif()
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER}) install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -106,7 +106,7 @@ add_subdirectory(audioinput)
add_subdirectory(kiwisdr) add_subdirectory(kiwisdr)
add_subdirectory(remotetcpinput) add_subdirectory(remotetcpinput)
if(ENABLE_AARONIARTSA) if(ENABLE_AARONIARTSA AND NOT ANDROID)
add_subdirectory(aaroniartsainput) add_subdirectory(aaroniartsainput)
else() else()
message(STATUS "Not building aaroniartsainput (ENABLE_AARONIARTSA=${ENABLE_AARONIARTSA})") message(STATUS "Not building aaroniartsainput (ENABLE_AARONIARTSA=${ENABLE_AARONIARTSA})")

View File

@ -60,7 +60,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE
swagger swagger
) )
if(NOT ENABLE_QT6 AND ANDROID) if(NOT ENABLE_QT6 AND ANDROID)
target_link_libraries(${TARGET_NAME} Qt::AndroidExtras) target_link_libraries(${TARGET_NAME} PRIVATE Qt::AndroidExtras)
endif() endif()
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER}) install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -29,6 +29,7 @@
#include "SWGDeviceReport.h" #include "SWGDeviceReport.h"
#include "SWGAndroidSDRDriverInputReport.h" #include "SWGAndroidSDRDriverInputReport.h"
#include "util/android.h"
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "device/deviceapi.h" #include "device/deviceapi.h"

View File

@ -26,6 +26,7 @@
#include <QRecursiveMutex> #include <QRecursiveMutex>
#include <QDateTime> #include <QDateTime>
#include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
#include "util/message.h" #include "util/message.h"
#include "androidsdrdriverinputsettings.h" #include "androidsdrdriverinputsettings.h"

View File

@ -19,6 +19,9 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <QDebug> #include <QDebug>
#ifdef ANDROID
#include <QFile>
#endif
#include "fileinputworker.h" #include "fileinputworker.h"
#include "dsp/samplesinkfifo.h" #include "dsp/samplesinkfifo.h"

View File

@ -68,6 +68,9 @@ target_link_libraries(${TARGET_NAME} PRIVATE
${LIMESUITE_LIBRARY} ${LIMESUITE_LIBRARY}
limesdrdevice limesdrdevice
) )
if(ANDROID)
target_link_libraries(${TARGET_NAME} PRIVATE ${LIBUSB_LIBRARIES} log)
endif()
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER}) install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -128,7 +128,7 @@ bool RTLSDRInput::openDevice()
qCritical("RTLSDRInput::openDevice: could not open USB device %s", qPrintable(m_deviceAPI->getSamplingDeviceSerial())); qCritical("RTLSDRInput::openDevice: could not open USB device %s", qPrintable(m_deviceAPI->getSamplingDeviceSerial()));
return false; return false;
} }
if ((res = rtlsdr_open_fd(&m_dev, fd)) < 0) if ((rtlsdr_open_fd(&m_dev, fd)) < 0)
{ {
qCritical("RTLSDRInput::openDevice: could not open RTLSDR: %s", strerror(errno)); qCritical("RTLSDRInput::openDevice: could not open RTLSDR: %s", strerror(errno));
return false; return false;

View File

@ -702,7 +702,6 @@ if (LIBSIGMF_FOUND)
endif() endif()
if (Qt6_FOUND) if (Qt6_FOUND)
target_link_libraries(sdrbase target_link_libraries(sdrbase
Qt::Core5Compat
Qt::CorePrivate Qt::CorePrivate
) )
endif() endif()

View File

@ -22,7 +22,7 @@
#include <QDebug> #include <QDebug>
#include <QDateTime> #include <QDateTime>
#include <QRegExp> #include <QRegularExpression>
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "util/message.h" #include "util/message.h"
@ -472,16 +472,19 @@ void WavFileRecord::writeHeader(QFile& sampleFile, Header& header)
bool WavFileRecord::getCenterFrequency(QString fileName, quint64& centerFrequency) bool WavFileRecord::getCenterFrequency(QString fileName, quint64& centerFrequency)
{ {
// Attempt to extract center frequency from filename // Attempt to extract center frequency from filename
QRegExp freqkRE("(([0-9]+)kHz)"); QRegularExpression freqkRE("(([0-9]+)kHz)");
QRegExp freqRE("(([0-9]+)Hz)"); QRegularExpression freqRE("(([0-9]+)Hz)");
if (freqkRE.indexIn(fileName)) QRegularExpressionMatch freqkREMatch = freqkRE.match(fileName);
QRegularExpressionMatch freqREMatch = freqRE.match(fileName);
if (freqkREMatch.hasMatch())
{ {
centerFrequency = freqkRE.capturedTexts()[2].toLongLong() * 1000LL; centerFrequency = freqkREMatch.capturedTexts()[2].toLongLong() * 1000LL;
return true; return true;
} }
else if (freqRE.indexIn(fileName)) else if (freqREMatch.hasMatch())
{ {
centerFrequency = freqRE.capturedTexts()[2].toLongLong(); centerFrequency = freqREMatch.capturedTexts()[2].toLongLong();
return true; return true;
} }
return false; return false;
@ -490,17 +493,18 @@ bool WavFileRecord::getCenterFrequency(QString fileName, quint64& centerFrequenc
bool WavFileRecord::getStartTime(QString fileName, QDateTime& startTime) bool WavFileRecord::getStartTime(QString fileName, QDateTime& startTime)
{ {
// Attempt to extract start time from filename // Attempt to extract start time from filename
QRegExp dateTimeRE("([12][0-9][0-9][0-9]).?([01][0-9]).?([0-3][0-9]).?([0-2][0-9]).?([0-5][0-9]).?([0-5][0-9])"); QRegularExpression dateTimeRE("([12][0-9][0-9][0-9]).?([01][0-9]).?([0-3][0-9]).?([0-2][0-9]).?([0-5][0-9]).?([0-5][0-9])");
if (dateTimeRE.indexIn(fileName) != -1) QRegularExpressionMatch match = dateTimeRE.match(fileName);
if (match.hasMatch())
{ {
startTime = QDateTime(QDate( startTime = QDateTime(QDate(
dateTimeRE.capturedTexts()[1].toInt(), match.capturedTexts()[1].toInt(),
dateTimeRE.capturedTexts()[2].toInt(), match.capturedTexts()[2].toInt(),
dateTimeRE.capturedTexts()[3].toInt()), match.capturedTexts()[3].toInt()),
QTime( QTime(
dateTimeRE.capturedTexts()[4].toInt(), match.capturedTexts()[4].toInt(),
dateTimeRE.capturedTexts()[5].toInt(), match.capturedTexts()[5].toInt(),
dateTimeRE.capturedTexts()[6].toInt())); match.capturedTexts()[6].toInt()));
return true; return true;
} }
return false; return false;

View File

@ -81,7 +81,10 @@ void PluginManager::loadPluginsPart(const QString& pluginsSubDir)
// on make install [PREFIX]/bin and [PREFIX]/lib/sdrangel // on make install [PREFIX]/bin and [PREFIX]/lib/sdrangel
#if defined(ANDROID) #if defined(ANDROID)
PluginsPath = QStringList({applicationDirPath}); PluginsPath = QStringList({applicationDirPath});
filter = QStringList({"libsdrangel_" + pluginsSubDir + "_*.so"}); // Qt5 add_library gives libsdrangel_plugins_antennatools.so
// Qt6 qt_add_plugin gives libplugins__sdrangel_plugins_antennatools.so
// Assuming PLUGINS_PREFIX=sdrangel_plugins_
filter = QStringList({"lib*sdrangel_" + pluginsSubDir + "_*.so"});
#else #else
filter = QStringList({"*"}); filter = QStringList({"*"});
PluginsPath << applicationDirPath + "/../" + LIB + "/sdrangel/" + pluginsSubDir; PluginsPath << applicationDirPath + "/../" + LIB + "/sdrangel/" + pluginsSubDir;

View File

@ -95,6 +95,38 @@ void Android::moveTaskToBack()
} }
} }
void Android::acquireWakeLock()
{
QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if (activity.isValid()) {
activity.callMethod<void>("acquireWakeLock");
}
}
void Android::releaseWakeLock()
{
QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if (activity.isValid()) {
activity.callMethod<void>("releaseWakeLock");
}
}
void Android::acquireScreenLock()
{
QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if (activity.isValid()) {
activity.callMethod<void>("acquireScreenLock");
}
}
void Android::releaseScreenLock()
{
QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if (activity.isValid()) {
activity.callMethod<void>("releaseScreenLock");
}
}
#else // QT_VERSION #else // QT_VERSION
#include <QtAndroid> #include <QtAndroid>

View File

@ -1143,7 +1143,7 @@ void LoadConfigurationFSM::restoreGeometry()
m_mainWindow->m_workspaces[i]->adjustSubWindowsAfterRestore(); m_mainWindow->m_workspaces[i]->adjustSubWindowsAfterRestore();
#ifdef ANDROID #ifdef ANDROID
// On Android, workspaces seem to be restored to 0,20, rather than 0,0 // On Android, workspaces seem to be restored to 0,20, rather than 0,0
m_mainWindow->m_workspaces[i]->move(m_workspaces[i]->pos().x(), 0); m_mainWindow->m_workspaces[i]->move(m_mainWindow->m_workspaces[i]->pos().x(), 0);
// Need to call updateGeometry, otherwise sometimes the layout is corrupted // Need to call updateGeometry, otherwise sometimes the layout is corrupted
m_mainWindow->m_workspaces[i]->updateGeometry(); m_mainWindow->m_workspaces[i]->updateGeometry();
#endif #endif