mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Android BT: pull the pairing data from a device
As Qt is not able to pull the pairing data from a device, a lengthy discovery process is needed to see what devices are paired. On https://forum.qt.io/topic/46075/solved-bluetooth-list-paired-devices user s.frings74 does, however, present a solution to this using JNI. Currently, this code is taken "as is". Currently, only for Android (so not mobile-on-desktop, or even desktop). And only generating logging data in the logcat. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
ec34ebfb04
commit
ed392694db
2 changed files with 86 additions and 0 deletions
|
@ -12,6 +12,9 @@
|
|||
#include <QBluetoothDeviceDiscoveryAgent>
|
||||
#include <QBluetoothUuid>
|
||||
#endif
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include <QAndroidJniObject>
|
||||
#endif
|
||||
|
||||
#include "core/gpslocation.h"
|
||||
#include "qt-models/divelistmodel.h"
|
||||
|
@ -125,6 +128,7 @@ public:
|
|||
#if defined(BT_SUPPORT)
|
||||
void btDeviceDiscovered(const QBluetoothDeviceInfo &device);
|
||||
#endif
|
||||
QStringList getBluetoothDevices();
|
||||
|
||||
public slots:
|
||||
void applicationStateChanged(Qt::ApplicationState state);
|
||||
|
@ -207,6 +211,11 @@ private:
|
|||
bool checkDepth(DiveObjectHelper *myDive, struct dive *d, QString depth);
|
||||
bool currentGitLocalOnly;
|
||||
bool m_showPin;
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
bool checkException(const char* method, const QAndroidJniObject* obj);
|
||||
#endif
|
||||
|
||||
#if defined(BT_SUPPORT)
|
||||
QBluetoothLocalDevice localBtDevice;
|
||||
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue