Skip to content

Commit 01373b4

Browse files
committed
BluetoothGattCallback - notify lock on error status
1 parent e175fdd commit 01373b4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/org/microbit/android/partialflashing/PartialFlashingBaseService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,11 @@ public void onConnectionStateChange(BluetoothGatt gatt, int status,
368368
logi( "onConnectionStateChange " + newState + " status " + status);
369369
if ( status != 0) {
370370
logi("ERROR - status");
371-
mConnectionState = STATE_ERROR;;
371+
mConnectionState = STATE_ERROR;
372+
// Clear locks
373+
synchronized (lock) {
374+
lock.notifyAll();
375+
}
372376
return;
373377
}
374378

@@ -409,7 +413,11 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
409413
logi("onServicesDiscovered status " + status);
410414
if ( status != 0) {
411415
logi("ERROR - status");
412-
mConnectionState = STATE_ERROR;;
416+
mConnectionState = STATE_ERROR;
417+
// Clear locks
418+
synchronized (lock) {
419+
lock.notifyAll();
420+
}
413421
return;
414422
}
415423

0 commit comments

Comments
 (0)