mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: Implement reconnection logic and stabilize BLE connection flow (#4870)
This commit is contained in:
parent
6e50db0b91
commit
3bd8669cbe
2 changed files with 49 additions and 30 deletions
|
|
@ -145,8 +145,6 @@ class BleRadioInterface(
|
|||
|
||||
private fun connect() {
|
||||
connectionScope.launch {
|
||||
val device = findDevice()
|
||||
|
||||
bleConnection.connectionState
|
||||
.onEach { state ->
|
||||
if (state is BleConnectionState.Disconnected && isFullyConnected) {
|
||||
|
|
@ -171,6 +169,8 @@ class BleRadioInterface(
|
|||
connectionStartTime = nowMillis
|
||||
Logger.i { "[$address] BLE connection attempt started" }
|
||||
|
||||
val device = findDevice()
|
||||
|
||||
var state = bleConnection.connectAndAwait(device, CONNECTION_TIMEOUT_MS)
|
||||
|
||||
if (state !is BleConnectionState.Connected) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue