Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros
This commit is contained in:
commit
7097689c28
2 changed files with 26 additions and 12 deletions
|
@ -320,7 +320,7 @@ public class OmnipodManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (activeBolusData != null) {
|
||||
if (hasActiveBolus()) {
|
||||
activeBolusData.bolusCompletionSubject.onSuccess(new BolusDeliveryResult(units));
|
||||
activeBolusData = null;
|
||||
}
|
||||
|
@ -460,6 +460,13 @@ public class OmnipodManager {
|
|||
return podState != null && podState.getSetupProgress() == SetupProgress.COMPLETED;
|
||||
}
|
||||
|
||||
public boolean hasActiveBolus() {
|
||||
synchronized (bolusDataMutex) {
|
||||
return activeBolusData != null;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME this is dirty, we should not expose the original pod state
|
||||
public PodSessionState getPodState() {
|
||||
return this.podState;
|
||||
}
|
||||
|
|
|
@ -331,18 +331,23 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
@Override
|
||||
public PumpEnactResult cancelBolus() {
|
||||
long time = System.currentTimeMillis();
|
||||
String comment = null;
|
||||
while (delegate.hasActiveBolus()) {
|
||||
try {
|
||||
delegate.cancelBolus(isBolusBeepsEnabled());
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelBolus, null);
|
||||
return new PumpEnactResult().success(true).enacted(true);
|
||||
} catch (PodFaultException ex) {
|
||||
showErrorDialog(createPodFaultErrorMessage(ex.getFaultEvent().getFaultEventType()), null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelBolus, null);
|
||||
return new PumpEnactResult().success(true).enacted(true);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CancelBolus, comment);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
comment = handleAndTranslateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return new PumpEnactResult().success(true).enacted(true);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CancelBolus, comment);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -353,7 +358,9 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled);
|
||||
time = System.currentTimeMillis();
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
if (ex instanceof PodFaultException) {
|
||||
showErrorDialog(createPodFaultErrorMessage(((PodFaultException) ex).getFaultEvent().getFaultEventType()), R.raw.urgentalarm);
|
||||
} else if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
addToHistory(time, PodHistoryEntryType.SetTemporaryBasal, "Uncertain failure", false);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_temp_basal_failed_uncertain));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue