diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt index a01a3b985b..f675065776 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt @@ -125,7 +125,7 @@ class OmnipodDashBleManagerImpl @Inject constructor( for (i in 1..MAX_NUMBER_OF_CONNECTION_ATTEMPTS) { try { // wait i * CONNECTION_TIMEOUT - conn.connect(i) + conn.connect(4) break } catch (e: Exception) { aapsLogger.warn(LTag.PUMPBTCOMM, "connect error=$e") @@ -240,7 +240,7 @@ class OmnipodDashBleManagerImpl @Inject constructor( } companion object { - const val MAX_NUMBER_OF_CONNECTION_ATTEMPTS = 3 + const val MAX_NUMBER_OF_CONNECTION_ATTEMPTS = 2 const val CONTROLLER_ID = 4242 // TODO read from preferences or somewhere else. } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/ConnectionStateChangeHandler.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/ConnectionStateChangeHandler.kt new file mode 100644 index 0000000000..8396850d70 --- /dev/null +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/ConnectionStateChangeHandler.kt @@ -0,0 +1,6 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session + +interface ConnectionStateChangeHandler { + + fun onConnectionStateChange(status: Int, newState: Int) +}