add back the connection retry

This commit is contained in:
Andrei Vereha 2021-06-11 18:42:52 +02:00
parent 1910ac7b60
commit 96e06cb33a
2 changed files with 5 additions and 2 deletions

View file

@ -185,7 +185,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
if (!podStateManager.isActivationCompleted) {
return PumpEnactResult().success(true).enacted(false)
return PumpEnactResult(injector).success(true).enacted(false)
}
val basalProgram = mapProfileToBasalProgram(profile)
return executeProgrammingCommand(

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.*
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.rx.retryWithBackoff
import io.reactivex.Observable
import io.reactivex.functions.Action
import io.reactivex.functions.Consumer
@ -77,7 +78,9 @@ class OmnipodDashManagerImpl @Inject constructor(
private val observeConnectToPod: Observable<PodEvent>
get() = Observable.defer {
bleManager.connect()
} // TODO add retry
.doOnError { throwable -> logger.warn(LTag.PUMPBTCOMM,"observeConnectToPod error=$throwable")}
.retryWithBackoff(retries = 2, delay = 6, timeUnit = TimeUnit.SECONDS, delayFactor = 1.2)
}
private val observePairNewPod: Observable<PodEvent>
get() = Observable.defer {