More small Omnipod improvements
This commit is contained in:
parent
9b953d1bed
commit
4e32761d48
1 changed files with 8 additions and 4 deletions
|
@ -209,10 +209,13 @@ public class OmnipodManager {
|
||||||
suspendDelivery(acknowledgementBeep);
|
suspendDelivery(acknowledgementBeep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the new Basal schedule after successfully suspending delivery, so that if setting the Basal schedule fails,
|
||||||
|
// And we later try to resume delivery, the new schedule is used
|
||||||
|
podStateManager.setBasalSchedule(schedule);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
executeAndVerify(() -> communicationService.executeAction(new SetBasalScheduleAction(podStateManager, schedule,
|
executeAndVerify(() -> communicationService.executeAction(new SetBasalScheduleAction(podStateManager, schedule,
|
||||||
false, podStateManager.getScheduleOffset(), acknowledgementBeep)));
|
false, podStateManager.getScheduleOffset(), acknowledgementBeep)));
|
||||||
podStateManager.setBasalSchedule(schedule);
|
|
||||||
} catch (OmnipodException ex) {
|
} catch (OmnipodException ex) {
|
||||||
if (ex.isCertainFailure()) {
|
if (ex.isCertainFailure()) {
|
||||||
if (!wasSuspended) {
|
if (!wasSuspended) {
|
||||||
|
@ -222,9 +225,7 @@ public class OmnipodManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// verifyDeliveryStatus will throw an exception if verification fails
|
// verifyDeliveryStatus will throw an exception if verification fails
|
||||||
if (verifyDeliveryStatus(DeliveryStatus.NORMAL, ex)) {
|
if (!verifyDeliveryStatus(DeliveryStatus.NORMAL, ex)) {
|
||||||
podStateManager.setBasalSchedule(schedule);
|
|
||||||
} else {
|
|
||||||
if (!wasSuspended) {
|
if (!wasSuspended) {
|
||||||
throw new CommandFailedAfterChangingDeliveryStatusException("Suspending delivery succeeded but setting the new basal schedule did not", ex);
|
throw new CommandFailedAfterChangingDeliveryStatusException("Suspending delivery succeeded but setting the new basal schedule did not", ex);
|
||||||
}
|
}
|
||||||
|
@ -286,6 +287,9 @@ public class OmnipodManager {
|
||||||
ex.setCertainFailure(true);
|
ex.setCertainFailure(true);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
} catch (CommandFailedAfterChangingDeliveryStatusException ex2) {
|
||||||
|
// Don't set temp basal in Pod State for this Exception
|
||||||
|
throw ex2;
|
||||||
} catch (OmnipodException ex2) {
|
} catch (OmnipodException ex2) {
|
||||||
if (!ex2.isCertainFailure()) {
|
if (!ex2.isCertainFailure()) {
|
||||||
// We're not sure that setting the new TBR failed, so we assume that it succeeded
|
// We're not sure that setting the new TBR failed, so we assume that it succeeded
|
||||||
|
|
Loading…
Reference in a new issue