add checkPodKaput
This commit is contained in:
parent
aa719e0b9f
commit
b55dacd12c
3 changed files with 14 additions and 12 deletions
|
@ -132,8 +132,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
history.updateFromState(podStateManager),
|
||||
podStateManager.updateActiveCommand()
|
||||
.map { handleCommandConfirmation(it) }
|
||||
.map { checkPodKaput() }
|
||||
.ignoreElement(),
|
||||
checkPodKaput()
|
||||
)
|
||||
).blockingGet()
|
||||
if (throwable != null) {
|
||||
|
@ -143,12 +143,11 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkPodKaput() {
|
||||
if (podStateManager.isPodKaput) {
|
||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||
if (tbr?.rate == 0.0) {
|
||||
return
|
||||
}
|
||||
private fun checkPodKaput(): Completable = Completable.defer {
|
||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||
if (podStateManager.isPodKaput &&
|
||||
(tbr == null || tbr.rate != 0.0)
|
||||
) {
|
||||
pumpSync.syncTemporaryBasalWithPumpId(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
rate = 0.0,
|
||||
|
@ -160,6 +159,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
pumpSerial = serialNumber()
|
||||
)
|
||||
}
|
||||
Completable.complete()
|
||||
}
|
||||
|
||||
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
|
||||
|
|
|
@ -140,7 +140,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
override val activeAlerts: EnumSet<AlertType>?
|
||||
get() = podState.activeAlerts
|
||||
|
||||
override val alarmType: AlarmType?
|
||||
override val alarmType: AlarmType?
|
||||
get() = podState.alarmType
|
||||
|
||||
override var tempBasal: OmnipodDashPodStateManager.TempBasal?
|
||||
|
|
|
@ -296,10 +296,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
}
|
||||
*/
|
||||
podStateManager.alarmType?.let {
|
||||
errors.add(resourceHelper.gs(
|
||||
R.string.omnipod_common_pod_status_pod_fault_description,
|
||||
it.value,
|
||||
it.toString())
|
||||
errors.add(
|
||||
resourceHelper.gs(
|
||||
R.string.omnipod_common_pod_status_pod_fault_description,
|
||||
it.value,
|
||||
it.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue