Merge pull request #69 from AAPS-Omnipod/omnipod_eros_dev_upstream_merge

Latest Omnipod updates & enable Omnipod plugin
This commit is contained in:
Milos Kozak 2020-11-17 10:06:31 +01:00 committed by GitHub
commit 15247b5fd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 202 additions and 53 deletions

View file

@ -42,6 +42,7 @@ import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
@ -155,6 +156,12 @@ abstract class PluginsModule {
@IntKey(150) @IntKey(150)
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
@Binds
@PumpDriver
@IntoMap
@IntKey(155)
abstract fun bindOmnipodPumpPlugin(plugin: OmnipodPumpPlugin): PluginBase
@Binds @Binds
@NotNSClient @NotNSClient
@IntoMap @IntoMap

View file

@ -73,6 +73,7 @@ public class Notification {
public static final int CARBS_REQUIRED = 60; public static final int CARBS_REQUIRED = 60;
public static final int OMNIPOD_POD_SUSPENDED = 61; public static final int OMNIPOD_POD_SUSPENDED = 61;
public static final int OMNIPOD_POD_ALERTS_UPDATED = 62; public static final int OMNIPOD_POD_ALERTS_UPDATED = 62;
public static final int OMNIPOD_POD_ALERTS = 63;
public static final int IMPORTANCE_HIGH = 2; public static final int IMPORTANCE_HIGH = 2;

View file

@ -18,13 +18,6 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
// OMNIPOD: for usage in Firebase event during testing phase
buildConfigField "String", "VERSION", '"2.7-omnipod-0.4.1-SNAPSHOT"'
// OMNIPOD: Keep track of what commit from the main repository we're on, these fields aren't actually used anywhere
buildConfigField "String", "DEV_VERSION", '"2.7.0-rc4"'
buildConfigField "String", "DEV_VERSION_COMMIT", '"7d5dc54656c961660451c4fa4c6ea66bd83a1c46"'
buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"21.8.2020"' // 21st of August
} }
kotlinOptions { kotlinOptions {

View file

@ -4,11 +4,11 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -52,6 +52,7 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.common.ManufacturerType; import info.nightscout.androidaps.plugins.common.ManufacturerType;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
@ -74,12 +75,15 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.acti
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog; import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress; import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration; import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus; import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager; import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.TimeUtil; import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.TimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodActiveAlertsChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodFaultEventChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodTbrChanged; import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodTbrChanged;
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.CommandAcknowledgeAlerts;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandHandleTimeChange; import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandHandleTimeChange;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandUpdateAlertConfiguration; import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandUpdateAlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.OmnipodCustomCommand; import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.OmnipodCustomCommand;
@ -88,6 +92,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.service.RileyLi
import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodOverviewFragment; import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodOverviewFragment;
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.plugins.pump.omnipod.util.OmnipodAlertUtil;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.queue.commands.CustomCommand; import info.nightscout.androidaps.queue.commands.CustomCommand;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
@ -135,6 +140,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private final List<CustomAction> customActions = Collections.singletonList(new CustomAction( private final List<CustomAction> customActions = Collections.singletonList(new CustomAction(
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION, true)); R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION, true));
private final CompositeDisposable disposables = new CompositeDisposable(); private final CompositeDisposable disposables = new CompositeDisposable();
private final NSUpload nsUpload;
// variables for handling statuses and history // variables for handling statuses and history
private boolean firstRun = true; private boolean firstRun = true;
@ -169,7 +175,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
AapsOmnipodUtil aapsOmnipodUtil, AapsOmnipodUtil aapsOmnipodUtil,
RileyLinkUtil rileyLinkUtil, RileyLinkUtil rileyLinkUtil,
OmnipodAlertUtil omnipodAlertUtil, OmnipodAlertUtil omnipodAlertUtil,
ProfileFunction profileFunction ProfileFunction profileFunction,
NSUpload nsUpload
) { ) {
super(new PluginDescription() // super(new PluginDescription() //
.mainType(PluginType.PUMP) // .mainType(PluginType.PUMP) //
@ -195,6 +202,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
this.rileyLinkUtil = rileyLinkUtil; this.rileyLinkUtil = rileyLinkUtil;
this.omnipodAlertUtil = omnipodAlertUtil; this.omnipodAlertUtil = omnipodAlertUtil;
this.profileFunction = profileFunction; this.profileFunction = profileFunction;
this.nsUpload = nsUpload;
pumpDescription = new PumpDescription(pumpType); pumpDescription = new PumpDescription(pumpType);
@ -241,6 +249,11 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null); getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null);
} }
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && podStateManager.isPodActivationCompleted() && !podStateManager.isPodDead() &&
podStateManager.getActiveAlerts().size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
queueAcknowledgeAlertsCommand();
}
doPodCheck(); doPodCheck();
loopHandler.postDelayed(this, STATUS_CHECK_INTERVAL_MILLIS); loopHandler.postDelayed(this, STATUS_CHECK_INTERVAL_MILLIS);
@ -258,13 +271,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
// When PodStateManager is created, which causes an IllegalArgumentException for DateTimeZones not being recognized // When PodStateManager is created, which causes an IllegalArgumentException for DateTimeZones not being recognized
podStateManager.loadPodState(); podStateManager.loadPodState();
// BS @ 2020-10-17 FIXME: for backwards compatibility; remove before release
if (podStateManager.isPodInitialized() &&
podStateManager.getActivationProgress() == ActivationProgress.NONE &&
podStateManager.getPodProgressStatus().isAtLeast(PodProgressStatus.ABOVE_FIFTY_UNITS)) {
podStateManager.setActivationProgress(ActivationProgress.COMPLETED);
}
lastConnectionTimeMillis = sp.getLong( lastConnectionTimeMillis = sp.getLong(
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L); RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
@ -281,6 +287,16 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.subscribe(event -> updateAapsTbr(), fabricPrivacy::logException) .subscribe(event -> updateAapsTbr(), fabricPrivacy::logException)
); );
disposables.add(rxBus
.toObservable(EventOmnipodActiveAlertsChanged.class)
.observeOn(Schedulers.io())
.subscribe(event -> handleActivePodAlerts(), fabricPrivacy::logException)
);
disposables.add(rxBus
.toObservable(EventOmnipodFaultEventChanged.class)
.observeOn(Schedulers.io())
.subscribe(event -> handlePodFaultEvent(), fabricPrivacy::logException)
);
disposables.add(rxBus disposables.add(rxBus
.toObservable(EventPreferenceChange.class) .toObservable(EventPreferenceChange.class)
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
@ -294,7 +310,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
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_tbr_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_smb_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)) { event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_bolus_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_automatically_acknowledge_alerts_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) ||
@ -347,6 +364,30 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
} }
} }
private void handleActivePodAlerts() {
if (podStateManager.isPodActivationCompleted() && !podStateManager.isPodDead()) {
AlertSet activeAlerts = podStateManager.getActiveAlerts();
if (activeAlerts.size() > 0) {
String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager));
String notificationText = resourceHelper.gq(R.plurals.omnipod_pod_alerts, activeAlerts.size(), alerts);
Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, notificationText, Notification.URGENT);
rxBus.send(new EventNewNotification(notification));
nsUpload.uploadError(notificationText);
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
queueAcknowledgeAlertsCommand();
}
}
}
}
private void handlePodFaultEvent() {
if (podStateManager.isPodFaulted()) {
String notificationText = resourceHelper.gs(R.string.omnipod_pod_status_pod_fault_description, podStateManager.getFaultEventCode().getValue(), podStateManager.getFaultEventCode().name());
nsUpload.uploadError(notificationText);
}
}
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
@ -359,6 +400,16 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
disposables.clear(); disposables.clear();
} }
private void queueAcknowledgeAlertsCommand() {
getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() {
@Override public void run() {
if (result != null) {
aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment);
}
}
});
}
private void doPodCheck() { private void doPodCheck() {
if (System.currentTimeMillis() > this.nextPodCheck) { if (System.currentTimeMillis() > this.nextPodCheck) {
if (!podStateManager.isPodRunning()) { if (!podStateManager.isPodRunning()) {
@ -484,7 +535,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
// When we activate a new Pod, we just use ProfileFunction to set the currently active profile // When we activate a new Pod, we just use ProfileFunction to set the currently active profile
return true; return true;
} }
return podStateManager.getBasalSchedule().equals(AapsOmnipodManager.mapProfileToBasalSchedule(profile)); return Objects.equals(podStateManager.getBasalSchedule(), AapsOmnipodManager.mapProfileToBasalSchedule(profile));
} }
@Override @Override
@ -545,6 +596,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
// if enforceNew is true, current temp basal is cancelled and new TBR set (duration is prolonged), // if enforceNew is true, current temp basal is cancelled and new TBR set (duration is prolonged),
// if false and the same rate is requested enacted=false and success=true is returned and TBR is not changed // if false and the same rate is requested enacted=false and success=true is returned and TBR is not changed
@Override @Override
@NonNull
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer
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);
@ -580,6 +632,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
} }
@Override @Override
@NonNull
public PumpEnactResult cancelTempBasal(boolean enforceNew) { public PumpEnactResult cancelTempBasal(boolean enforceNew) {
TemporaryBasal tbrCurrent = readTBR(); TemporaryBasal tbrCurrent = readTBR();
@ -648,7 +701,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
return pump; return pump;
} }
@Override public ManufacturerType manufacturer() { @Override @NonNull public ManufacturerType manufacturer() {
return pumpType.getManufacturer(); return pumpType.getManufacturer();
} }
@ -706,14 +759,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
public void executeCustomAction(CustomActionType customActionType) { public void executeCustomAction(CustomActionType customActionType) {
OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType; OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType;
switch (mcat) { if (mcat == OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION) {
case RESET_RILEY_LINK_CONFIGURATION:
serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector())); serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector()));
break; } else {
default:
aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + mcat); aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + mcat);
break;
} }
} }
@ -857,7 +906,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
@Override @Override
public boolean isUnreachableAlertTimeoutExceeded(long unreachableTimeoutMilliseconds) { public boolean isUnreachableAlertTimeoutExceeded(long unreachableTimeoutMilliseconds) {
// We have a separate notification for when no Pod is active, see doPodCheck() // We have a separate notification for when no Pod is active, see doPodCheck()
if (podStateManager.isPodActivationCompleted() && podStateManager.getLastSuccessfulCommunication() != null) { // Null check for backwards compatibility if (podStateManager.isPodActivationCompleted() && podStateManager.getLastSuccessfulCommunication() != null) {
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
if (podStateManager.getLastSuccessfulCommunication().getMillis() + unreachableTimeoutMilliseconds < currentTimeMillis) { if (podStateManager.getLastSuccessfulCommunication().getMillis() + unreachableTimeoutMilliseconds < currentTimeMillis) {
@ -952,10 +1001,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
aapsLogger.debug(LTag.PUMP, "Not retrieving Pod status on startup: no Pod running"); aapsLogger.debug(LTag.PUMP, "Not retrieving Pod status on startup: no Pod running");
} }
Bundle params = new Bundle(); fabricPrivacy.logCustom("OmnipodPumpInit");
params.putString("version", BuildConfig.VERSION);
fabricPrivacy.logCustom("OmnipodPumpInit", params);
} }
@NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) { @NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {

View file

@ -25,6 +25,7 @@ import javax.inject.Provider
abstract class OmnipodWizardModule { abstract class OmnipodWizardModule {
companion object { companion object {
@Provides @Provides
@OmnipodPluginQualifier @OmnipodPluginQualifier
fun providesViewModelFactory(@OmnipodPluginQualifier viewModels: MutableMap<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>): ViewModelProvider.Factory { fun providesViewModelFactory(@OmnipodPluginQualifier viewModels: MutableMap<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>): ViewModelProvider.Factory {

View file

@ -20,6 +20,7 @@ public class OmnipodStorageKeys {
public static final int NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_tbr_sound_enabled; 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_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 final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled;
public static final int AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED = R.string.key_omnipod_automatically_acknowledge_alerts_enabled;
} }
public static class Statistics { public static class Statistics {

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
public class AlertSet { public class AlertSet {
private final List<AlertSlot> alertSlots; private final List<AlertSlot> alertSlots;
@ -39,6 +40,17 @@ public class AlertSet {
return value; return value;
} }
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AlertSet alertSet = (AlertSet) o;
return alertSlots.equals(alertSet.alertSlots);
}
@Override public int hashCode() {
return Objects.hash(alertSlots);
}
@Override @Override
public String toString() { public String toString() {
return "AlertSet{" + return "AlertSet{" +

View file

@ -50,7 +50,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodFault
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodProgressStatusVerificationFailedException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodProgressStatusVerificationFailedException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PrecedingCommandFailedUncertainlyException; import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PrecedingCommandFailedUncertainlyException;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager; import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.Completable; import io.reactivex.Completable;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.Single; import io.reactivex.Single;
@ -62,17 +61,16 @@ public class OmnipodManager {
private static final int ACTION_VERIFICATION_TRIES = 1; private static final int ACTION_VERIFICATION_TRIES = 1;
private final OmnipodRileyLinkCommunicationManager communicationService; private final OmnipodRileyLinkCommunicationManager communicationService;
private PodStateManager podStateManager; private final PodStateManager podStateManager;
private ActiveBolusData activeBolusData; private ActiveBolusData activeBolusData;
private SingleSubject<Boolean> bolusCommandExecutionSubject; private SingleSubject<Boolean> bolusCommandExecutionSubject;
private final Object bolusDataMutex = new Object(); private final Object bolusDataMutex = new Object();
private AAPSLogger aapsLogger; private final AAPSLogger aapsLogger;
public OmnipodManager(AAPSLogger aapsLogger, public OmnipodManager(AAPSLogger aapsLogger,
SP sp,
OmnipodRileyLinkCommunicationManager communicationService, OmnipodRileyLinkCommunicationManager communicationService,
PodStateManager podStateManager) { PodStateManager podStateManager) {
if (communicationService == null) { if (communicationService == null) {

View file

@ -238,15 +238,6 @@ public abstract class PodStateManager {
return getSafe(() -> podState.getLastUpdatedFromResponse()); return getSafe(() -> podState.getLastUpdatedFromResponse());
} }
/**
* @return true if the Pod State contains a fault event. Is the Pod state does not contain
* a fault event, this does NOT necessarily mean that the Pod is not faulted. For a reliable
* indication on whether or not the pod is faulted, see {@link #isPodFaulted() isPodFaulted()}
*/
public final boolean isFaulted() {
return podState != null && podState.getFaultEventCode() != null;
}
public final FaultEventCode getFaultEventCode() { public final FaultEventCode getFaultEventCode() {
return getSafe(() -> podState.getFaultEventCode()); return getSafe(() -> podState.getFaultEventCode());
} }
@ -537,7 +528,10 @@ public abstract class PodStateManager {
podState.setActivatedAt(activatedAtCalculated); podState.setActivatedAt(activatedAtCalculated);
} }
podState.setSuspended(status.getDeliveryStatus() == DeliveryStatus.SUSPENDED); podState.setSuspended(status.getDeliveryStatus() == DeliveryStatus.SUSPENDED);
if (!Objects.equals(status.getUnacknowledgedAlerts(), podState.getActiveAlerts())) {
podState.setActiveAlerts(status.getUnacknowledgedAlerts()); podState.setActiveAlerts(status.getUnacknowledgedAlerts());
onActiveAlertsChanged();
}
podState.setLastDeliveryStatus(status.getDeliveryStatus()); podState.setLastDeliveryStatus(status.getDeliveryStatus());
podState.setReservoirLevel(status.getReservoirLevel()); podState.setReservoirLevel(status.getReservoirLevel());
podState.setTotalTicksDelivered(status.getTicksDelivered()); podState.setTotalTicksDelivered(status.getTicksDelivered());
@ -556,7 +550,10 @@ public abstract class PodStateManager {
if (status instanceof PodInfoDetailedStatus) { if (status instanceof PodInfoDetailedStatus) {
PodInfoDetailedStatus detailedStatus = (PodInfoDetailedStatus) status; PodInfoDetailedStatus detailedStatus = (PodInfoDetailedStatus) status;
if (detailedStatus.isFaulted()) { if (detailedStatus.isFaulted()) {
if (!Objects.equals(podState.getFaultEventCode(), detailedStatus.getFaultEventCode())) {
podState.setFaultEventCode(detailedStatus.getFaultEventCode()); podState.setFaultEventCode(detailedStatus.getFaultEventCode());
onFaultEventChanged();
}
} }
} }
}); });
@ -567,6 +564,16 @@ public abstract class PodStateManager {
// Can be overridden in subclasses // Can be overridden in subclasses
} }
protected void onActiveAlertsChanged() {
// Deliberately left empty
// Can be overridden in subclasses
}
protected void onFaultEventChanged() {
// Deliberately left empty
// Can be overridden in subclasses
}
private void setAndStore(Runnable runnable) { private void setAndStore(Runnable runnable) {
setSafe(runnable); setSafe(runnable);
storePodState(); storePodState();

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.event
import info.nightscout.androidaps.events.Event
/**
* Created by andy on 04.06.2018.
*/
class EventOmnipodActiveAlertsChanged : Event()

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.event
import info.nightscout.androidaps.events.Event
/**
* Created by andy on 04.06.2018.
*/
class EventOmnipodFaultEventChanged : Event()

View file

@ -113,6 +113,7 @@ public class AapsOmnipodManager {
private boolean notificationUncertainTbrSoundEnabled; private boolean notificationUncertainTbrSoundEnabled;
private boolean notificationUncertainSmbSoundEnabled; private boolean notificationUncertainSmbSoundEnabled;
private boolean notificationUncertainBolusSoundEnabled; private boolean notificationUncertainBolusSoundEnabled;
private boolean automaticallyAcknowledgeAlertsEnabled;
@Inject @Inject
public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService, public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService,
@ -142,7 +143,7 @@ public class AapsOmnipodManager {
this.nsUpload = nsUpload; this.nsUpload = nsUpload;
this.profileFunction = profileFunction; this.profileFunction = profileFunction;
delegate = new OmnipodManager(aapsLogger, sp, communicationService, podStateManager); delegate = new OmnipodManager(aapsLogger, communicationService, podStateManager);
reloadSettings(); reloadSettings();
} }
@ -158,6 +159,7 @@ public class AapsOmnipodManager {
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true); notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true);
notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_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); notificationUncertainBolusSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED, true);
automaticallyAcknowledgeAlertsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED, false);
} }
public PumpEnactResult initializePod() { public PumpEnactResult initializePod() {
@ -627,6 +629,10 @@ public class AapsOmnipodManager {
return notificationUncertainBolusSoundEnabled; return notificationUncertainBolusSoundEnabled;
} }
public boolean isAutomaticallyAcknowledgeAlertsEnabled() {
return automaticallyAcknowledgeAlertsEnabled;
}
public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) { public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) {
DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy(); DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy();

View file

@ -7,6 +7,8 @@ import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
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.manager.PodStateManager; import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodActiveAlertsChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodFaultEventChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodTbrChanged; import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodTbrChanged;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
@ -35,4 +37,12 @@ public class AapsPodStateManager extends PodStateManager {
@Override protected void onTbrChanged() { @Override protected void onTbrChanged() {
rxBus.send(new EventOmnipodTbrChanged()); rxBus.send(new EventOmnipodTbrChanged());
} }
@Override protected void onActiveAlertsChanged() {
rxBus.send(new EventOmnipodActiveAlertsChanged());
}
@Override protected void onFaultEventChanged() {
rxBus.send(new EventOmnipodFaultEventChanged());
}
} }

View file

@ -275,7 +275,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
}) })
} }
if (podStateManager.isFaulted) { if (podStateManager.isPodFaulted) {
val faultEventCode = podStateManager.faultEventCode val faultEventCode = podStateManager.faultEventCode
errors.add(resourceHelper.gs(R.string.omnipod_pod_status_pod_fault_description, faultEventCode.value, faultEventCode.name)) errors.add(resourceHelper.gs(R.string.omnipod_pod_status_pod_fault_description, faultEventCode.value, faultEventCode.name))
} }
@ -474,7 +474,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
} }
private fun updateAcknowledgeAlertsButton() { private fun updateAcknowledgeAlertsButton() {
if (podStateManager.isPodRunning && (podStateManager.hasActiveAlerts() || commandQueue.isCustomCommandInQueue(CommandAcknowledgeAlerts::class.java))) { if (!omnipodManager.isAutomaticallyAcknowledgeAlertsEnabled && podStateManager.isPodRunning && (podStateManager.hasActiveAlerts() || commandQueue.isCustomCommandInQueue(CommandAcknowledgeAlerts::class.java))) {
omnipod_overview_button_acknowledge_active_alerts.visibility = View.VISIBLE omnipod_overview_button_acknowledge_active_alerts.visibility = View.VISIBLE
omnipod_overview_button_acknowledge_active_alerts.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty() omnipod_overview_button_acknowledge_active_alerts.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
} else { } else {

View file

@ -10,6 +10,7 @@ import javax.inject.Inject
class PodActivationWizardActivity : OmnipodWizardActivityBase() { class PodActivationWizardActivity : OmnipodWizardActivityBase() {
companion object { companion object {
const val KEY_START_DESTINATION = "startDestination" const val KEY_START_DESTINATION = "startDestination"
} }

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.* import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
class AttachPodInfoFragment : InfoFragmentBase() { class AttachPodInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_attach_pod_title override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_attach_pod_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class FillPodInfoFragment : InfoFragmentBase() { class FillPodInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_title override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_title

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
import javax.inject.Inject import javax.inject.Inject
class InitializePodActionFragment : PodActivationActionFragmentBase() { class InitializePodActionFragment : PodActivationActionFragmentBase() {
@Inject @Inject
@OmnipodPluginQualifier @OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
import javax.inject.Inject import javax.inject.Inject
class InsertCannulaActionFragment : PodActivationActionFragmentBase() { class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
@Inject @Inject
@OmnipodPluginQualifier @OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodActivatedInfoFragment : InfoFragmentBase() { class PodActivatedInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_pod_activated_title override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_pod_activated_title

View file

@ -11,6 +11,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import javax.inject.Inject import javax.inject.Inject
abstract class PodActivationActionFragmentBase : ActionFragmentBase() { abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
@Inject @Inject
protected lateinit var podStateManager: PodStateManager protected lateinit var podStateManager: PodStateManager

View file

@ -6,5 +6,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
import javax.inject.Inject import javax.inject.Inject
class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager) : ActionViewModelBase() { class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod() override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
} }

View file

@ -7,5 +7,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
import javax.inject.Inject import javax.inject.Inject
class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val profileFunction: ProfileFunction) : ActionViewModelBase() { class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val profileFunction: ProfileFunction) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile()) override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
} }

View file

@ -7,6 +7,7 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.plugins.pump.omnipod.R import info.nightscout.androidaps.plugins.pump.omnipod.R
abstract class OmnipodWizardActivityBase : NoSplashAppCompatActivity() { abstract class OmnipodWizardActivityBase : NoSplashAppCompatActivity() {
override fun onBackPressed() { override fun onBackPressed() {
exitActivityAfterConfirmation() exitActivityAfterConfirmation()
} }

View file

@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.* import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
abstract class ActionFragmentBase : WizardFragmentBase() { abstract class ActionFragmentBase : WizardFragmentBase() {
protected lateinit var viewModel: ActionViewModelBase protected lateinit var viewModel: ActionViewModelBase
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_progress_indication.*
import kotlin.math.roundToInt import kotlin.math.roundToInt
abstract class WizardFragmentBase : DaggerFragment() { abstract class WizardFragmentBase : DaggerFragment() {
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,

View file

@ -5,6 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.activity.OmnipodWizardActivityBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.activity.OmnipodWizardActivityBase
class PodDeactivationWizardActivity : OmnipodWizardActivityBase() { class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View file

@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import javax.inject.Inject import javax.inject.Inject
class DeactivatePodActionFragment : ActionFragmentBase() { class DeactivatePodActionFragment : ActionFragmentBase() {
@Inject @Inject
@OmnipodPluginQualifier @OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class DeactivatePodInfoFragment : InfoFragmentBase() { class DeactivatePodInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_deactivate_pod_title override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_deactivate_pod_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodDeactivatedInfoFragment : InfoFragmentBase() { class PodDeactivatedInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_deactivated_title override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_deactivated_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodDiscardedInfoFragment : InfoFragmentBase() { class PodDiscardedInfoFragment : InfoFragmentBase() {
@StringRes @StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_discarded_title override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_discarded_title

View file

@ -10,6 +10,7 @@ import io.reactivex.subjects.SingleSubject
import javax.inject.Inject import javax.inject.Inject
class DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val commandQueueProvider: CommandQueueProvider) : ActionViewModelBase() { class DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val commandQueueProvider: CommandQueueProvider) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult { override fun doExecuteAction(): PumpEnactResult {
val singleSubject = SingleSubject.create<PumpEnactResult>() val singleSubject = SingleSubject.create<PumpEnactResult>()
commandQueueProvider.customCommand(CommandDeactivatePod(), object : Callback() { commandQueueProvider.customCommand(CommandDeactivatePod(), object : Callback() {

View file

@ -15,6 +15,7 @@
<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_automatically_acknowledge_alerts_enabled" translatable="false">AAPS.Omnipod.automatically_acknowledge_alerts_enabled</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_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_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_notification_uncertain_bolus_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_bolus_sound_enabled</string>
@ -48,6 +49,7 @@
<string name="omnipod_config_notification_uncertain_tbr_sound_enabled">Sound for uncertain TBR notifications enabled</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_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_config_notification_uncertain_bolus_sound_enabled">Sound for uncertain bolus notifications enabled</string>
<string name="omnipod_config_automatically_acknowledge_alerts">Automatically acknowledge Pod alerts</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>
@ -63,7 +65,7 @@
<string name="omnipod_pod_status_pod_fault">Pod fault</string> <string name="omnipod_pod_status_pod_fault">Pod fault</string>
<string name="omnipod_pod_status_activation_time_exceeded">Activation time exceeded</string> <string name="omnipod_pod_status_activation_time_exceeded">Activation time exceeded</string>
<string name="omnipod_pod_status_inactive">Inactive</string> <string name="omnipod_pod_status_inactive">Inactive</string>
<string name="omnipod_pod_status_pod_fault_description">Pod fault: %1$s %2$s</string> <string name="omnipod_pod_status_pod_fault_description">Pod fault: %1$03d %2$s</string>
<!-- Omnipod - Alerts --> <!-- Omnipod - Alerts -->
<string name="omnipod_alert_finish_pairing_reminder">Finish pairing reminder</string> <string name="omnipod_alert_finish_pairing_reminder">Finish pairing reminder</string>
@ -265,5 +267,9 @@
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item> <item quantity="other">%1$d days</item>
</plurals> </plurals>
<plurals name="omnipod_pod_alerts">
<item quantity="one">Pod alert: %1$s</item>
<item quantity="other">Pod alerts: %1$s</item>
</plurals>
</resources> </resources>

View file

@ -72,6 +72,11 @@
validate:minNumber="5" validate:minNumber="5"
validate:testType="numericRange" /> validate:testType="numericRange" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_omnipod_automatically_acknowledge_alerts_enabled"
android:title="@string/omnipod_config_automatically_acknowledge_alerts" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/omnipod_preference_category_notifications"> <PreferenceCategory android:title="@string/omnipod_preference_category_notifications">

View file

@ -60,7 +60,7 @@ public class OmnipodPumpPluginTest {
OmnipodPumpPlugin plugin = new OmnipodPumpPlugin(injector, aapsLogger, rxBusWrapper, null, OmnipodPumpPlugin plugin = new OmnipodPumpPlugin(injector, aapsLogger, rxBusWrapper, null,
resourceHelper, activePluginProvider, null, null, aapsOmnipodManager, commandQueueProvider, resourceHelper, activePluginProvider, null, null, aapsOmnipodManager, commandQueueProvider,
null, null, null, null, null, null, null, null, null, null,
rileyLinkUtil, null, null rileyLinkUtil, null, null, null
); );
when(activePluginProvider.getActiveTreatments().getTempBasalFromHistory(anyLong())).thenReturn(null); when(activePluginProvider.getActiveTreatments().getTempBasalFromHistory(anyLong())).thenReturn(null);
when(rileyLinkUtil.getRileyLinkHistory()).thenReturn(new ArrayList<>()); when(rileyLinkUtil.getRileyLinkHistory()).thenReturn(new ArrayList<>());

View file

@ -0,0 +1,22 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class AlertSetTest {
@Test
public void testEquality() {
AlertSet set1 = new AlertSet(Arrays.asList(AlertSlot.SLOT0, AlertSlot.SLOT1));
AlertSet set2 = new AlertSet(Arrays.asList(AlertSlot.SLOT0, AlertSlot.SLOT1));
AlertSet set3 = new AlertSet(Collections.singletonList(AlertSlot.SLOT1));
assertEquals(set1, set2);
assertNotEquals(set1, set3);
assertNotEquals(set2, set3);
}
}