Make delivered ticks available in status response
This commit is contained in:
parent
c9dcac6368
commit
00b9379b8c
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@ public class StatusResponse extends MessageBlock {
|
||||||
private final PodProgressStatus podProgressStatus;
|
private final PodProgressStatus podProgressStatus;
|
||||||
private final Duration timeActive;
|
private final Duration timeActive;
|
||||||
private final Double reservoirLevel;
|
private final Double reservoirLevel;
|
||||||
|
private final int ticksDelivered;
|
||||||
private final double insulinDelivered;
|
private final double insulinDelivered;
|
||||||
private final double insulinNotDelivered;
|
private final double insulinNotDelivered;
|
||||||
private final byte podMessageCounter;
|
private final byte podMessageCounter;
|
||||||
|
@ -40,7 +41,8 @@ public class StatusResponse extends MessageBlock {
|
||||||
int highInsulinBits = (encodedData[2] & 0xF) << 9;
|
int highInsulinBits = (encodedData[2] & 0xF) << 9;
|
||||||
int middleInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[3]) << 1;
|
int middleInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[3]) << 1;
|
||||||
int lowInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[4]) >>> 7;
|
int lowInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[4]) >>> 7;
|
||||||
insulinDelivered = OmnipodConst.POD_PULSE_SIZE * (highInsulinBits | middleInsulinBits | lowInsulinBits);
|
ticksDelivered = (highInsulinBits | middleInsulinBits | lowInsulinBits);
|
||||||
|
insulinDelivered = OmnipodConst.POD_PULSE_SIZE * ticksDelivered;
|
||||||
podMessageCounter = (byte) ((encodedData[4] >>> 3) & 0xf);
|
podMessageCounter = (byte) ((encodedData[4] >>> 3) & 0xf);
|
||||||
|
|
||||||
insulinNotDelivered = OmnipodConst.POD_PULSE_SIZE * (((encodedData[4] & 0x03) << 8) | ByteUtil.convertUnsignedByteToInt(encodedData[5]));
|
insulinNotDelivered = OmnipodConst.POD_PULSE_SIZE * (((encodedData[4] & 0x03) << 8) | ByteUtil.convertUnsignedByteToInt(encodedData[5]));
|
||||||
|
@ -75,6 +77,8 @@ public class StatusResponse extends MessageBlock {
|
||||||
return reservoirLevel;
|
return reservoirLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTicksDelivered() { return ticksDelivered; }
|
||||||
|
|
||||||
public double getInsulinDelivered() {
|
public double getInsulinDelivered() {
|
||||||
return insulinDelivered;
|
return insulinDelivered;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue