mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-08 14:45:53 -04:00
ignore BLE errors while closing
This commit is contained in:
@@ -5,4 +5,7 @@ import java.util.*
|
||||
|
||||
open class BLEException(msg: String) : IOException(msg)
|
||||
|
||||
open class BLECharacteristicNotFoundException(uuid: UUID) : BLEException("Can't get characteristic $uuid")
|
||||
open class BLECharacteristicNotFoundException(uuid: UUID) : BLEException("Can't get characteristic $uuid")
|
||||
|
||||
/// Our interface is being shut down
|
||||
open class BLEConnectionClosing() : BLEException("Connection closing ")
|
||||
@@ -469,7 +469,12 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
||||
safe =
|
||||
null // We do this first, because if we throw we still want to mark that we no longer have a valid connection
|
||||
|
||||
s?.close()
|
||||
try {
|
||||
s?.close()
|
||||
}
|
||||
catch(_: BLEConnectionClosing) {
|
||||
warn("Ignoring BLE errors while closing")
|
||||
}
|
||||
} else {
|
||||
debug("Radio was not connected, skipping disable")
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
|
||||
|
||||
closeGatt()
|
||||
|
||||
failAllWork(BLEException("Connection closing"))
|
||||
failAllWork(BLEConnectionClosing())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user