diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:01 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:13 +0200 |
commit | fc2a206322f6190226ebc1f04062f2c9170f0bac (patch) | |
tree | 7df8ca41816c24ccfa6e0c6add4612689a933bdd /tests/bttestui/btlocaldevice.cpp | |
parent | ca5490859338f28e30104668a353275d23df1ec6 (diff) | |
parent | 125cdccc346903d6e70ed26289cdaed85e26ec3f (diff) |
Merge remote-tracking branch 'gerrit/dev' into btle
Change-Id: Ia1cbaac9774ce2bc1b6972c02bad34fa593d40ff
Diffstat (limited to 'tests/bttestui/btlocaldevice.cpp')
-rw-r--r-- | tests/bttestui/btlocaldevice.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index 5b84794c..77696853 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 @@ -270,7 +276,7 @@ void BtLocalDevice::startDiscovery() { if (deviceAgent) { qDebug() << "###### Starting device discovery process"; - deviceAgent->start(); + deviceAgent->start(QBluetoothDeviceDiscoveryAgent::ClassicMethod); } } @@ -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 |