summaryrefslogtreecommitdiffstats
path: root/src/android
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-07-14 07:58:25 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-07-18 10:41:20 +0000
commitbabf0631eff0e9bfa17d7925192c7923350f455a (patch)
tree41974f458b6591251bea6cfd7ab3e8bf6919726f /src/android
parentf9f112edf1ececb883438ee31c9fc8d960f40ab5 (diff)
Android: Avoid hanging in desc or char read during service discovery
If the last entry of a service is a descriptor or characteristic and the read attempt fails early (the read could not even be initiated) ensure that the discovery state machine properly exists. So far the exit was only ever triggered by a successful read or if the async callback for the read returned with an error or timed out. Change-Id: I495982a82819aab985bc91a7e63c530b52355d9d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
index b82a647c..0f419ad7 100644
--- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
+++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
@@ -1258,15 +1258,16 @@ public class QtBluetoothLE {
break;
case CharacteristicValue:
// for more details see scheduleServiceDetailDiscovery(int)
- // ignore and continue unless last entry
- GattEntry serviceEntry = entries.get(entry.associatedServiceHandle);
- if (serviceEntry.endHandle == handle)
- finishCurrentServiceDiscovery(entry.associatedServiceHandle);
break;
case Service:
Log.w(TAG, "Scheduling of Service Gatt entry for service discovery should never happen.");
break;
}
+
+ // last entry of current discovery run?
+ GattEntry serviceEntry = entries.get(entry.associatedServiceHandle);
+ if (serviceEntry.endHandle == handle)
+ finishCurrentServiceDiscovery(entry.associatedServiceHandle);
} else {
int errorCode = 0;