Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros
This commit is contained in:
commit
c5f69347eb
|
@ -26,7 +26,6 @@ public class InsertCannulaService {
|
|||
|
||||
public StatusResponse executeExpirationRemindersAlertCommand(OmnipodCommunicationService communicationService,
|
||||
PodSessionState podState) {
|
||||
|
||||
AlertConfiguration lowReservoirAlertConfiguration = AlertConfigurationFactory.createLowReservoirAlertConfiguration(OmnipodConst.LOW_RESERVOIR_ALERT);
|
||||
|
||||
DateTime endOfServiceTime = podState.getActivatedAt().plus(OmnipodConst.SERVICE_DURATION);
|
||||
|
|
|
@ -63,8 +63,8 @@ public class AlertConfiguration {
|
|||
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt16(durationInMinutes));
|
||||
}
|
||||
|
||||
encodedData = ByteUtil.concat(encodedData, beepType.getValue());
|
||||
encodedData = ByteUtil.concat(encodedData, beepRepeat.getValue());
|
||||
encodedData = ByteUtil.concat(encodedData, beepType.getValue());
|
||||
|
||||
return encodedData;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import org.joda.time.Duration;
|
|||
public class AlertConfigurationFactory {
|
||||
public static AlertConfiguration createLowReservoirAlertConfiguration(Double units) {
|
||||
return new AlertConfiguration(AlertType.LOW_RESERVOIR_ALERT, AlertSlot.SLOT4, true, false, Duration.ZERO,
|
||||
new UnitsRemainingAlertTrigger(units), BeepType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, BeepRepeat.EVERY_15_MINUTES);
|
||||
new UnitsRemainingAlertTrigger(units), BeepType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, BeepRepeat.EVERY_MINUTE_FOR_3_MINUTES_REPEAT_EVERY_60_MINUTES);
|
||||
}
|
||||
|
||||
public static AlertConfiguration createExpirationAdvisoryAlertConfiguration(Duration timeUntilAlert, Duration duration) {
|
||||
return new AlertConfiguration(AlertType.EXPIRATION_ADVISORY_ALERT, AlertSlot.SLOT7, true, false, duration,
|
||||
new TimerAlertTrigger(timeUntilAlert), BeepType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, BeepRepeat.EVERY_60_MINUTES);
|
||||
new TimerAlertTrigger(timeUntilAlert), BeepType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, BeepRepeat.EVERY_MINUTE_FOR_3_MINUTES_REPEAT_EVERY_15_MINUTES);
|
||||
}
|
||||
|
||||
public static AlertConfiguration createShutdownImminentAlertConfiguration(Duration timeUntilAlert) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver.comm;
|
|||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -92,9 +93,9 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
sendEvent(new EventOmnipodAcknowledgeAlertsChanged());
|
||||
}
|
||||
} else {
|
||||
if (pumpStatus.ackAlertsAvailable) {
|
||||
if (pumpStatus.ackAlertsAvailable || StringUtils.isNotEmpty(pumpStatus.ackAlertsText)) {
|
||||
pumpStatus.ackAlertsText = null;
|
||||
pumpStatus.ackAlertsAvailable = false;
|
||||
|
||||
sendEvent(new EventOmnipodAcknowledgeAlertsChanged());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ import static org.junit.Assert.assertArrayEquals;
|
|||
public class ConfigureAlertsCommandTest {
|
||||
@Test
|
||||
public void testEncoding() {
|
||||
// from https://github.com/ps2/rileylink_ios/blob/master/OmniKitTests/MessageTests.swift
|
||||
|
||||
Duration softExpirationTime = Duration.standardHours(72).minus(Duration.standardMinutes(1));
|
||||
AlertConfiguration alertConfiguration1 = new AlertConfiguration( //
|
||||
AlertType.EXPIRATION_ADVISORY_ALERT,
|
||||
|
@ -34,7 +32,7 @@ public class ConfigureAlertsCommandTest {
|
|||
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
|
||||
|
||||
assertArrayEquals( //
|
||||
ByteUtil.fromHexString("79a410df0502"), //
|
||||
ByteUtil.fromHexString("79a410df0205"), //
|
||||
alertConfiguration1.getRawData());
|
||||
|
||||
Duration hardExpirationTime = Duration.standardHours(79).minus(Duration.standardMinutes(1));
|
||||
|
@ -49,7 +47,7 @@ public class ConfigureAlertsCommandTest {
|
|||
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
|
||||
|
||||
assertArrayEquals( //
|
||||
ByteUtil.fromHexString("280012830602"), //
|
||||
ByteUtil.fromHexString("280012830206"), //
|
||||
alertConfiguration2.getRawData());
|
||||
|
||||
AlertConfiguration alertConfiguration3 = new AlertConfiguration( //
|
||||
|
@ -71,7 +69,7 @@ public class ConfigureAlertsCommandTest {
|
|||
Arrays.asList(alertConfiguration1, alertConfiguration2, alertConfiguration3));
|
||||
|
||||
assertArrayEquals( //
|
||||
ByteUtil.fromHexString("1916feb6268b79a410df0502280012830602020f00000202"), //
|
||||
ByteUtil.fromHexString("1916feb6268b79a410df0205280012830206020f00000202"), //
|
||||
configureAlertsCommand.getRawData());
|
||||
}
|
||||
|
||||
|
@ -84,8 +82,8 @@ public class ConfigureAlertsCommandTest {
|
|||
false, //
|
||||
Duration.ZERO, //
|
||||
new UnitsRemainingAlertTrigger(10.0), //
|
||||
BeepType.BEEP_BEEP_BEEP_BEEP, //
|
||||
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
|
||||
BeepType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, //
|
||||
BeepRepeat.EVERY_MINUTE_FOR_3_MINUTES_REPEAT_EVERY_60_MINUTES);
|
||||
|
||||
ConfigureAlertsCommand configureAlertsCommand = new ConfigureAlertsCommand( //
|
||||
0xae01a66c, //
|
||||
|
|
Loading…
Reference in a new issue