Store PodProgressStatus in PodState

This commit is contained in:
Bart Sopers 2020-08-11 21:17:37 +02:00
parent ef05654133
commit b5d55adb2e

View file

@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
@ -270,6 +271,17 @@ public abstract class PodStateManager {
setAndStore(() -> podState.setSetupProgress(setupProgress));
}
public final PodProgressStatus getPodProgressStatus() {
return getSafe(() -> podState.getPodProgressStatus());
}
public final void setPodProgressStatus(PodProgressStatus podProgressStatus) {
if (podProgressStatus == null) {
throw new IllegalArgumentException("Pod progress status can not be null");
}
setAndStore(() -> podState.setPodProgressStatus(podProgressStatus));
}
public final boolean isSuspended() {
return getSafe(() -> podState.isSuspended());
}
@ -353,6 +365,7 @@ public abstract class PodStateManager {
podState.setActiveAlerts(statusResponse.getAlerts());
podState.setLastDeliveryStatus(statusResponse.getDeliveryStatus());
podState.setReservoirLevel(statusResponse.getReservoirLevel());
podState.setPodProgressStatus(statusResponse.getPodProgressStatus());
});
}
@ -449,6 +462,7 @@ public abstract class PodStateManager {
private boolean suspended;
private NonceState nonceState;
private SetupProgress setupProgress;
private PodProgressStatus podProgressStatus;
private DeliveryStatus lastDeliveryStatus;
private AlertSet activeAlerts;
private BasalSchedule basalSchedule;
@ -595,6 +609,14 @@ public abstract class PodStateManager {
this.setupProgress = setupProgress;
}
public PodProgressStatus getPodProgressStatus() {
return podProgressStatus;
}
void setPodProgressStatus(PodProgressStatus podProgressStatus) {
this.podProgressStatus = podProgressStatus;
}
DeliveryStatus getLastDeliveryStatus() {
return lastDeliveryStatus;
}