autobug: failure to start should be treated like any other BLE exception

pull/72/head
geeksville 2020-06-30 12:35:58 -07:00
rodzic fed418dae2
commit 4172b221f0
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -121,6 +121,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
// Our own custom BLE status codes
private val STATUS_RELIABLE_WRITE_FAILED = 4403
private val STATUS_TIMEOUT = 4404
private val STATUS_NOSTART = 4405
private val gattCallback = object : BluetoothGattCallback() {
@ -310,7 +311,14 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
isSettingMtu =
false // Most work is not doing MTU stuff, the work that is will re set this flag
logAssert(newWork.startWork())
val started = newWork.startWork()
if (!started) {
errormsg("Failed to start work, returned error status")
completeWork(
STATUS_NOSTART,
Unit
) // abandon the current attempt and try for another
}
}
}