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.bolusCompletionSubject.onSuccess(new BolusDeliveryResult(units));
|
||||||
activeBolusData = null;
|
activeBolusData = null;
|
||||||
}
|
}
|
||||||
|
@ -460,6 +460,13 @@ public class OmnipodManager {
|
||||||
return podState != null && podState.getSetupProgress() == SetupProgress.COMPLETED;
|
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() {
|
public PodSessionState getPodState() {
|
||||||
return this.podState;
|
return this.podState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,18 +331,23 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult cancelBolus() {
|
public PumpEnactResult cancelBolus() {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
String comment = null;
|
||||||
|
while (delegate.hasActiveBolus()) {
|
||||||
try {
|
try {
|
||||||
delegate.cancelBolus(isBolusBeepsEnabled());
|
delegate.cancelBolus(isBolusBeepsEnabled());
|
||||||
addSuccessToHistory(time, PodHistoryEntryType.CancelBolus, null);
|
addSuccessToHistory(time, PodHistoryEntryType.CancelBolus, null);
|
||||||
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
} catch (PodFaultException ex) {
|
} catch (PodFaultException ex) {
|
||||||
showErrorDialog(createPodFaultErrorMessage(ex.getFaultEvent().getFaultEventType()), null);
|
showErrorDialog(createPodFaultErrorMessage(ex.getFaultEvent().getFaultEventType()), null);
|
||||||
|
addSuccessToHistory(time, PodHistoryEntryType.CancelBolus, null);
|
||||||
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String comment = handleAndTranslateException(ex);
|
comment = handleAndTranslateException(ex);
|
||||||
addFailureToHistory(time, PodHistoryEntryType.CancelBolus, comment);
|
}
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
addFailureToHistory(time, PodHistoryEntryType.CancelBolus, comment);
|
||||||
|
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -353,7 +358,9 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled);
|
delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled);
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
} catch (Exception ex) {
|
} 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);
|
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));
|
return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_temp_basal_failed_uncertain));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue