autobug - don't fail if the gatt goes away while we are connecting

pull/71/head
geeksville 2020-06-28 16:09:37 -07:00
rodzic 3246bd6505
commit 68cc494021
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -285,12 +285,13 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
*/
private fun forceServiceRefresh() {
exceptionReporter {
// BluetoothGatt gatt
val gatt = safe!!.gatt!!
// If the gatt has been destroyed, skip the refresh attempt
safe?.gatt?.let { gatt ->
val refresh: Method = gatt.javaClass.getMethod("refresh")
refresh.invoke(gatt)
}
}
}
/// We only force service refresh the _first_ time we connect to the device. Thereafter it is assumed the firmware didn't change
private var hasForcedRefresh = false