Merge branch 'omnipod_eros_dev' into omnipod_eros_dev_upstream_merge

This commit is contained in:
Bart Sopers 2021-01-07 02:35:36 +01:00
commit ec8b02464e

View file

@ -150,7 +150,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private RileyLinkOmnipodService rileyLinkOmnipodService;
private boolean busy = false;
private int timeChangeRetries;
private long nextPodCheck;
private long nextPodWarningCheck;
private long lastConnectionTimeMillis;
private final Handler loopHandler = new Handler(Looper.getMainLooper());
@ -255,12 +255,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
podStateManager.getActiveAlerts().size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
queueAcknowledgeAlertsCommand();
}
doPodCheck();
} else {
aapsLogger.debug(LTag.PUMPCOMM, "Skipping Pod status check because command queue is not empty");
}
updatePodWarningNotifications();
loopHandler.postDelayed(this, STATUS_CHECK_INTERVAL_MILLIS);
}
};
@ -444,19 +444,23 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
});
}
private void doPodCheck() {
if (System.currentTimeMillis() > this.nextPodCheck) {
private void updatePodWarningNotifications() {
if (System.currentTimeMillis() > this.nextPodWarningCheck) {
if (!podStateManager.isPodRunning()) {
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, resourceHelper.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
rxBus.send(new EventNewNotification(notification));
} else {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED));
if (podStateManager.isSuspended()) {
Notification notification = new Notification(Notification.OMNIPOD_POD_SUSPENDED, resourceHelper.gs(R.string.omnipod_error_pod_suspended), Notification.NORMAL);
rxBus.send(new EventNewNotification(notification));
} else {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED));
}
}
this.nextPodCheck = DateTimeUtil.getTimeInFutureFromMinutes(15);
this.nextPodWarningCheck = DateTimeUtil.getTimeInFutureFromMinutes(15);
}
}