summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice_android.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-09-25 10:57:07 +0200
committerAlex Blasche <alexander.blasche@qt.io>2018-09-26 06:21:28 +0000
commitf8c0572ddcd0cf152cfcf9f1d5478e520a6a457e (patch)
treebeba4ce3fcf1aeece7b8be0fca2bda9637bcaa04 /src/bluetooth/qbluetoothlocaldevice_android.cpp
parent7b40de8fbbaed22ca6217b5acc8dad1db6ae0600 (diff)
Properly handle pin code pairing on Android
Most likely this paring variant was forgotten when Android support for QBluetoothLocalDevice was implemented. This variant is rather uncommon and Android's default pairing handler are likely to automatically handle such requests too. Fixes: QTBUG-70295 Change-Id: I618242da415574245e5a213a6e34f190c685c8e9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_android.cpp')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_android.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp
index f36e184c..0144a5ef 100644
--- a/src/bluetooth/qbluetoothlocaldevice_android.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp
@@ -73,6 +73,8 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(
this, SLOT(processConnectDeviceChanges(QBluetoothAddress, bool)));
connect(receiver, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress, QString)),
this, SLOT(processDisplayConfirmation(QBluetoothAddress, QString)));
+ connect(receiver, &LocalDeviceBroadcastReceiver::pairingDisplayPinCode,
+ this, &QBluetoothLocalDevicePrivate::processDisplayPinCode);
}
QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
@@ -215,6 +217,15 @@ void QBluetoothLocalDevicePrivate::processDisplayConfirmation(const QBluetoothAd
return;
emit q_ptr->pairingDisplayConfirmation(address, pin);
+}
+
+void QBluetoothLocalDevicePrivate::processDisplayPinCode(const QBluetoothAddress &address, const QString &pin)
+{
+ // only send pairing notification for pairing requests issued by
+ // this QBluetoothLocalDevice instance
+ if (pendingPairing(address) == -1)
+ return;
+
emit q_ptr->pairingDisplayPinCode(address, pin);
}