try to fix disconnects
This commit is contained in:
parent
3f3496426b
commit
17d4f3e8ce
2 changed files with 3 additions and 1 deletions
|
@ -40,7 +40,7 @@ class BleCommCallbacks(
|
|||
if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) {
|
||||
connected.countDown()
|
||||
}
|
||||
if (newState == BluetoothProfile.STATE_DISCONNECTED && status != BluetoothGatt.GATT_SUCCESS) {
|
||||
if (newState == BluetoothProfile.STATE_DISCONNECTED) {
|
||||
// If status == SUCCESS, it means that we initiated the disconnect.
|
||||
disconnectHandler.onConnectionLost(status)
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ class Connection(
|
|||
@Volatile
|
||||
var msgIO: MessageIO? = null
|
||||
|
||||
@Synchronized
|
||||
fun connect(connectionWaitCond: ConnectionWaitCondition) {
|
||||
aapsLogger.debug("Connecting connectionWaitCond=$connectionWaitCond")
|
||||
podState.connectionAttempts++
|
||||
|
@ -117,6 +118,7 @@ class Connection(
|
|||
dataBleIO.readyToRead()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun disconnect(closeGatt: Boolean) {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Disconnecting closeGatt=$closeGatt")
|
||||
podState.bluetoothConnectionState = OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED
|
||||
|
|
Loading…
Reference in a new issue