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 /examples/bluetooth/btchat/chat.cpp | |
parent | ca5490859338f28e30104668a353275d23df1ec6 (diff) | |
parent | 125cdccc346903d6e70ed26289cdaed85e26ec3f (diff) |
Merge remote-tracking branch 'gerrit/dev' into btle
Change-Id: Ia1cbaac9774ce2bc1b6972c02bad34fa593d40ff
Diffstat (limited to 'examples/bluetooth/btchat/chat.cpp')
-rw-r--r-- | examples/bluetooth/btchat/chat.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/bluetooth/btchat/chat.cpp b/examples/bluetooth/btchat/chat.cpp index 51a2d4ed..929a42e4 100644 --- a/examples/bluetooth/btchat/chat.cpp +++ b/examples/bluetooth/btchat/chat.cpp @@ -49,11 +49,18 @@ #include <qbluetoothdeviceinfo.h> #include <qbluetoothlocaldevice.h> +#ifdef Q_OS_ANDROID +#include <QtAndroidExtras/QtAndroid> +#endif + #include <QTimer> #include <QDebug> static const QLatin1String serviceUuid("e8e10f95-1a70-4b27-9ccf-02010264e9c8"); +#ifdef Q_OS_ANDROID +static const QLatin1String reverseUuid("c8e96402-0102-cf9c-274b-701a950fe1e8"); +#endif Chat::Chat(QWidget *parent) : QDialog(parent), currentAdapterIndex(0), ui(new Ui_Chat) @@ -170,7 +177,14 @@ void Chat::connectClicked() localAdapters.at(currentAdapterIndex).address(); RemoteSelector remoteSelector(adapter); +#ifdef Q_OS_ANDROID + if (QtAndroid::androidSdkVersion() >= 23) + remoteSelector.startDiscovery(QBluetoothUuid(reverseUuid)); + else + remoteSelector.startDiscovery(QBluetoothUuid(serviceUuid)); +#else remoteSelector.startDiscovery(QBluetoothUuid(serviceUuid)); +#endif if (remoteSelector.exec() == QDialog::Accepted) { QBluetoothServiceInfo service = remoteSelector.service(); |