Merge branch 'omnipod_eros_dev' into omnipod_eros_dev_upstream_merge

This commit is contained in:
Bart Sopers 2020-12-19 22:01:41 +01:00
commit 0699205f9a
3 changed files with 9 additions and 5 deletions

View file

@ -73,7 +73,7 @@ public class Notification {
public static final int OMNIPOD_POD_SUSPENDED = 61; public static final int OMNIPOD_POD_SUSPENDED = 61;
public static final int OMNIPOD_POD_ALERTS_UPDATED = 62; public static final int OMNIPOD_POD_ALERTS_UPDATED = 62;
public static final int OMNIPOD_POD_ALERTS = 63; public static final int OMNIPOD_POD_ALERTS = 63;
public static final int OMNIPOD_UNCERTAIN_TBR = 64; public static final int OMNIPOD_TBR_ALERTS = 64;
public static final int OMNIPOD_POD_FAULT = 66; public static final int OMNIPOD_POD_FAULT = 66;
public static final int OMNIPOD_UNCERTAIN_SMB = 67; public static final int OMNIPOD_UNCERTAIN_SMB = 67;
public static final int OMNIPOD_UNKNOWN_TBR = 68; public static final int OMNIPOD_UNKNOWN_TBR = 68;

View file

@ -393,7 +393,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
activePlugin.getActiveTreatments().removeTempBasal(tempBasal); activePlugin.getActiveTreatments().removeTempBasal(tempBasal);
} }
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_UNCERTAIN_TBR)); rxBus.send(new EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS));
} }
private void handleActivePodAlerts() { private void handleActivePodAlerts() {

View file

@ -493,7 +493,7 @@ public class AapsOmnipodManager {
String errorMessage = translateException(ex.getCause()); String errorMessage = translateException(ex.getCause());
addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage); addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
showNotification(Notification.OMNIPOD_UNCERTAIN_TBR, getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null); showNotification(Notification.OMNIPOD_TBR_ALERTS, getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null);
splitActiveTbr(); // Split any active TBR so when we recover from the uncertain TBR status,we only cancel the part after the cancellation splitActiveTbr(); // Split any active TBR so when we recover from the uncertain TBR status,we only cancel the part after the cancellation
@ -503,7 +503,7 @@ public class AapsOmnipodManager {
long pumpId = addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage); long pumpId = addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
if (!OmnipodManager.isCertainFailure(ex)) { if (!OmnipodManager.isCertainFailure(ex)) {
showNotification(Notification.OMNIPOD_UNCERTAIN_TBR, getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_cancelled_new_might_have_failed), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null); showNotification(Notification.OMNIPOD_TBR_ALERTS, getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_cancelled_new_might_have_failed), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null);
// Assume that setting the temp basal succeeded here, because in case it didn't succeed, // Assume that setting the temp basal succeeded here, because in case it didn't succeed,
// The next StatusResponse that we receive will allow us to recover from the wrong state // The next StatusResponse that we receive will allow us to recover from the wrong state
@ -522,6 +522,8 @@ public class AapsOmnipodManager {
addTempBasalTreatment(System.currentTimeMillis(), pumpId, tempBasalPair); addTempBasalTreatment(System.currentTimeMillis(), pumpId, tempBasalPair);
sendEvent(new EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS));
return new PumpEnactResult(injector) return new PumpEnactResult(injector)
.duration(tempBasalPair.getDurationMinutes()) .duration(tempBasalPair.getDurationMinutes())
.absolute(PumpType.Insulet_Omnipod.determineCorrectBasalSize(tempBasalPair.getInsulinRate())) .absolute(PumpType.Insulet_Omnipod.determineCorrectBasalSize(tempBasalPair.getInsulinRate()))
@ -533,7 +535,7 @@ public class AapsOmnipodManager {
executeCommand(() -> delegate.cancelTemporaryBasal(isTbrBeepsEnabled())); executeCommand(() -> delegate.cancelTemporaryBasal(isTbrBeepsEnabled()));
} catch (Exception ex) { } catch (Exception ex) {
if (OmnipodManager.isCertainFailure(ex)) { if (OmnipodManager.isCertainFailure(ex)) {
showNotification(Notification.OMNIPOD_UNCERTAIN_TBR, getStringResource(R.string.omnipod_error_cancel_temp_basal_failed_uncertain), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null); showNotification(Notification.OMNIPOD_TBR_ALERTS, getStringResource(R.string.omnipod_error_cancel_temp_basal_failed_uncertain), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null);
} else { } else {
splitActiveTbr(); // Split any active TBR so when we recover from the uncertain TBR status,we only cancel the part after the cancellation splitActiveTbr(); // Split any active TBR so when we recover from the uncertain TBR status,we only cancel the part after the cancellation
} }
@ -552,6 +554,8 @@ public class AapsOmnipodManager {
activePlugin.getActiveTreatments().addToHistoryTempBasal(tempBasal); activePlugin.getActiveTreatments().addToHistoryTempBasal(tempBasal);
sendEvent(new EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS));
return new PumpEnactResult(injector).success(true).enacted(true); return new PumpEnactResult(injector).success(true).enacted(true);
} }