Mobile: wrap up fixes for BT download on Android

Major functional change in this commit is the addition of found static BT devices
to the internal administration (on Android), in a way that is equivalent to
mobile-on-desktop. So, in both cases, the list of devices in the app are
as in the list of devices on the host OS (Linux or Android). To minimize code
duplication, the btDeviceDiscovered slot is split in two parts, the part to
act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and
the part only needed for Android.

Remaining to be fixed: the correct handling of the QML UI selection of
vendor/product. The first default dive computer is correctly detected,
all paired devices from the virtual vendow can be selected, but clicking
through vendors results in non logical selections. It is obvious why
this is, but a fix is not straigforward at this point.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Jan Mulder 2017-06-12 10:38:24 +02:00 committed by Dirk Hohndel
parent 5142d7409f
commit 23df593817
4 changed files with 62 additions and 39 deletions

View file

@ -11,12 +11,7 @@
#include <QBluetoothUuid>
#include "core/libdivecomputer.h"
struct btVendorProduct {
QBluetoothDeviceInfo btdi;
dc_descriptor_t *dcDescriptor;
int vendorIdx;
int productIdx;
};
static dc_descriptor_t *getDeviceType(QString btName);
@ -39,12 +34,21 @@ public:
QBluetoothAddress address;
QString name;
};
struct btVendorProduct {
btPairedDevice btpdi;
dc_descriptor_t *dcDescriptor;
int vendorIdx;
int productIdx;
};
void btDeviceDiscovered(const QBluetoothDeviceInfo &device);
void btDeviceDiscoveredMain(const btPairedDevice &device);
#if defined(Q_OS_ANDROID)
void getBluetoothDevices();
#endif
QList<struct btVendorProduct> getBtDcs();
QList<struct btVendorProduct> getBtAllDevices();
QList<btVendorProduct> getBtDcs();
QList<btVendorProduct> getBtAllDevices();
#endif
private:
static BTDiscovery *m_instance;