From a39f1357cc79cab9a0d7ea28986486b47b203422 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 3 Jul 2019 20:42:20 +0300 Subject: QLowEnergyController: Introduce AuthorizationError intended to distinguish an arbitrary disconnection from disconnection due to insufficient authorization/encryption Change-Id: Ifcf73d0444fe6fd3a8d5d90155f3db572d6e23d1 Reviewed-by: Evgeniy Gagarin Reviewed-by: Alex Blasche --- src/bluetooth/qlowenergycontroller.cpp | 3 +++ src/bluetooth/qlowenergycontroller.h | 3 ++- src/bluetooth/qlowenergycontrollerbase.cpp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 3cf0d920..d6af6999 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -159,6 +159,9 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT) This value was introduced by Qt 5.7. \value RemoteHostClosedError The remote device closed the connection. This value was introduced by Qt 5.10. + \value AuthorizationError The local Bluetooth device closed the connection due to + insufficient authorization. + This value was introduced by Qt 5.14. */ /*! diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index 5498d4a5..37e7b82d 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -66,7 +66,8 @@ public: InvalidBluetoothAdapterError, ConnectionError, AdvertisingError, - RemoteHostClosedError + RemoteHostClosedError, + AuthorizationError }; Q_ENUM(Error) diff --git a/src/bluetooth/qlowenergycontrollerbase.cpp b/src/bluetooth/qlowenergycontrollerbase.cpp index de72808e..059bd41b 100644 --- a/src/bluetooth/qlowenergycontrollerbase.cpp +++ b/src/bluetooth/qlowenergycontrollerbase.cpp @@ -106,6 +106,9 @@ void QLowEnergyControllerPrivate::setError( case QLowEnergyController::RemoteHostClosedError: errorString = QLowEnergyController::tr("Remote device closed the connection"); break; + case QLowEnergyController::AuthorizationError: + errorString = QLowEnergyController::tr("Failed to authorize on the remote device"); + break; case QLowEnergyController::NoError: return; default: -- cgit v1.2.3