diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-06-13 15:39:15 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-06-14 08:09:32 +0000 |
commit | abeea470e348cb4e87f1e24492e263f7ac7d8cce (patch) | |
tree | fc92ae0ef21f976da8c30ec1d5b56c4340cba5f4 /tests | |
parent | 9834dc9082f7442549bb217262c476a4dd20e1ec (diff) |
Adjust bttestui to Android's SDP discovery problems
This affects only Android version 6.0.1 or later. At this stage
there is no available fix yet.
Task-number: QTBUG-61392
Change-Id: Ib63a1974fd0a0533624608df0ebd4c4202a80658
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bttestui/btlocaldevice.cpp | 16 | ||||
-rw-r--r-- | tests/bttestui/bttestui.pro | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index 5b84794c..4410a66d 100644 --- a/tests/bttestui/btlocaldevice.cpp +++ b/tests/bttestui/btlocaldevice.cpp @@ -29,12 +29,18 @@ #include "btlocaldevice.h" #include <QDebug> #include <QTimer> +#ifdef Q_OS_ANDROID +#include <QtAndroidExtras/QtAndroid> +#endif #include <QtBluetooth/QBluetoothServiceInfo> #define BTCHAT_DEVICE_ADDR "00:15:83:38:17:C3" //same uuid as examples/bluetooth/btchat +//the reverse UUID is only used on Android to counter +//https://issuetracker.google.com/issues/37076498 (tracked via QTBUG-61392) #define TEST_SERVICE_UUID "e8e10f95-1a70-4b27-9ccf-02010264e9c8" +#define TEST_REVERSE_SERVICE_UUID "c8e96402-0102-cf9c-274b-701a950fe1e8" #define SOCKET_PROTOCOL QBluetoothServiceInfo::RfcommProtocol //#define SOCKET_PROTOCOL QBluetoothServiceInfo::L2capProtocol @@ -328,7 +334,15 @@ void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info) qDebug() << "$$ Found new service" << info.device().address().toString() << info.serviceUuid() << info.serviceName() << info.serviceDescription() << classIds; - if (info.serviceUuid() == QBluetoothUuid(QString(TEST_SERVICE_UUID)) + bool matchingService = + (info.serviceUuid() == QBluetoothUuid(QString(TEST_SERVICE_UUID))); +#ifdef Q_OS_ANDROID + if (QtAndroid::androidSdkVersion() >= 23) //bug introduced by Android 6.0.1 + matchingService = matchingService + || (info.serviceUuid() == QBluetoothUuid(QString(TEST_REVERSE_SERVICE_UUID))); +#endif + + if (matchingService || info.serviceClassUuids().contains(QBluetoothUuid(QString(TEST_SERVICE_UUID)))) { //This is here to detect the test server for SPP testing later on diff --git a/tests/bttestui/bttestui.pro b/tests/bttestui/bttestui.pro index 06248691..ce582e66 100644 --- a/tests/bttestui/bttestui.pro +++ b/tests/bttestui/bttestui.pro @@ -6,6 +6,8 @@ SOURCES += main.cpp \ QT += quick bluetooth +android: QT += androidextras + OTHER_FILES += main.qml \ Button.qml |