remove the active command if we get an error sending it
This commit is contained in:
parent
3a2fa6d04f
commit
20560f2a4e
3 changed files with 7 additions and 0 deletions
|
@ -466,6 +466,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
},
|
||||
onError = { throwable ->
|
||||
aapsLogger.error(LTag.PUMP, "Error executing command", throwable)
|
||||
podStateManager.resetActiveCommand()
|
||||
source.onSuccess(
|
||||
PumpEnactResult(injector).success(false).enacted(false).comment(throwable.message)
|
||||
)
|
||||
|
|
|
@ -68,6 +68,7 @@ interface OmnipodDashPodStateManager {
|
|||
|
||||
fun createActiveCommand(historyId: String): Completable
|
||||
fun updateActiveCommand(): Maybe<PodEvent>
|
||||
fun resetActiveCommand()
|
||||
|
||||
data class ActiveCommand(
|
||||
val sequence: Short,
|
||||
|
|
|
@ -202,6 +202,11 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun resetActiveCommand() {
|
||||
podState.activeCommand = null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun updateActiveCommand() = Maybe.create<PodEvent> { source ->
|
||||
podState.activeCommand?.run {
|
||||
|
|
Loading…
Reference in a new issue