Merge pull request #52 from AAPS-Omnipod/omnipod_eros_dev_upstream_merge

Latest Omnipod updates
This commit is contained in:
Milos Kozak 2020-10-25 20:53:50 +01:00 committed by GitHub
commit 105e9fa707
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 29 deletions

View file

@ -98,6 +98,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import static info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
/** /**
* Created by andy on 23.04.18. * Created by andy on 23.04.18.
* *
@ -282,13 +284,16 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
.toObservable(EventPreferenceChange.class) .toObservable(EventPreferenceChange.class)
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.subscribe(event -> { .subscribe(event -> {
if ((event.isChanged(getResourceHelper(), R.string.key_omnipod_basal_beeps_enabled)) || if (event.isChanged(getResourceHelper(), R.string.key_omnipod_basal_beeps_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_bolus_beeps_enabled)) || event.isChanged(getResourceHelper(), R.string.key_omnipod_bolus_beeps_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_tbr_beeps_enabled)) || event.isChanged(getResourceHelper(), R.string.key_omnipod_tbr_beeps_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_smb_beeps_enabled)) || event.isChanged(getResourceHelper(), R.string.key_omnipod_smb_beeps_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_suspend_delivery_button_enabled)) || event.isChanged(getResourceHelper(), R.string.key_omnipod_suspend_delivery_button_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_pulse_log_button_enabled)) || event.isChanged(getResourceHelper(), R.string.key_omnipod_pulse_log_button_enabled) ||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_time_change_event_enabled))) { event.isChanged(getResourceHelper(), R.string.key_omnipod_time_change_event_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_tbr_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_smb_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_bolus_sound_enabled)) {
aapsOmnipodManager.reloadSettings(); aapsOmnipodManager.reloadSettings();
} else if (event.isChanged(getResourceHelper(), R.string.key_omnipod_expiration_reminder_enabled) || } else if (event.isChanged(getResourceHelper(), R.string.key_omnipod_expiration_reminder_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_expiration_reminder_hours_before_shutdown) || event.isChanged(getResourceHelper(), R.string.key_omnipod_expiration_reminder_hours_before_shutdown) ||
@ -545,6 +550,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
durationInMinutes, Profile profile, boolean enforceNew) { durationInMinutes, Profile profile, boolean enforceNew) {
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute: rate: {}, duration={}", absoluteRate, durationInMinutes); aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute: rate: {}, duration={}", absoluteRate, durationInMinutes);
if (durationInMinutes <= 0 || durationInMinutes % BASAL_STEP_DURATION.getStandardMinutes() != 0) {
return new PumpEnactResult(getInjector()).success(false).comment(resourceHelper.gs(R.string.omnipod_error_set_temp_basal_failed_validation, BASAL_STEP_DURATION.getStandardMinutes()));
}
// read current TBR // read current TBR
TemporaryBasal tbrCurrent = readTBR(); TemporaryBasal tbrCurrent = readTBR();

View file

@ -17,6 +17,9 @@ public class OmnipodStorageKeys {
public static final int EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN = R.string.key_omnipod_expiration_reminder_hours_before_shutdown; public static final int EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN = R.string.key_omnipod_expiration_reminder_hours_before_shutdown;
public static final int LOW_RESERVOIR_ALERT_ENABLED = R.string.key_omnipod_low_reservoir_alert_enabled; public static final int LOW_RESERVOIR_ALERT_ENABLED = R.string.key_omnipod_low_reservoir_alert_enabled;
public static final int LOW_RESERVOIR_ALERT_UNITS = R.string.key_omnipod_low_reservoir_alert_units; public static final int LOW_RESERVOIR_ALERT_UNITS = R.string.key_omnipod_low_reservoir_alert_units;
public static final int NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_tbr_sound_enabled;
public static final int NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_smb_sound_enabled;
public static final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled;
} }
public static class Statistics { public static class Statistics {

View file

@ -14,6 +14,7 @@ public class OmnipodConstants {
public static final double MAX_RESERVOIR_READING = 50.0; public static final double MAX_RESERVOIR_READING = 50.0;
public static final double MAX_BOLUS = 30.0; public static final double MAX_BOLUS = 30.0;
public static final double MAX_BASAL_RATE = 30.0; public static final double MAX_BASAL_RATE = 30.0;
public static final Duration BASAL_STEP_DURATION = Duration.standardMinutes(30);
public static final Duration MAX_TEMP_BASAL_DURATION = Duration.standardHours(12); public static final Duration MAX_TEMP_BASAL_DURATION = Duration.standardHours(12);
public static final int DEFAULT_ADDRESS = 0xffffffff; public static final int DEFAULT_ADDRESS = 0xffffffff;
@ -27,4 +28,6 @@ public class OmnipodConstants {
public static final double POD_PRIME_BOLUS_UNITS = 2.6; public static final double POD_PRIME_BOLUS_UNITS = 2.6;
public static final double POD_CANNULA_INSERTION_BOLUS_UNITS = 0.5; public static final double POD_CANNULA_INSERTION_BOLUS_UNITS = 0.5;
public static final double POD_SETUP_UNITS = POD_PRIME_BOLUS_UNITS + POD_CANNULA_INSERTION_BOLUS_UNITS; public static final double POD_SETUP_UNITS = POD_PRIME_BOLUS_UNITS + POD_CANNULA_INSERTION_BOLUS_UNITS;
public static final int DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD = 20;
} }

View file

@ -9,6 +9,8 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable; import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants; import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
import static info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
public class RateEntry implements IRawRepresentable { public class RateEntry implements IRawRepresentable {
private final double totalPulses; private final double totalPulses;
@ -21,6 +23,13 @@ public class RateEntry implements IRawRepresentable {
} }
public static List<RateEntry> createEntries(double rate, Duration duration) { public static List<RateEntry> createEntries(double rate, Duration duration) {
if (Duration.ZERO.equals(duration)) {
throw new IllegalArgumentException("Duration may not be 0 minutes.");
}
if (duration.getStandardMinutes() % BASAL_STEP_DURATION.getStandardMinutes() != 0) {
throw new IllegalArgumentException("Duration must be a multiple of " + BASAL_STEP_DURATION.getStandardMinutes() + " minutes.");
}
List<RateEntry> entries = new ArrayList<>(); List<RateEntry> entries = new ArrayList<>();
int remainingSegments = (int) Math.round(duration.getStandardSeconds() / 1800.0); int remainingSegments = (int) Math.round(duration.getStandardSeconds() / 1800.0);
double pulsesPerSegment = (int) Math.round(rate / OmnipodConstants.POD_PULSE_SIZE) / 2.0; double pulsesPerSegment = (int) Math.round(rate / OmnipodConstants.POD_PULSE_SIZE) / 2.0;

View file

@ -56,13 +56,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.Activati
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CommandFailedAfterChangingDeliveryStatusException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CommandFailedAfterChangingDeliveryStatusException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CrcMismatchException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CrcMismatchException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.DeliveryStatusVerificationFailedException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.DeliveryStatusVerificationFailedException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalDeliveryStatusException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalDeliveryStatusException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageAddressException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageAddressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageSequenceNumberException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageSequenceNumberException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPacketTypeException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPacketTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalResponseException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalResponseException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalVersionResponseTypeException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalVersionResponseTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.MessageDecodingException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.MessageDecodingException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.NonceOutOfSyncException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.NonceOutOfSyncException;
@ -110,6 +110,9 @@ public class AapsOmnipodManager {
private boolean suspendDeliveryButtonEnabled; private boolean suspendDeliveryButtonEnabled;
private boolean pulseLogButtonEnabled; private boolean pulseLogButtonEnabled;
private boolean timeChangeEventEnabled; private boolean timeChangeEventEnabled;
private boolean notificationUncertainTbrSoundEnabled;
private boolean notificationUncertainSmbSoundEnabled;
private boolean notificationUncertainBolusSoundEnabled;
@Inject @Inject
public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService, public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService,
@ -152,6 +155,9 @@ public class AapsOmnipodManager {
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false); suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false); pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false);
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true); timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true);
notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED, true);
notificationUncertainBolusSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED, true);
} }
public PumpEnactResult initializePod() { public PumpEnactResult initializePod() {
@ -349,9 +355,9 @@ public class AapsOmnipodManager {
if (OmnipodManager.CommandDeliveryStatus.UNCERTAIN_FAILURE.equals(bolusCommandResult.getCommandDeliveryStatus())) { if (OmnipodManager.CommandDeliveryStatus.UNCERTAIN_FAILURE.equals(bolusCommandResult.getCommandDeliveryStatus())) {
// For safety reasons, we treat this as a bolus that has successfully been delivered, in order to prevent insulin overdose // For safety reasons, we treat this as a bolus that has successfully been delivered, in order to prevent insulin overdose
if (detailedBolusInfo.isSMB) { if (detailedBolusInfo.isSMB) {
showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain_smb, detailedBolusInfo.insulin), Notification.URGENT, R.raw.boluserror); showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain_smb, detailedBolusInfo.insulin), Notification.URGENT, isNotificationUncertainSmbSoundEnabled() ? R.raw.boluserror : null);
} else { } else {
showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain), Notification.URGENT, R.raw.boluserror); showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain), Notification.URGENT, isNotificationUncertainBolusSoundEnabled() ? R.raw.boluserror : null);
} }
} }
@ -469,7 +475,7 @@ public class AapsOmnipodManager {
note = getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled); note = getStringResource(R.string.omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled);
addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage); addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
} }
showNotification(note, Notification.URGENT, R.raw.boluserror); showNotification(note, Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null);
return new PumpEnactResult(injector).success(false).enacted(false).comment(errorMessage); return new PumpEnactResult(injector).success(false).enacted(false).comment(errorMessage);
} catch (Exception ex) { } catch (Exception ex) {
@ -493,7 +499,7 @@ public class AapsOmnipodManager {
executeCommand(() -> delegate.cancelTemporaryBasal(isTbrBeepsEnabled())); executeCommand(() -> delegate.cancelTemporaryBasal(isTbrBeepsEnabled()));
} catch (Exception ex) { } catch (Exception ex) {
if (ex instanceof OmnipodException && !((OmnipodException) ex).isCertainFailure()) { if (ex instanceof OmnipodException && !((OmnipodException) ex).isCertainFailure()) {
showNotification(getStringResource(R.string.omnipod_error_cancel_temp_basal_failed_uncertain), Notification.URGENT, R.raw.boluserror); showNotification(getStringResource(R.string.omnipod_error_cancel_temp_basal_failed_uncertain), Notification.URGENT, isNotificationUncertainTbrSoundEnabled() ? R.raw.boluserror : null);
} }
String errorMessage = translateException(ex); String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, errorMessage); addFailureToHistory(PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, errorMessage);
@ -611,6 +617,18 @@ public class AapsOmnipodManager {
return timeChangeEventEnabled; return timeChangeEventEnabled;
} }
public boolean isNotificationUncertainTbrSoundEnabled() {
return notificationUncertainTbrSoundEnabled;
}
public boolean isNotificationUncertainSmbSoundEnabled() {
return notificationUncertainSmbSoundEnabled;
}
public boolean isNotificationUncertainBolusSoundEnabled() {
return notificationUncertainBolusSoundEnabled;
}
public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) { public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) {
DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy(); DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy();

View file

@ -31,11 +31,11 @@ import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpVal
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.* import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.*
import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodAlertUtil
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.queue.events.EventQueueChanged
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.extensions.plusAssign
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck
@ -64,10 +64,10 @@ class OmnipodOverviewFragment : DaggerFragment() {
@Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin @Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var warnColors: WarnColors
@Inject lateinit var podStateManager: PodStateManager @Inject lateinit var podStateManager: PodStateManager
@Inject lateinit var sp: SP @Inject lateinit var sp: SP
@Inject lateinit var omnipodUtil: AapsOmnipodUtil @Inject lateinit var omnipodUtil: AapsOmnipodUtil
@Inject lateinit var omnipodAlertUtil: OmnipodAlertUtil
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
@Inject lateinit var dateUtil: DateUtil @Inject lateinit var dateUtil: DateUtil
@Inject lateinit var omnipodManager: AapsOmnipodManager @Inject lateinit var omnipodManager: AapsOmnipodManager
@ -299,8 +299,15 @@ class OmnipodOverviewFragment : DaggerFragment() {
omnipod_overview_reservoir.text = resourceHelper.gs(R.string.omnipod_overview_reservoir_value_over50) omnipod_overview_reservoir.text = resourceHelper.gs(R.string.omnipod_overview_reservoir_value_over50)
omnipod_overview_reservoir.setTextColor(Color.WHITE) omnipod_overview_reservoir.setTextColor(Color.WHITE)
} else { } else {
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
omnipod_overview_reservoir.text = resourceHelper.gs(R.string.omnipod_overview_reservoir_value, podStateManager.reservoirLevel) omnipod_overview_reservoir.text = resourceHelper.gs(R.string.omnipod_overview_reservoir_value, podStateManager.reservoirLevel)
warnColors.setColorInverse(omnipod_overview_reservoir, podStateManager.reservoirLevel, 50.0, 20.0) omnipod_overview_reservoir.setTextColor(if (podStateManager.reservoirLevel < lowReservoirThreshold) {
Color.RED
} else {
Color.WHITE
})
} }
omnipod_overview_pod_active_alerts.text = if (podStateManager.hasActiveAlerts()) { omnipod_overview_pod_active_alerts.text = if (podStateManager.hasActiveAlerts()) {

View file

@ -6,6 +6,7 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys; import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
@Singleton @Singleton
@ -24,6 +25,6 @@ public class OmnipodAlertUtil {
public Integer getLowReservoirAlertUnits() { public Integer getLowReservoirAlertUnits() {
boolean lowReservoirAlertEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.LOW_RESERVOIR_ALERT_ENABLED, true); boolean lowReservoirAlertEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.LOW_RESERVOIR_ALERT_ENABLED, true);
return lowReservoirAlertEnabled ? sp.getInt(OmnipodStorageKeys.Preferences.LOW_RESERVOIR_ALERT_UNITS, 20) : null; return lowReservoirAlertEnabled ? sp.getInt(OmnipodStorageKeys.Preferences.LOW_RESERVOIR_ALERT_UNITS, OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD) : null;
} }
} }

View file

@ -15,6 +15,9 @@
<string name="key_omnipod_expiration_reminder_hours_before_shutdown" translatable="false">AAPS.Omnipod.expiration_reminder_hours_before_shutdown</string> <string name="key_omnipod_expiration_reminder_hours_before_shutdown" translatable="false">AAPS.Omnipod.expiration_reminder_hours_before_shutdown</string>
<string name="key_omnipod_low_reservoir_alert_enabled" translatable="false">AAPS.Omnipod.low_reservoir_alert_enabled</string> <string name="key_omnipod_low_reservoir_alert_enabled" translatable="false">AAPS.Omnipod.low_reservoir_alert_enabled</string>
<string name="key_omnipod_low_reservoir_alert_units" translatable="false">AAPS.Omnipod.low_reservoir_alert_units</string> <string name="key_omnipod_low_reservoir_alert_units" translatable="false">AAPS.Omnipod.low_reservoir_alert_units</string>
<string name="key_omnipod_notification_uncertain_tbr_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_tbr_sound_enabled</string>
<string name="key_omnipod_notification_uncertain_smb_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_smb_sound_enabled</string>
<string name="key_omnipod_notification_uncertain_bolus_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_bolus_sound_enabled</string>
<string name="key_omnipod_tbrs_set" translatable="false">AAPS.Omnipod.tbrs_set</string> <string name="key_omnipod_tbrs_set" translatable="false">AAPS.Omnipod.tbrs_set</string>
<string name="key_omnipod_std_boluses_delivered" translatable="false">AAPS.Omnipod.std_boluses_delivered</string> <string name="key_omnipod_std_boluses_delivered" translatable="false">AAPS.Omnipod.std_boluses_delivered</string>
<string name="key_omnipod_smb_boluses_delivered" translatable="false">AAPS.Omnipod.smb_boluses_delivered</string> <string name="key_omnipod_smb_boluses_delivered" translatable="false">AAPS.Omnipod.smb_boluses_delivered</string>
@ -42,10 +45,14 @@
<string name="omnipod_config_expiration_reminder_hours_before_shutdown">Hours before shutdown</string> <string name="omnipod_config_expiration_reminder_hours_before_shutdown">Hours before shutdown</string>
<string name="omnipod_config_low_reservoir_alert_enabled">Low reservoir alert enabled</string> <string name="omnipod_config_low_reservoir_alert_enabled">Low reservoir alert enabled</string>
<string name="omnipod_config_low_reservoir_alert_units">Number of units</string> <string name="omnipod_config_low_reservoir_alert_units">Number of units</string>
<string name="omnipod_config_notification_uncertain_tbr_sound_enabled">Sound for uncertain TBR notifications enabled</string>
<string name="omnipod_config_notification_uncertain_smb_sound_enabled">Sound for uncertain SMB notifications enabled</string>
<string name="omnipod_config_notification_uncertain_bolus_sound_enabled">Sound for uncertain bolus notifications enabled</string>
<string name="omnipod_preference_category_rileylink">RileyLink</string> <string name="omnipod_preference_category_rileylink">RileyLink</string>
<string name="omnipod_preference_category_other">Other</string> <string name="omnipod_preference_category_other">Other</string>
<string name="omnipod_preference_category_alerts">Alerts</string> <string name="omnipod_preference_category_alerts">Alerts</string>
<string name="omnipod_preference_category_confirmation_beeps">Confirmation beeps</string> <string name="omnipod_preference_category_confirmation_beeps">Confirmation beeps</string>
<string name="omnipod_preference_category_notifications">Notifications</string>
<!-- Omnipod - Pod Status --> <!-- Omnipod - Pod Status -->
<string name="omnipod_pod_status_no_active_pod">No active Pod</string> <string name="omnipod_pod_status_no_active_pod">No active Pod</string>
@ -105,6 +112,7 @@
<string name="omnipod_error_cancel_temp_basal_failed_uncertain">Cancelling temp basal might have failed. Please manually refresh the Pod status from the Omnipod tab.</string> <string name="omnipod_error_cancel_temp_basal_failed_uncertain">Cancelling temp basal might have failed. Please manually refresh the Pod status from the Omnipod tab.</string>
<string name="omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled">Setting temp basal failed. If a temp basal was previously running, it might have been cancelled. Please manually refresh the Pod status from the Omnipod tab.</string> <string name="omnipod_error_set_temp_basal_failed_old_tbr_might_be_cancelled">Setting temp basal failed. If a temp basal was previously running, it might have been cancelled. Please manually refresh the Pod status from the Omnipod tab.</string>
<string name="omnipod_error_set_temp_basal_failed_old_tbr_cancelled_new_might_have_failed">Setting temp might have basal failed. If a temp basal was previously running, it has been cancelled. Please manually refresh the Pod status from the Omnipod tab.</string> <string name="omnipod_error_set_temp_basal_failed_old_tbr_cancelled_new_might_have_failed">Setting temp might have basal failed. If a temp basal was previously running, it has been cancelled. Please manually refresh the Pod status from the Omnipod tab.</string>
<string name="omnipod_error_set_temp_basal_failed_validation">TBR duration must be greater than zero and a multiple of %1$s minutes.</string>
<string name="omnipod_error_set_time_failed_delivery_might_be_suspended">Setting time might have failed. Delivery might be suspended! Please manually refresh the Pod status from the Omnipod tab and resume delivery if needed.</string> <string name="omnipod_error_set_time_failed_delivery_might_be_suspended">Setting time might have failed. Delivery might be suspended! Please manually refresh the Pod status from the Omnipod tab and resume delivery if needed.</string>
<string name="omnipod_error_set_time_failed_delivery_suspended">Setting time failed. Delivery is suspended! Please manually resume delivery from the Omnipod tab.</string> <string name="omnipod_error_set_time_failed_delivery_suspended">Setting time failed. Delivery is suspended! Please manually resume delivery from the Omnipod tab.</string>
<string name="omnipod_error_failed_to_set_profile_empty_profile">Failed to set basal profile: received an empty profile. Make sure to activate your basal profile.</string> <string name="omnipod_error_failed_to_set_profile_empty_profile">Failed to set basal profile: received an empty profile. Make sure to activate your basal profile.</string>

View file

@ -74,6 +74,25 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/omnipod_preference_category_notifications">
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_notification_uncertain_tbr_sound_enabled"
android:title="@string/omnipod_config_notification_uncertain_tbr_sound_enabled" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_notification_uncertain_smb_sound_enabled"
android:title="@string/omnipod_config_notification_uncertain_smb_sound_enabled" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_notification_uncertain_bolus_sound_enabled"
android:title="@string/omnipod_config_notification_uncertain_bolus_sound_enabled" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/omnipod_preference_category_other"> <PreferenceCategory android:title="@string/omnipod_preference_category_other">
<SwitchPreference <SwitchPreference

View file

@ -89,7 +89,7 @@ public class OmnipodPumpPluginTest {
PumpEnactResult result2 = plugin.setTempBasalPercent(5000, 30000, profile, false); PumpEnactResult result2 = plugin.setTempBasalPercent(5000, 30000, profile, false);
PumpEnactResult result3 = plugin.setTempBasalPercent(0, 30, profile, false); PumpEnactResult result3 = plugin.setTempBasalPercent(0, 30, profile, false);
PumpEnactResult result4 = plugin.setTempBasalPercent(0, 0, profile, false); PumpEnactResult result4 = plugin.setTempBasalPercent(0, 0, profile, false);
PumpEnactResult result5 = plugin.setTempBasalPercent(-50, -1, profile, false); PumpEnactResult result5 = plugin.setTempBasalPercent(-50, 60, profile, false);
// Then return correct values // Then return correct values
assertEquals(result1.absolute, 0.4d, 0.01d); assertEquals(result1.absolute, 0.4d, 0.01d);
assertEquals(result1.duration, 30); assertEquals(result1.duration, 30);
@ -97,22 +97,22 @@ public class OmnipodPumpPluginTest {
assertEquals(result2.duration, 30000); assertEquals(result2.duration, 30000);
assertEquals(result3.absolute, 0d, 0.01d); assertEquals(result3.absolute, 0d, 0.01d);
assertEquals(result3.duration, 30); assertEquals(result3.duration, 30);
assertEquals(result4.absolute, 0d, 0.01d); assertEquals(result4.absolute, -1d, 0.01d);
assertEquals(result4.duration, 0); assertEquals(result4.duration, -1);
// this is validated downstream, see TempBasalExtraCommand // this is validated downstream, see TempBasalExtraCommand
assertEquals(result5.absolute, -0.25d, 0.01d); assertEquals(result5.absolute, -0.25d, 0.01d);
assertEquals(result5.duration, -1); assertEquals(result5.duration, 60);
// Given zero basal // Given zero basal
when(profile.getBasal()).thenReturn(0d); when(profile.getBasal()).thenReturn(0d);
// When // When
result1 = plugin.setTempBasalPercent(8000, 10, profile, false); result1 = plugin.setTempBasalPercent(8000, 90, profile, false);
result2 = plugin.setTempBasalPercent(0, 00, profile, false); result2 = plugin.setTempBasalPercent(0, 0, profile, false);
// Then return zero values // Then return zero values
assertEquals(result1.absolute, 0d, 0.01d); assertEquals(result1.absolute, 0d, 0.01d);
assertEquals(result1.duration, 10); assertEquals(result1.duration, 90);
assertEquals(result2.absolute, 0d, 0.01d); assertEquals(result2.absolute, -1d, 0.01d);
assertEquals(result2.duration, 0); assertEquals(result2.duration, -1);
// Given unhealthy basal // Given unhealthy basal
when(profile.getBasal()).thenReturn(500d); when(profile.getBasal()).thenReturn(500d);
@ -125,18 +125,18 @@ public class OmnipodPumpPluginTest {
// Given weird basal // Given weird basal
when(profile.getBasal()).thenReturn(1.234567d); when(profile.getBasal()).thenReturn(1.234567d);
// When treatment // When treatment
result1 = plugin.setTempBasalPercent(280, 500, profile, false); result1 = plugin.setTempBasalPercent(280, 600, profile, false);
// Then return sane values // Then return sane values
assertEquals(result1.absolute, 3.4567876, 0.01d); assertEquals(result1.absolute, 3.4567876, 0.01d);
assertEquals(result1.duration, 500); assertEquals(result1.duration, 600);
// Given negative basal // Given negative basal
when(profile.getBasal()).thenReturn(-1.234567d); when(profile.getBasal()).thenReturn(-1.234567d);
// When treatment // When treatment
result1 = plugin.setTempBasalPercent(280, 500, profile, false); result1 = plugin.setTempBasalPercent(280, 510, profile, false);
// Then return negative value (this is validated further downstream, see TempBasalExtraCommand) // Then return negative value (this is validated further downstream, see TempBasalExtraCommand)
assertEquals(result1.absolute, -3.4567876, 0.01d); assertEquals(result1.absolute, -3.4567876, 0.01d);
assertEquals(result1.duration, 500); assertEquals(result1.duration, 510);
} }
} }