Update PodProgressStatus values to match Omnikit Wiki
This commit is contained in:
parent
a0e5ec74fa
commit
a0b4e0c7ce
7 changed files with 29 additions and 29 deletions
|
@ -30,7 +30,7 @@ public class PrimeAction implements OmnipodAction<StatusResponse> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePrimingStatus(PodSessionState podState, StatusResponse statusResponse) {
|
public static void updatePrimingStatus(PodSessionState podState, StatusResponse statusResponse) {
|
||||||
if (podState.getSetupProgress().equals(SetupProgress.PRIMING) && statusResponse.getPodProgressStatus().equals(PodProgressStatus.READY_FOR_BASAL_SCHEDULE)) {
|
if (podState.getSetupProgress().equals(SetupProgress.PRIMING) && statusResponse.getPodProgressStatus().equals(PodProgressStatus.PRIMING_COMPLETED)) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Updating SetupProgress from PRIMING to PRIMING_FINISHED");
|
LOG.debug("Updating SetupProgress from PRIMING to PRIMING_FINISHED");
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,8 @@ public class SetupPodAction implements OmnipodAction<VersionResponse> {
|
||||||
if(setupPodResponse.getAddress() != podState.getAddress()) {
|
if(setupPodResponse.getAddress() != podState.getAddress()) {
|
||||||
throw new IllegalMessageAddressException(podState.getAddress(), setupPodResponse.getAddress());
|
throw new IllegalMessageAddressException(podState.getAddress(), setupPodResponse.getAddress());
|
||||||
}
|
}
|
||||||
if (setupPodResponse.getPodProgressStatus() != PodProgressStatus.PAIRING_SUCCESS) {
|
if (setupPodResponse.getPodProgressStatus() != PodProgressStatus.PAIRING_COMPLETED) {
|
||||||
throw new IllegalPodProgressException(PodProgressStatus.PAIRING_SUCCESS, setupPodResponse.getPodProgressStatus());
|
throw new IllegalPodProgressException(PodProgressStatus.PAIRING_COMPLETED, setupPodResponse.getPodProgressStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
podState.setSetupProgress(SetupProgress.POD_CONFIGURED);
|
podState.setSetupProgress(SetupProgress.POD_CONFIGURED);
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
|
|
||||||
public enum PodProgressStatus {
|
public enum PodProgressStatus {
|
||||||
INITIAL_VALUE((byte) 0x00),
|
INITIALIZED((byte) 0x00),
|
||||||
TANK_POWER_ACTIVATED((byte) 0x01),
|
MEMORY_INITIALIZED((byte) 0x01),
|
||||||
TANK_FILL_COMPLETED((byte) 0x02),
|
REMINDER_INITIALIZED((byte) 0x02),
|
||||||
PAIRING_SUCCESS((byte) 0x03),
|
PAIRING_COMPLETED((byte) 0x03),
|
||||||
PRIMING((byte) 0x04),
|
PRIMING((byte) 0x04),
|
||||||
READY_FOR_BASAL_SCHEDULE((byte) 0x05),
|
PRIMING_COMPLETED((byte) 0x05),
|
||||||
READY_FOR_CANNULA_INSERTION((byte) 0x06),
|
BASAL_INITIALIZED((byte) 0x06),
|
||||||
CANNULA_INSERTING((byte) 0x07),
|
INSERTING_CANNULA((byte) 0x07),
|
||||||
RUNNING_ABOVE_FIFTY_UNITS((byte) 0x08),
|
ABOVE_FIFTY_UNITS((byte) 0x08),
|
||||||
RUNNING_BELOW_FIFTY_UNITS((byte) 0x09),
|
FIFTY_OR_LESS_UNITS((byte) 0x09),
|
||||||
ONE_NOT_USED_BUT_IN_33((byte) 0x0a),
|
ONE_NOT_USED((byte) 0x0a),
|
||||||
TWO_NOT_USED_BUT_IN_33((byte) 0x0b),
|
TWO_NOT_USED((byte) 0x0b),
|
||||||
THREE_NOT_USED_BUT_IN_33((byte) 0x0c),
|
THREE_NOT_USED((byte) 0x0c),
|
||||||
FAULT_EVENT_OCCURRED((byte) 0x0d),
|
FAULT_EVENT_OCCURRED((byte) 0x0d), // Fault event occurred (a "screamer")
|
||||||
FAILED_TO_INITIALIZE_IN_TIME((byte) 0x0e),
|
ACTIVATION_TIME_EXCEEDED((byte) 0x0e), // Took > 2 hours from progress 2 to 3 or > 1 hour from 3 to 8
|
||||||
INACTIVE((byte) 0x0f);
|
INACTIVE((byte) 0x0f); // Pod deactivated or a fatal packet state error
|
||||||
|
|
||||||
private byte value;
|
private byte value;
|
||||||
|
|
||||||
|
@ -38,6 +38,6 @@ public enum PodProgressStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReadyForDelivery() {
|
public boolean isReadyForDelivery() {
|
||||||
return this == RUNNING_ABOVE_FIFTY_UNITS || this == RUNNING_BELOW_FIFTY_UNITS;
|
return this == ABOVE_FIFTY_UNITS || this == FIFTY_OR_LESS_UNITS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ErrorResponseTest {
|
||||||
ErrorResponse errorResponse = new ErrorResponse(ByteUtil.fromHexString("0603101308"));
|
ErrorResponse errorResponse = new ErrorResponse(ByteUtil.fromHexString("0603101308"));
|
||||||
assertEquals(0x10, errorResponse.getErrorResponseCode());
|
assertEquals(0x10, errorResponse.getErrorResponseCode());
|
||||||
assertEquals(FaultEventCode.MESSAGE_LENGTH_TOO_LONG, errorResponse.getFaultEventCode());
|
assertEquals(FaultEventCode.MESSAGE_LENGTH_TOO_LONG, errorResponse.getFaultEventCode());
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, errorResponse.getPodProgressStatus());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, errorResponse.getPodProgressStatus());
|
||||||
|
|
||||||
assertNull(errorResponse.getNonceSearchKey());
|
assertNull(errorResponse.getNonceSearchKey());
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class StatusResponseTest {
|
||||||
StatusResponse statusResponse = new StatusResponse(bytes);
|
StatusResponse statusResponse = new StatusResponse(bytes);
|
||||||
|
|
||||||
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, statusResponse.getPodProgressStatus());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, statusResponse.getPodProgressStatus());
|
||||||
assertNull("Reservoir level should be null", statusResponse.getReservoirLevel());
|
assertNull("Reservoir level should be null", statusResponse.getReservoirLevel());
|
||||||
assertEquals(Duration.standardMinutes(1307).getMillis(), statusResponse.getTimeActive().getMillis());
|
assertEquals(Duration.standardMinutes(1307).getMillis(), statusResponse.getTimeActive().getMillis());
|
||||||
assertEquals(60.05, statusResponse.getInsulinDelivered(), 0.000001);
|
assertEquals(60.05, statusResponse.getInsulinDelivered(), 0.000001);
|
||||||
|
@ -59,7 +59,7 @@ public class StatusResponseTest {
|
||||||
StatusResponse statusResponse = new StatusResponse(bytes);
|
StatusResponse statusResponse = new StatusResponse(bytes);
|
||||||
|
|
||||||
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
||||||
assertEquals(PodProgressStatus.RUNNING_BELOW_FIFTY_UNITS, statusResponse.getPodProgressStatus());
|
assertEquals(PodProgressStatus.FIFTY_OR_LESS_UNITS, statusResponse.getPodProgressStatus());
|
||||||
assertEquals(24.4, statusResponse.getReservoirLevel(), 0.000001);
|
assertEquals(24.4, statusResponse.getReservoirLevel(), 0.000001);
|
||||||
assertEquals(Duration.standardMinutes(4261).getMillis(), statusResponse.getTimeActive().getMillis());
|
assertEquals(Duration.standardMinutes(4261).getMillis(), statusResponse.getTimeActive().getMillis());
|
||||||
assertEquals(156.7, statusResponse.getInsulinDelivered(), 0.000001);
|
assertEquals(156.7, statusResponse.getInsulinDelivered(), 0.000001);
|
||||||
|
@ -93,7 +93,7 @@ public class StatusResponseTest {
|
||||||
|
|
||||||
assertTrue(Duration.standardMinutes(3547).isEqual(statusResponse.getTimeActive()));
|
assertTrue(Duration.standardMinutes(3547).isEqual(statusResponse.getTimeActive()));
|
||||||
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
assertEquals(DeliveryStatus.NORMAL, statusResponse.getDeliveryStatus());
|
||||||
assertEquals(PodProgressStatus.RUNNING_BELOW_FIFTY_UNITS, statusResponse.getPodProgressStatus());
|
assertEquals(PodProgressStatus.FIFTY_OR_LESS_UNITS, statusResponse.getPodProgressStatus());
|
||||||
assertEquals(129.45, statusResponse.getInsulinDelivered(), 0.00001);
|
assertEquals(129.45, statusResponse.getInsulinDelivered(), 0.00001);
|
||||||
assertEquals(46.00, statusResponse.getReservoirLevel(), 0.00001);
|
assertEquals(46.00, statusResponse.getReservoirLevel(), 0.00001);
|
||||||
assertEquals(2.2, statusResponse.getInsulinNotDelivered(), 0.0001);
|
assertEquals(2.2, statusResponse.getInsulinNotDelivered(), 0.0001);
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class VersionResponseTest {
|
||||||
assertEquals(0x1f00ee87, versionResponse.getAddress());
|
assertEquals(0x1f00ee87, versionResponse.getAddress());
|
||||||
assertEquals(41847, versionResponse.getLot());
|
assertEquals(41847, versionResponse.getLot());
|
||||||
assertEquals(240439, versionResponse.getTid());
|
assertEquals(240439, versionResponse.getTid());
|
||||||
assertEquals(PodProgressStatus.PAIRING_SUCCESS, versionResponse.getPodProgressStatus());
|
assertEquals(PodProgressStatus.PAIRING_COMPLETED, versionResponse.getPodProgressStatus());
|
||||||
assertEquals("2.7.0", versionResponse.getPiVersion().toString());
|
assertEquals("2.7.0", versionResponse.getPiVersion().toString());
|
||||||
assertEquals("2.7.0", versionResponse.getPmVersion().toString());
|
assertEquals("2.7.0", versionResponse.getPmVersion().toString());
|
||||||
assertNull(versionResponse.getRssi());
|
assertNull(versionResponse.getRssi());
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class PodInfoFaultEventTest {
|
||||||
public void testPodInfoFaultEventNoFaultAlerts() {
|
public void testPodInfoFaultEventNoFaultAlerts() {
|
||||||
PodInfoFaultEvent podInfoFaultEvent = new PodInfoFaultEvent(ByteUtil.fromHexString("02080100000a003800000003ff008700000095ff0000"));
|
PodInfoFaultEvent podInfoFaultEvent = new PodInfoFaultEvent(ByteUtil.fromHexString("02080100000a003800000003ff008700000095ff0000"));
|
||||||
|
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatus());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatus());
|
||||||
assertEquals(DeliveryStatus.NORMAL, podInfoFaultEvent.getDeliveryStatus());
|
assertEquals(DeliveryStatus.NORMAL, podInfoFaultEvent.getDeliveryStatus());
|
||||||
assertEquals(0, podInfoFaultEvent.getInsulinNotDelivered(), 0.000001);
|
assertEquals(0, podInfoFaultEvent.getInsulinNotDelivered(), 0.000001);
|
||||||
assertEquals(0x0a, podInfoFaultEvent.getPodMessageCounter());
|
assertEquals(0x0a, podInfoFaultEvent.getPodMessageCounter());
|
||||||
|
@ -51,7 +51,7 @@ public class PodInfoFaultEventTest {
|
||||||
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
||||||
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
||||||
assertEquals(LogEventErrorCode.NONE, podInfoFaultEvent.getLogEventErrorType());
|
assertEquals(LogEventErrorCode.NONE, podInfoFaultEvent.getLogEventErrorType());
|
||||||
assertEquals(PodProgressStatus.READY_FOR_BASAL_SCHEDULE, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
assertEquals(PodProgressStatus.PRIMING_COMPLETED, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
||||||
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
||||||
assertEquals(46, podInfoFaultEvent.getRadioRSSI());
|
assertEquals(46, podInfoFaultEvent.getRadioRSSI());
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class PodInfoFaultEventTest {
|
||||||
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
||||||
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
||||||
assertEquals(LogEventErrorCode.NONE, podInfoFaultEvent.getLogEventErrorType());
|
assertEquals(LogEventErrorCode.NONE, podInfoFaultEvent.getLogEventErrorType());
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
||||||
assertEquals(0, podInfoFaultEvent.getReceiverLowGain());
|
assertEquals(0, podInfoFaultEvent.getReceiverLowGain());
|
||||||
assertEquals(35, podInfoFaultEvent.getRadioRSSI());
|
assertEquals(35, podInfoFaultEvent.getRadioRSSI());
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class PodInfoFaultEventTest {
|
||||||
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
||||||
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
||||||
assertEquals(LogEventErrorCode.INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_2, podInfoFaultEvent.getLogEventErrorType());
|
assertEquals(LogEventErrorCode.INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_2, podInfoFaultEvent.getLogEventErrorType());
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
||||||
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
||||||
assertEquals(39, podInfoFaultEvent.getRadioRSSI());
|
assertEquals(39, podInfoFaultEvent.getRadioRSSI());
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class PodInfoFaultEventTest {
|
||||||
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue());
|
||||||
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
assertFalse(podInfoFaultEvent.isFaultAccessingTables());
|
||||||
assertEquals(LogEventErrorCode.INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_2, podInfoFaultEvent.getLogEventErrorType());
|
assertEquals(LogEventErrorCode.INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_2, podInfoFaultEvent.getLogEventErrorType());
|
||||||
assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent());
|
||||||
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
assertEquals(2, podInfoFaultEvent.getReceiverLowGain());
|
||||||
assertEquals(39, podInfoFaultEvent.getRadioRSSI());
|
assertEquals(39, podInfoFaultEvent.getRadioRSSI());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue