dash ble: disconnect on errors

This commit is contained in:
Andrei Vereha 2021-03-07 22:41:51 +01:00
parent 64aa05f7f9
commit db51b762ca

View file

@ -214,13 +214,14 @@ class OmnipodDashBleManagerImpl @Inject constructor(
emitter.onComplete() emitter.onComplete()
} catch (ex: Exception) { } catch (ex: Exception) {
disconnect()
emitter.tryOnError(ex) emitter.tryOnError(ex)
} }
} }
override fun disconnect() { override fun disconnect() {
val localGatt = gatt val localGatt = gatt
localGatt?.close() localGatt?.close() // TODO: use disconnect?
gatt = null gatt = null
msgIO = null msgIO = null
sessionKeys = null sessionKeys = null