summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-23 09:56:28 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-23 10:07:26 +0000
commit31c2c2403028854dbc20083581234a6840f05a7d (patch)
tree1a887a636090f0f6c7511a0f4da0f01bab712402
parent2fc35937033fcfb533cf230a23292a0667ef65da (diff)
downloadqtconnectivity-31c2c2403028854dbc20083581234a6840f05a7d.tar.gz
Android: Invalidate services after a disconnect from the peripheral side
So far, invalidation only took place when the local/central side disconnected the connection. Task-number: QTBUG-50125 Change-Id: Ic01725d1b83e49ad7df6971d980b480f839d550b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index fd4ea753..cb08b6f9 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -326,6 +326,14 @@ void QLowEnergyControllerPrivate::connectionUpdated(
if (newState == QLowEnergyController::UnconnectedState
&& !(oldState == QLowEnergyController::UnconnectedState
|| oldState == QLowEnergyController::ConnectingState)) {
+
+ // Invalidate the services if the disconnect came from the remote end.
+ // Qtherwise we disconnected via QLowEnergyController::disconnectDevice() which
+ // triggered invalidation already
+ if (!serviceList.isEmpty()) {
+ Q_ASSERT(oldState != QLowEnergyController::ClosingState);
+ invalidateServices();
+ }
emit q->disconnected();
} else if (newState == QLowEnergyController::ConnectedState
&& oldState != QLowEnergyController::ConnectedState ) {