Skip to content

Commit

Permalink
fix: handle GATT_CONNECTION_TIMEOUT status in Bluetooth connection …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
tavdog authored Dec 18, 2024
1 parent 8226207 commit 1f0092b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1f0092b

Please sign in to comment.