Provide total insulin delivered from Pod available in PodStateManager
This commit is contained in:
parent
00b9379b8c
commit
61d6c638b7
|
@ -302,6 +302,8 @@ public abstract class PodStateManager {
|
|||
return getSafe(() -> podState.getReservoirLevel());
|
||||
}
|
||||
|
||||
public final Double getTotalInsulinDelivered() { return getSafe(() -> podState.getTotalInsulinDelivered()); }
|
||||
|
||||
public final Duration getScheduleOffset() {
|
||||
DateTime now = getTime();
|
||||
return new Duration(now.withTimeAtStartOfDay(), now);
|
||||
|
@ -373,6 +375,7 @@ public abstract class PodStateManager {
|
|||
podState.setActiveAlerts(statusResponse.getAlerts());
|
||||
podState.setLastDeliveryStatus(statusResponse.getDeliveryStatus());
|
||||
podState.setReservoirLevel(statusResponse.getReservoirLevel());
|
||||
podState.setTotalTicksDelivered(statusResponse.getTicksDelivered());
|
||||
podState.setPodProgressStatus(statusResponse.getPodProgressStatus());
|
||||
podState.setLastUpdatedFromStatusResponse(DateTime.now());
|
||||
});
|
||||
|
@ -469,6 +472,7 @@ public abstract class PodStateManager {
|
|||
private DateTime expiresAt;
|
||||
private PodInfoFaultEvent faultEvent;
|
||||
private Double reservoirLevel;
|
||||
private Integer totalTicksDelivered;
|
||||
private boolean suspended;
|
||||
private NonceState nonceState;
|
||||
private PodProgressStatus podProgressStatus;
|
||||
|
@ -602,6 +606,20 @@ public abstract class PodStateManager {
|
|||
this.reservoirLevel = reservoirLevel;
|
||||
}
|
||||
|
||||
public Integer getTotalTicksDelivered() {
|
||||
return totalTicksDelivered;
|
||||
}
|
||||
|
||||
public Double getTotalInsulinDelivered() {
|
||||
if (totalTicksDelivered != null) {
|
||||
return totalTicksDelivered * OmnipodConst.POD_PULSE_SIZE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void setTotalTicksDelivered(Integer totalTicksDelivered) { this.totalTicksDelivered = totalTicksDelivered; }
|
||||
|
||||
public boolean isSuspended() {
|
||||
return suspended;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue