[REG] LE/Android: report ServiceDiscovered for an empty services as well

a regression has been introduced by the service discoverer refactoring,
causing an empty service to stuck in DiscoveringServices state for ever

Change-Id: I1d339279e77f5409231d5fbd3677f9e2eb98a0a8
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
Konstantin Ritt 2017-01-10 18:04:51 +04:00 committed by Alex Blasche
parent 8690dd6d59
commit dcd89c6268
1 changed files with 6 additions and 0 deletions

View File

@ -844,6 +844,12 @@ public class QtBluetoothLE {
GattEntry serviceEntry = entries.get(serviceHandle);
final int endHandle = serviceEntry.endHandle;
if (serviceHandle == endHandle) {
Log.w(TAG, "scheduleServiceDetailDiscovery: service is empty; nothing to discover");
finishCurrentServiceDiscovery(serviceHandle);
return;
}
synchronized (readWriteQueue) {
// entire block inside mutex to ensure all service discovery jobs go in one after the other
// ensures that serviceDiscovered() signal is sent when required