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