fix: handle GATT_CONNECTION_TIMEOUT status in Bluetooth connection state change (#1463)

* Trap code 147 on BT disconnect

If we trap code 147 on BT disconnect and then call lostConnection(), the app will attempt reconnect every 30 seconds and autoreconnect works even after prolonged disconnect.
This commit is contained in:
Tavis 2024-12-18 01:14:16 -10:00 committed by GitHub
parent 8226207dbf
commit 1f0092bbe1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,6 +209,9 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
closeGatt() // Close the old non-auto connection
lowLevelConnect(true)
}
} else if (status == 147) {
info("got 147, calling lostConnection()")
lostConnection("code 147")
}
if (status == 257) { // mystery error code when phone is hung