Add optional Suspend delivery button; fix bug where AAPS tries to set bolus before Pod activation is completed; cleanup preferences & several enums; use String resources for RL History items
This commit is contained in:
parent
28df570a6a
commit
14652ab917
27 changed files with 349 additions and 272 deletions
|
@ -182,7 +182,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
pumpDescription = new PumpDescription(pumpType);
|
||||
|
||||
customActions.add(new CustomAction(
|
||||
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true));
|
||||
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION, true));
|
||||
|
||||
this.serviceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
|
@ -252,12 +252,13 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
.toObservable(EventPreferenceChange.class)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(event -> {
|
||||
if ((event.isChanged(getResourceHelper(), R.string.key_omnipod_beep_basal_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_beep_bolus_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_beep_tbr_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_pod_debugging_options_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_beep_smb_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_timechange_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_tbr_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_pulse_log_button_enabled)) ||
|
||||
(event.isChanged(getResourceHelper(), R.string.key_omnipod_time_change_event_enabled)))
|
||||
aapsOmnipodManager.reloadSettings();
|
||||
}, fabricPrivacy::logException)
|
||||
);
|
||||
|
@ -269,8 +270,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
// If so, add it to history
|
||||
// Needs to be done after EventAppInitialized because otherwise, TreatmentsPlugin.onStart() hasn't been called yet
|
||||
// so it didn't initialize a TreatmentService yet, resulting in a NullPointerException
|
||||
if (sp.contains(OmnipodStorageKeys.Prefs.ActiveBolus)) {
|
||||
String activeBolusString = sp.getString(OmnipodStorageKeys.Prefs.ActiveBolus, "");
|
||||
if (sp.contains(OmnipodStorageKeys.Preferences.ACTIVE_BOLUS)) {
|
||||
String activeBolusString = sp.getString(OmnipodStorageKeys.Preferences.ACTIVE_BOLUS, "");
|
||||
aapsLogger.warn(LTag.PUMP, "Found active bolus in SP: {}. Adding Treatment.", activeBolusString);
|
||||
try {
|
||||
ActiveBolus activeBolus = aapsOmnipodUtil.getGsonInstance().fromJson(activeBolusString, ActiveBolus.class);
|
||||
|
@ -278,7 +279,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
} catch (Exception ex) {
|
||||
aapsLogger.error(LTag.PUMP, "Failed to add active bolus to history", ex);
|
||||
}
|
||||
sp.remove(OmnipodStorageKeys.Prefs.ActiveBolus);
|
||||
sp.remove(OmnipodStorageKeys.Preferences.ACTIVE_BOLUS);
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
);
|
||||
|
@ -411,9 +412,9 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
while (iterator.hasNext()) {
|
||||
OmnipodStatusRequestType statusRequest = iterator.next();
|
||||
switch (statusRequest) {
|
||||
case GetPodPulseLog:
|
||||
case GET_PULSE_LOG:
|
||||
try {
|
||||
PodInfoRecentPulseLog result = executeCommand(OmnipodCommandType.GetPodPulseLog, aapsOmnipodManager::readPulseLog);
|
||||
PodInfoRecentPulseLog result = executeCommand(OmnipodCommandType.GET_POD_PULSE_LOG, aapsOmnipodManager::readPulseLog);
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", 0);
|
||||
i.putExtra("status", "Pulse Log (copied to clipboard):\n" + result.toString());
|
||||
|
@ -431,11 +432,14 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
context.startActivity(i);
|
||||
}
|
||||
break;
|
||||
case AcknowledgeAlerts:
|
||||
executeCommand(OmnipodCommandType.AcknowledgeAlerts, aapsOmnipodManager::acknowledgeAlerts);
|
||||
case ACKNOWLEDGE_ALERTS:
|
||||
executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodManager::acknowledgeAlerts);
|
||||
break;
|
||||
case GetPodState:
|
||||
executeCommand(OmnipodCommandType.GetPodStatus, aapsOmnipodManager::getPodStatus);
|
||||
case GET_POD_STATE:
|
||||
executeCommand(OmnipodCommandType.GET_POD_STATUS, aapsOmnipodManager::getPodStatus);
|
||||
break;
|
||||
case SUSPEND_DELIVERY:
|
||||
executeCommand(OmnipodCommandType.SUSPEND_DELIVERY, aapsOmnipodManager::suspendDelivery);
|
||||
break;
|
||||
default:
|
||||
aapsLogger.error(LTag.PUMP, "Unknown status request: " + statusRequest.name());
|
||||
|
@ -443,7 +447,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
iterator.remove();
|
||||
}
|
||||
} else if (this.hasTimeDateOrTimeZoneChanged) {
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SetTime, aapsOmnipodManager::setTime);
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_TIME, aapsOmnipodManager::setTime);
|
||||
|
||||
if (result.success) {
|
||||
this.hasTimeDateOrTimeZoneChanged = false;
|
||||
|
@ -469,7 +473,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
@NotNull
|
||||
@Override
|
||||
public PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SetBasalProfile, () -> aapsOmnipodManager.setBasalProfile(profile));
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodManager.setBasalProfile(profile));
|
||||
|
||||
aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.success);
|
||||
|
||||
|
@ -492,7 +496,9 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
@Override
|
||||
public boolean isThisProfileSet(Profile profile) {
|
||||
if (!podStateManager.isPodActivationCompleted()) {
|
||||
return false;
|
||||
// When no Pod is active, return true here in order to prevent AAPS from setting a profile
|
||||
// When we activate a new Pod, we just use ProfileFunction to set the currently active profile
|
||||
return true;
|
||||
}
|
||||
return podStateManager.getBasalSchedule().equals(AapsOmnipodManager.mapProfileToBasalSchedule(profile));
|
||||
}
|
||||
|
@ -560,7 +566,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
|
||||
@Override
|
||||
public void stopBolusDelivering() {
|
||||
executeCommand(OmnipodCommandType.CancelBolus, aapsOmnipodManager::cancelBolus);
|
||||
executeCommand(OmnipodCommandType.CANCEL_BOLUS, aapsOmnipodManager::cancelBolus);
|
||||
}
|
||||
|
||||
// if enforceNew===true current temp basal is canceled and new TBR set (duration is prolonged),
|
||||
|
@ -586,12 +592,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
}
|
||||
}
|
||||
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SetTemporaryBasal, () -> aapsOmnipodManager.setTemporaryBasal(new TempBasalPair(absoluteRate, false, durationInMinutes)));
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_TEMPORARY_BASAL, () -> aapsOmnipodManager.setTemporaryBasal(new TempBasalPair(absoluteRate, false, durationInMinutes)));
|
||||
|
||||
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute - setTBR. Response: " + result.success);
|
||||
|
||||
if (result.success) {
|
||||
incrementStatistics(OmnipodStorageKeys.Statistics.TBRsSet);
|
||||
incrementStatistics(OmnipodStorageKeys.Statistics.TBRS_SET);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -607,7 +613,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
return new PumpEnactResult(getInjector()).success(true).enacted(false);
|
||||
}
|
||||
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.CancelTemporaryBasal, aapsOmnipodManager::cancelTemporaryBasal);
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.CANCEL_TEMPORARY_BASAL, aapsOmnipodManager::cancelTemporaryBasal);
|
||||
|
||||
if (result.success) {
|
||||
// TODO is this necessary?
|
||||
|
@ -733,7 +739,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType;
|
||||
|
||||
switch (mcat) {
|
||||
case ResetRileyLinkConfiguration:
|
||||
case RESET_RILEY_LINK_CONFIGURATION:
|
||||
serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector()));
|
||||
break;
|
||||
|
||||
|
@ -836,7 +842,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
|
||||
private void initializeAfterRileyLinkConnection() {
|
||||
if (podStateManager.isPodInitialized() && podStateManager.getPodProgressStatus().isAtLeast(PodProgressStatus.PAIRING_COMPLETED)) {
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.GetPodStatus, aapsOmnipodManager::getPodStatus);
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.GET_POD_STATUS, aapsOmnipodManager::getPodStatus);
|
||||
if (result.success) {
|
||||
aapsLogger.debug(LTag.PUMP, "Successfully retrieved Pod status on startup");
|
||||
} else {
|
||||
|
@ -859,11 +865,11 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
}
|
||||
|
||||
@NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SetBolus, () -> aapsOmnipodManager.bolus(detailedBolusInfo));
|
||||
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BOLUS, () -> aapsOmnipodManager.bolus(detailedBolusInfo));
|
||||
|
||||
if (result.success) {
|
||||
incrementStatistics(detailedBolusInfo.isSMB ? OmnipodStorageKeys.Statistics.SMBBoluses
|
||||
: OmnipodStorageKeys.Statistics.StandardBoluses);
|
||||
incrementStatistics(detailedBolusInfo.isSMB ? OmnipodStorageKeys.Statistics.SMB_BOLUSES_DELIVERED
|
||||
: OmnipodStorageKeys.Statistics.STANDARD_BOLUSES_DELIVERED);
|
||||
|
||||
result.carbsDelivered(detailedBolusInfo.carbs);
|
||||
}
|
||||
|
@ -874,7 +880,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private <T> T executeCommand(OmnipodCommandType commandType, Supplier<T> supplier) {
|
||||
aapsLogger.debug(LTag.PUMP, "Executing command: {}", commandType);
|
||||
|
||||
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemOmnipod(commandType));
|
||||
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemOmnipod(getInjector(), commandType));
|
||||
|
||||
T pumpEnactResult = supplier.get();
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.data;
|
|||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
|
||||
|
@ -9,17 +12,19 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|||
|
||||
public class RLHistoryItemOmnipod extends RLHistoryItem {
|
||||
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
private final OmnipodCommandType omnipodCommandType;
|
||||
|
||||
public RLHistoryItemOmnipod(OmnipodCommandType omnipodCommandType) {
|
||||
public RLHistoryItemOmnipod(HasAndroidInjector injector, OmnipodCommandType omnipodCommandType) {
|
||||
super(new LocalDateTime(), RLHistoryItemSource.OmnipodCommand, RileyLinkTargetDevice.Omnipod);
|
||||
injector.androidInjector().inject(this);
|
||||
this.omnipodCommandType = omnipodCommandType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ResourceHelper resourceHelper) {
|
||||
if (RLHistoryItemSource.OmnipodCommand.equals(source)) {
|
||||
return omnipodCommandType.name();
|
||||
return resourceHelper.gs(omnipodCommandType.getResourceId());
|
||||
}
|
||||
return super.getDescription(resourceHelper);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,33 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
||||
|
||||
/**
|
||||
* Created by andy on 4.8.2019
|
||||
*/
|
||||
public enum OmnipodCommandType {
|
||||
PairAndPrimePod, // First step of Pod activation
|
||||
FillCanulaAndSetBasalProfile, // Second step of Pod activation
|
||||
DeactivatePod, //
|
||||
SetBasalProfile, //
|
||||
SetBolus, //
|
||||
CancelBolus, //
|
||||
SetTemporaryBasal, //
|
||||
CancelTemporaryBasal, //
|
||||
ResetPodStatus, //
|
||||
GetPodStatus, //
|
||||
SetTime, //
|
||||
AcknowledgeAlerts, //
|
||||
GetPodPulseLog;
|
||||
PAIR_AND_PRIME_POD(R.string.omnipod_cmd_pair_and_prime), // First step of Pod activation
|
||||
FILL_CANNULA_AND_SET_BASAL_PROFILE(R.string.omnipod_cmd_fill_cannula_set_basal_profile), // Second step of Pod activation
|
||||
DEACTIVATE_POD(R.string.omnipod_cmd_deactivate_pod), //
|
||||
SET_BASAL_PROFILE(R.string.omnipod_cmd_set_basal_schedule), //
|
||||
SET_BOLUS(R.string.omnipod_cmd_set_bolus), //
|
||||
CANCEL_BOLUS(R.string.omnipod_cmd_cancel_bolus), //
|
||||
SET_TEMPORARY_BASAL(R.string.omnipod_cmd_set_tbr), //
|
||||
CANCEL_TEMPORARY_BASAL(R.string.omnipod_cmd_cancel_tbr_by_driver), //
|
||||
DISCARD_POD(R.string.omnipod_cmd_discard_pod), //
|
||||
GET_POD_STATUS(R.string.omnipod_cmd_get_pod_status), //
|
||||
SET_TIME(R.string.omnipod_cmd_set_time), //
|
||||
ACKNOWLEDGE_ALERTS(R.string.omnipod_cmd_acknowledge_alerts), //
|
||||
GET_POD_PULSE_LOG(R.string.omnipod_cmd_get_pulse_log), //
|
||||
SUSPEND_DELIVERY(R.string.omnipod_cmd_suspend_delivery);
|
||||
|
||||
private int resourceId;
|
||||
|
||||
OmnipodCommandType(int resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public int getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
|||
*/
|
||||
|
||||
public enum OmnipodCustomActionType implements CustomActionType {
|
||||
ResetRileyLinkConfiguration;
|
||||
RESET_RILEY_LINK_CONFIGURATION;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
public enum OmnipodStatusRequestType {
|
||||
AcknowledgeAlerts,
|
||||
GetPodState,
|
||||
GetPodPulseLog
|
||||
ACKNOWLEDGE_ALERTS,
|
||||
GET_POD_STATE,
|
||||
GET_PULSE_LOG,
|
||||
SUSPEND_DELIVERY
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@ package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
||||
|
||||
public class OmnipodStorageKeys {
|
||||
private static final String Prefix = "AAPS.Omnipod.";
|
||||
private static final String PREFIX = "AAPS.Omnipod.";
|
||||
|
||||
public static class Prefs {
|
||||
public static final String PodState = Prefix + "pod_state";
|
||||
public static final String ActiveBolus = Prefix + "current_bolus";
|
||||
public static final int BeepBasalEnabled = R.string.key_omnipod_beep_basal_enabled;
|
||||
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
||||
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
||||
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
|
||||
public static final int PodDebuggingOptionsEnabled = R.string.key_omnipod_pod_debugging_options_enabled;
|
||||
public static final int TimeChangeEventEnabled = R.string.key_omnipod_timechange_enabled;
|
||||
public static class Preferences {
|
||||
public static final String POD_STATE = PREFIX + "pod_state";
|
||||
public static final String ACTIVE_BOLUS = PREFIX + "current_bolus";
|
||||
public static final int BASAL_BEEPS_ENABLED = R.string.key_omnipod_basal_beeps_enabled;
|
||||
public static final int BOLUS_BEEPS_ENABLED = R.string.key_omnipod_bolus_beeps_enabled;
|
||||
public static final int SMB_BEEPS_ENABLED = R.string.key_omnipod_smb_beeps_enabled;
|
||||
public static final int TBR_BEEPS_ENABLED = R.string.key_omnipod_tbr_beeps_enabled;
|
||||
public static final int SUSPEND_DELIVERY_BUTTON_ENABLED = R.string.key_omnipod_pulse_log_button_enabled;
|
||||
public static final int PULSE_LOG_BUTTON_ENABLED = R.string.key_omnipod_pulse_log_button_enabled;
|
||||
public static final int TIME_CHANGE_EVENT_ENABLED = R.string.key_omnipod_time_change_event_enabled;
|
||||
}
|
||||
|
||||
public static class Statistics {
|
||||
static final String StatsPrefix = "omnipod_";
|
||||
public static final String TBRsSet = StatsPrefix + "tbrs_set";
|
||||
public static final String StandardBoluses = StatsPrefix + "std_boluses_delivered";
|
||||
public static final String SMBBoluses = StatsPrefix + "smb_boluses_delivered";
|
||||
public static final String TBRS_SET = PREFIX + "tbrs_set";
|
||||
public static final String STANDARD_BOLUSES_DELIVERED = PREFIX + "std_boluses_delivered";
|
||||
public static final String SMB_BOLUSES_DELIVERED = PREFIX + "smb_boluses_delivered";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,31 +13,31 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
|||
*/
|
||||
public enum PodHistoryEntryType {
|
||||
|
||||
PairAndPrime(1, R.string.omnipod_init_pod_wizard_step2_title, PumpHistoryEntryGroup.Prime),
|
||||
FillCannulaSetBasalProfile(2, R.string.omnipod_init_pod_wizard_step4_title, PumpHistoryEntryGroup.Prime),
|
||||
DeactivatePod(3, R.string.omnipod_cmd_deactivate_pod, PumpHistoryEntryGroup.Prime),
|
||||
ResetPodState(4, R.string.omnipod_cmd_reset_pod, PumpHistoryEntryGroup.Prime),
|
||||
PAIR_AND_PRIME(1, R.string.omnipod_init_pod_wizard_step2_title, PumpHistoryEntryGroup.Prime),
|
||||
FILL_CANNULA_SET_BASAL_PROFILE(2, R.string.omnipod_init_pod_wizard_step4_title, PumpHistoryEntryGroup.Prime),
|
||||
DEACTIVATE_POD(3, R.string.omnipod_cmd_deactivate_pod, PumpHistoryEntryGroup.Prime),
|
||||
RESET_POD_STATE(4, R.string.omnipod_cmd_discard_pod, PumpHistoryEntryGroup.Prime),
|
||||
|
||||
SetTemporaryBasal(10, R.string.omnipod_cmd_set_tbr, PumpHistoryEntryGroup.Basal),
|
||||
CancelTemporaryBasal(11, R.string.omnipod_cmd_cancel_tbr, PumpHistoryEntryGroup.Basal),
|
||||
CancelTemporaryBasalForce(12, R.string.omnipod_cmd_cancel_tbr_forced, PumpHistoryEntryGroup.Basal),
|
||||
SET_TEMPORARY_BASAL(10, R.string.omnipod_cmd_set_tbr, PumpHistoryEntryGroup.Basal),
|
||||
CANCEL_TEMPORARY_BASAL_BY_DRIVER(11, R.string.omnipod_cmd_cancel_tbr_by_driver, PumpHistoryEntryGroup.Basal),
|
||||
CANCEL_TEMPORARY_BASAL(12, R.string.omnipod_cmd_cancel_tbr, PumpHistoryEntryGroup.Basal),
|
||||
|
||||
SetBasalSchedule(20, R.string.omnipod_cmd_set_basal_schedule, PumpHistoryEntryGroup.Basal),
|
||||
SET_BASAL_SCHEDULE(20, R.string.omnipod_cmd_set_basal_schedule, PumpHistoryEntryGroup.Basal),
|
||||
|
||||
GetPodStatus(30, R.string.omnipod_cmd_get_pod_status, PumpHistoryEntryGroup.Configuration),
|
||||
GetPodInfo(31, R.string.omnipod_cmd_get_pod_info, PumpHistoryEntryGroup.Configuration),
|
||||
SetTime(32, R.string.omnipod_cmd_set_time, PumpHistoryEntryGroup.Configuration),
|
||||
GET_POD_STATUS(30, R.string.omnipod_cmd_get_pod_status, PumpHistoryEntryGroup.Configuration),
|
||||
GET_POD_INFO(31, R.string.omnipod_cmd_get_pod_info, PumpHistoryEntryGroup.Configuration),
|
||||
SET_TIME(32, R.string.omnipod_cmd_set_time, PumpHistoryEntryGroup.Configuration),
|
||||
|
||||
SetBolus(40, R.string.omnipod_cmd_set_bolus, PumpHistoryEntryGroup.Bolus),
|
||||
CancelBolus(41, R.string.omnipod_cmd_cancel_bolus, PumpHistoryEntryGroup.Bolus),
|
||||
SET_BOLUS(40, R.string.omnipod_cmd_set_bolus, PumpHistoryEntryGroup.Bolus),
|
||||
CANCEL_BOLUS(41, R.string.omnipod_cmd_cancel_bolus, PumpHistoryEntryGroup.Bolus),
|
||||
|
||||
ConfigureAlerts(50, R.string.omnipod_cmd_configure_alerts, PumpHistoryEntryGroup.Alarm),
|
||||
AcknowledgeAlerts(51, R.string.omnipod_cmd_acknowledge_alerts, PumpHistoryEntryGroup.Alarm),
|
||||
CONFIGURE_ALERTS(50, R.string.omnipod_cmd_configure_alerts, PumpHistoryEntryGroup.Alarm),
|
||||
ACKNOWLEDGE_ALERTS(51, R.string.omnipod_cmd_acknowledge_alerts, PumpHistoryEntryGroup.Alarm),
|
||||
|
||||
SuspendDelivery(60, R.string.omnipod_cmd_suspend_delivery, PumpHistoryEntryGroup.Basal),
|
||||
ResumeDelivery(61, R.string.omnipod_cmd_resume_delivery, PumpHistoryEntryGroup.Basal),
|
||||
SUSPEND_DELIVERY(60, R.string.omnipod_cmd_suspend_delivery, PumpHistoryEntryGroup.Basal),
|
||||
RESUME_DELIVERY(61, R.string.omnipod_cmd_resume_delivery, PumpHistoryEntryGroup.Basal),
|
||||
|
||||
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry);
|
||||
UNKNOWN_ENTRY_TYPE(99, R.string.omnipod_cmd_unknown_entry);
|
||||
|
||||
private int code;
|
||||
private static final Map<Integer, PodHistoryEntryType> instanceMap;
|
||||
|
@ -82,7 +82,7 @@ public enum PodHistoryEntryType {
|
|||
if (instanceMap.containsKey(code)) {
|
||||
return instanceMap.get(code);
|
||||
} else {
|
||||
return UnknownEntryType;
|
||||
return UNKNOWN_ENTRY_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
|||
|
||||
public enum PodInitActionType {
|
||||
|
||||
PairAndPrimeWizardStep(), //
|
||||
PairPod(R.string.omnipod_init_pod_pair_pod, PairAndPrimeWizardStep), //
|
||||
PrimePod(R.string.omnipod_init_pod_prime_pod, PairAndPrimeWizardStep), //
|
||||
PAIR_AND_PRIME_WIZARD_STEP(), //
|
||||
PAIR_POD(R.string.omnipod_init_pod_pair_pod, PAIR_AND_PRIME_WIZARD_STEP), //
|
||||
PRIME_POD(R.string.omnipod_init_pod_prime_pod, PAIR_AND_PRIME_WIZARD_STEP), //
|
||||
|
||||
FillCannulaSetBasalProfileWizardStep(), //
|
||||
FillCannula(R.string.omnipod_init_pod_fill_cannula, FillCannulaSetBasalProfileWizardStep), //
|
||||
SetBasalProfile(R.string.omnipod_init_pod_set_basal_profile, FillCannulaSetBasalProfileWizardStep), //
|
||||
FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP(), //
|
||||
FILL_CANNULA(R.string.omnipod_init_pod_fill_cannula, FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP), //
|
||||
SET_BASAL_PROFILE(R.string.omnipod_init_pod_set_basal_profile, FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP), //
|
||||
|
||||
DeactivatePodWizardStep(), //
|
||||
CancelDelivery(R.string.omnipod_deactivate_pod_cancel_delivery, DeactivatePodWizardStep), //
|
||||
DeactivatePod(R.string.omnipod_deactivate_pod_deactivate_pod, DeactivatePodWizardStep);
|
||||
DEACTIVATE_POD_WIZARD_STEP(), //
|
||||
CANCEL_DELIVERY(R.string.omnipod_deactivate_pod_cancel_delivery, DEACTIVATE_POD_WIZARD_STEP), //
|
||||
DEACTIVATE_POD(R.string.omnipod_deactivate_pod_deactivate_pod, DEACTIVATE_POD_WIZARD_STEP);
|
||||
|
||||
private int resourceId;
|
||||
private PodInitActionType parent;
|
||||
|
|
|
@ -468,7 +468,7 @@ public class OmnipodManager {
|
|||
logCommandExecutionFinished("deactivatePod");
|
||||
}
|
||||
|
||||
podStateManager.removeState();
|
||||
podStateManager.discardState();
|
||||
}
|
||||
|
||||
public OmnipodRileyLinkCommunicationManager getCommunicationService() {
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class PodStateManager {
|
|||
this.gsonInstance = createGson();
|
||||
}
|
||||
|
||||
public final void removeState() {
|
||||
public final void discardState() {
|
||||
this.podState = null;
|
||||
storePodState();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ public class AapsOmnipodManager {
|
|||
private boolean bolusBeepsEnabled;
|
||||
private boolean smbBeepsEnabled;
|
||||
private boolean tbrBeepsEnabled;
|
||||
private boolean podDebuggingOptionsEnabled;
|
||||
private boolean suspendDeliveryButtonEnabled;
|
||||
private boolean pulseLogButtonEnabled;
|
||||
private boolean timeChangeEventEnabled;
|
||||
|
||||
@Inject
|
||||
|
@ -135,16 +136,17 @@ public class AapsOmnipodManager {
|
|||
}
|
||||
|
||||
public void reloadSettings() {
|
||||
basalBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.BeepBasalEnabled, true);
|
||||
bolusBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.BeepBolusEnabled, true);
|
||||
smbBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.BeepSMBEnabled, true);
|
||||
tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.BeepTBREnabled, true);
|
||||
podDebuggingOptionsEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.PodDebuggingOptionsEnabled, false);
|
||||
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Prefs.TimeChangeEventEnabled, true);
|
||||
basalBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.BASAL_BEEPS_ENABLED, true);
|
||||
bolusBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.BOLUS_BEEPS_ENABLED, true);
|
||||
smbBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SMB_BEEPS_ENABLED, true);
|
||||
tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TBR_BEEPS_ENABLED, true);
|
||||
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
|
||||
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false);
|
||||
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
|
||||
}
|
||||
|
||||
public PumpEnactResult pairAndPrime(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) {
|
||||
if (podInitActionType != PodInitActionType.PairAndPrimeWizardStep) {
|
||||
if (podInitActionType != PodInitActionType.PAIR_AND_PRIME_WIZARD_STEP) {
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_illegal_init_action_type, podInitActionType.name()));
|
||||
}
|
||||
|
||||
|
@ -158,13 +160,13 @@ public class AapsOmnipodManager {
|
|||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
podInitReceiver.returnInitTaskStatus(podInitActionType, false, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.PairAndPrime, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.PAIR_AND_PRIME, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
}
|
||||
|
||||
public PumpEnactResult setInitialBasalScheduleAndInsertCannula(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||
if (podInitActionType != PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
||||
if (podInitActionType != PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP) {
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_illegal_init_action_type, podInitActionType.name()));
|
||||
}
|
||||
|
||||
|
@ -186,7 +188,7 @@ public class AapsOmnipodManager {
|
|||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
podInitReceiver.returnInitTaskStatus(podInitActionType, false, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.FillCannulaSetBasalProfile, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.FILL_CANNULA_SET_BASAL_PROFILE, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
}
|
||||
|
@ -195,11 +197,11 @@ public class AapsOmnipodManager {
|
|||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
StatusResponse statusResponse = delegate.getPodStatus();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.GetPodStatus, statusResponse);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.GET_POD_STATUS, statusResponse);
|
||||
return new PumpEnactResult(injector).success(true).enacted(false);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.GetPodStatus, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.GET_POD_STATUS, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
}
|
||||
|
@ -210,16 +212,16 @@ public class AapsOmnipodManager {
|
|||
delegate.deactivatePod();
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, false, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.DeactivatePod, comment);
|
||||
podInitReceiver.returnInitTaskStatus(PodInitActionType.DEACTIVATE_POD_WIZARD_STEP, false, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.DEACTIVATE_POD, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.DeactivatePod, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.DEACTIVATE_POD, null);
|
||||
|
||||
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, true, null);
|
||||
podInitReceiver.returnInitTaskStatus(PodInitActionType.DEACTIVATE_POD_WIZARD_STEP, true, null);
|
||||
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
}
|
||||
|
@ -236,28 +238,28 @@ public class AapsOmnipodManager {
|
|||
delegate.setBasalSchedule(basalSchedule, isBasalBeepsEnabled());
|
||||
// Because setting a basal profile actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SetBasalSchedule, profile.getBasalValues());
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SET_BASAL_SCHEDULE, profile.getBasalValues());
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
reportImplicitlyCanceledTbr();
|
||||
addToHistory(time, PodHistoryEntryType.SetBasalSchedule, "Uncertain failure", false);
|
||||
addToHistory(time, PodHistoryEntryType.SET_BASAL_SCHEDULE, "Uncertain failure", false);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_basal_failed_uncertain));
|
||||
}
|
||||
String comment = handleAndTranslateException(ex);
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetBasalSchedule, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.SET_BASAL_SCHEDULE, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
}
|
||||
|
||||
public PumpEnactResult resetPodStatus() {
|
||||
podStateManager.removeState();
|
||||
public PumpEnactResult discardPodState() {
|
||||
podStateManager.discardState();
|
||||
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.ResetPodState, null);
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.RESET_POD_STATE, null);
|
||||
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
}
|
||||
|
@ -280,7 +282,7 @@ public class AapsOmnipodManager {
|
|||
bolusStarted = new Date();
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.SetBolus, comment);
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.SET_BOLUS, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
|
@ -312,7 +314,7 @@ public class AapsOmnipodManager {
|
|||
// I discussed this with the AAPS team but nobody seems to care so we're stuck with this ugly workaround for now
|
||||
try {
|
||||
ActiveBolus activeBolus = ActiveBolus.fromDetailedBolusInfo(detailedBolusInfo);
|
||||
sp.putString(OmnipodStorageKeys.Prefs.ActiveBolus, aapsOmnipodUtil.getGsonInstance().toJson(activeBolus));
|
||||
sp.putString(OmnipodStorageKeys.Preferences.ACTIVE_BOLUS, aapsOmnipodUtil.getGsonInstance().toJson(activeBolus));
|
||||
aapsLogger.debug(LTag.PUMP, "Stored active bolus to SP for recovery");
|
||||
} catch (Exception ex) {
|
||||
aapsLogger.error(LTag.PUMP, "Failed to store active bolus to SP", ex);
|
||||
|
@ -331,7 +333,7 @@ public class AapsOmnipodManager {
|
|||
|
||||
addBolusToHistory(detailedBolusInfo);
|
||||
|
||||
sp.remove(OmnipodStorageKeys.Prefs.ActiveBolus);
|
||||
sp.remove(OmnipodStorageKeys.Preferences.ACTIVE_BOLUS);
|
||||
|
||||
return new PumpEnactResult(injector).success(true).enacted(true).bolusDelivered(detailedBolusInfo.insulin);
|
||||
}
|
||||
|
@ -347,7 +349,7 @@ public class AapsOmnipodManager {
|
|||
} else {
|
||||
aapsLogger.debug(LTag.PUMP, "Not cancelling bolus: bolus command failed");
|
||||
String comment = getStringResource(R.string.omnipod_bolus_did_not_succeed);
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CancelBolus, comment);
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, comment);
|
||||
return new PumpEnactResult(injector).success(true).enacted(false).comment(comment);
|
||||
}
|
||||
}
|
||||
|
@ -358,12 +360,12 @@ public class AapsOmnipodManager {
|
|||
try {
|
||||
delegate.cancelBolus(isBolusBeepsEnabled());
|
||||
aapsLogger.debug(LTag.PUMP, "Successfully cancelled bolus", i);
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CancelBolus, null);
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, null);
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
} catch (PodFaultException ex) {
|
||||
aapsLogger.debug(LTag.PUMP, "Successfully cancelled bolus (implicitly because of a Pod Fault)");
|
||||
showPodFaultErrorDialog(ex.getFaultEvent().getFaultEventCode(), null);
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CancelBolus, null);
|
||||
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, null);
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
} catch (Exception ex) {
|
||||
aapsLogger.debug(LTag.PUMP, "Failed to cancel bolus", ex);
|
||||
|
@ -371,7 +373,7 @@ public class AapsOmnipodManager {
|
|||
}
|
||||
}
|
||||
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CancelBolus, comment);
|
||||
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
|
@ -383,17 +385,17 @@ public class AapsOmnipodManager {
|
|||
time = System.currentTimeMillis();
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
addToHistory(time, PodHistoryEntryType.SetTemporaryBasal, "Uncertain failure", false);
|
||||
addToHistory(time, PodHistoryEntryType.SET_TEMPORARY_BASAL, "Uncertain failure", false);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_temp_basal_failed_uncertain));
|
||||
}
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetTemporaryBasal, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.SET_TEMPORARY_BASAL, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
long pumpId = addSuccessToHistory(time, PodHistoryEntryType.SetTemporaryBasal, tempBasalPair);
|
||||
long pumpId = addSuccessToHistory(time, PodHistoryEntryType.SET_TEMPORARY_BASAL, tempBasalPair);
|
||||
|
||||
TemporaryBasal tempStart = new TemporaryBasal(injector) //
|
||||
.date(time) //
|
||||
|
@ -411,10 +413,10 @@ public class AapsOmnipodManager {
|
|||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
delegate.cancelTemporaryBasal(isTbrBeepsEnabled());
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasalForce, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, null);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CancelTemporaryBasalForce, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
|
@ -425,10 +427,10 @@ public class AapsOmnipodManager {
|
|||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
delegate.acknowledgeAlerts();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.AcknowledgeAlerts, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.ACKNOWLEDGE_ALERTS, null);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.AcknowledgeAlerts, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.ACKNOWLEDGE_ALERTS, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
|
@ -442,11 +444,11 @@ public class AapsOmnipodManager {
|
|||
// because the pod state we keep, doesn't get updated from a PodInfoResponse.
|
||||
// We use StatusResponses for that, which can be obtained from the getPodStatus method
|
||||
PodInfoResponse podInfo = delegate.getPodInfo(podInfoType);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.GetPodInfo, podInfo);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.GET_POD_INFO, podInfo);
|
||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.GetPodInfo, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.GET_POD_INFO, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
}
|
||||
|
@ -480,16 +482,16 @@ public class AapsOmnipodManager {
|
|||
delegate.setTime(isBasalBeepsEnabled());
|
||||
// Because set time actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SetTime, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SET_TIME, null);
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetTime, "Uncertain failure");
|
||||
addFailureToHistory(time, PodHistoryEntryType.SET_TIME, "Uncertain failure");
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_time_failed_uncertain));
|
||||
}
|
||||
String comment = handleAndTranslateException(ex);
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetTime, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.SET_TIME, comment);
|
||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
|
@ -525,8 +527,12 @@ public class AapsOmnipodManager {
|
|||
return tbrBeepsEnabled;
|
||||
}
|
||||
|
||||
public boolean isPodDebuggingOptionsEnabled() {
|
||||
return podDebuggingOptionsEnabled;
|
||||
public boolean isSuspendDeliveryButtonEnabled() {
|
||||
return suspendDeliveryButtonEnabled;
|
||||
}
|
||||
|
||||
public boolean isPulseLogButtonEnabled() {
|
||||
return pulseLogButtonEnabled;
|
||||
}
|
||||
|
||||
public boolean isTimeChangeEventEnabled() {
|
||||
|
@ -534,7 +540,7 @@ public class AapsOmnipodManager {
|
|||
}
|
||||
|
||||
public void addBolusToHistory(DetailedBolusInfo detailedBolusInfo) {
|
||||
long pumpId = addSuccessToHistory(detailedBolusInfo.date, PodHistoryEntryType.SetBolus, detailedBolusInfo.insulin + ";" + detailedBolusInfo.carbs);
|
||||
long pumpId = addSuccessToHistory(detailedBolusInfo.date, PodHistoryEntryType.SET_BOLUS, detailedBolusInfo.insulin + ";" + detailedBolusInfo.carbs);
|
||||
detailedBolusInfo.pumpId = pumpId;
|
||||
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false);
|
||||
}
|
||||
|
@ -547,7 +553,7 @@ public class AapsOmnipodManager {
|
|||
|
||||
long time = System.currentTimeMillis() - 1000;
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CANCEL_TEMPORARY_BASAL_BY_DRIVER, null);
|
||||
|
||||
TemporaryBasal temporaryBasal = new TemporaryBasal(injector) //
|
||||
.date(time) //
|
||||
|
@ -600,10 +606,10 @@ public class AapsOmnipodManager {
|
|||
break;
|
||||
}
|
||||
|
||||
if (podInitActionType == PodInitActionType.PairAndPrimeWizardStep) {
|
||||
addToHistory(time, PodHistoryEntryType.PairAndPrime, comment, res.getResultType().isSuccess());
|
||||
if (podInitActionType == PodInitActionType.PAIR_AND_PRIME_WIZARD_STEP) {
|
||||
addToHistory(time, PodHistoryEntryType.PAIR_AND_PRIME, comment, res.getResultType().isSuccess());
|
||||
} else {
|
||||
addToHistory(time, PodHistoryEntryType.FillCannulaSetBasalProfile, res.getResultType().isSuccess() ? profile.getBasalValues() : comment, res.getResultType().isSuccess());
|
||||
addToHistory(time, PodHistoryEntryType.FILL_CANNULA_SET_BASAL_PROFILE, res.getResultType().isSuccess() ? profile.getBasalValues() : comment, res.getResultType().isSuccess());
|
||||
}
|
||||
|
||||
podInitReceiver.returnInitTaskStatus(podInitActionType, res.getResultType().isSuccess(), comment);
|
||||
|
|
|
@ -28,11 +28,11 @@ public class AapsPodStateManager extends PodStateManager {
|
|||
|
||||
@Override
|
||||
protected String readPodState() {
|
||||
return sp.getString(OmnipodStorageKeys.Prefs.PodState, "");
|
||||
return sp.getString(OmnipodStorageKeys.Preferences.POD_STATE, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void storePodState(String podState) {
|
||||
sp.putString(OmnipodStorageKeys.Prefs.PodState, podState);
|
||||
sp.putString(OmnipodStorageKeys.Preferences.POD_STATE, podState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,12 +87,12 @@ class OmnipodFragment : DaggerFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
omnipod_resume_delivery.setOnClickListener {
|
||||
omnipod_button_resume_delivery.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
commandQueue.startPump(null)
|
||||
}
|
||||
|
||||
omnipod_pod_mgmt.setOnClickListener {
|
||||
omnipod_button_pod_mgmt.setOnClickListener {
|
||||
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
|
||||
activity?.let { activity ->
|
||||
protectionCheck.queryProtection(
|
||||
|
@ -105,13 +105,13 @@ class OmnipodFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
omnipod_refresh.setOnClickListener {
|
||||
omnipod_button_refresh_status.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.GetPodState);
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.GET_POD_STATE);
|
||||
commandQueue.readStatus("Clicked Refresh", null)
|
||||
}
|
||||
|
||||
omnipod_rileylink_stats.setOnClickListener {
|
||||
omnipod_button_rileylink_stats.setOnClickListener {
|
||||
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
|
||||
startActivity(Intent(context, RileyLinkStatusActivity::class.java))
|
||||
} else {
|
||||
|
@ -119,24 +119,22 @@ class OmnipodFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
omnipod_pod_active_alerts_ack.setOnClickListener {
|
||||
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
|
||||
displayNotConfiguredDialog()
|
||||
} else {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.AcknowledgeAlerts);
|
||||
commandQueue.readStatus("Clicked Alert Ack", null)
|
||||
}
|
||||
omnipod_button_acknowledge_active_alerts.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.ACKNOWLEDGE_ALERTS);
|
||||
commandQueue.readStatus("Clicked Acknowledge Alert", null)
|
||||
}
|
||||
|
||||
omnipod_pod_debug.setOnClickListener {
|
||||
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
|
||||
displayNotConfiguredDialog()
|
||||
} else {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.GetPodPulseLog);
|
||||
commandQueue.readStatus("Clicked Pulse Log", null)
|
||||
}
|
||||
omnipod_button_suspend_delivery.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.SUSPEND_DELIVERY);
|
||||
commandQueue.readStatus("Clicked Suspend Delivery", null)
|
||||
}
|
||||
|
||||
omnipod_button_pulse_log.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequestType.GET_PULSE_LOG);
|
||||
commandQueue.readStatus("Clicked Pulse Log", null)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,47 +357,57 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
private fun updatePodActionButtons() {
|
||||
updateRefreshStatusButton()
|
||||
updateAcknowledgeAlertsButton()
|
||||
updatePulseLogButton()
|
||||
updateResumeDeliveryButton()
|
||||
updateAcknowledgeAlertsButton()
|
||||
updateSuspendDeliveryButton()
|
||||
updatePulseLogButton()
|
||||
}
|
||||
|
||||
private fun disablePodActionButtons() {
|
||||
omnipod_pod_active_alerts_ack.isEnabled = false
|
||||
omnipod_refresh.isEnabled = false
|
||||
omnipod_pod_debug.isEnabled = false
|
||||
omnipod_resume_delivery.isEnabled = false
|
||||
omnipod_button_acknowledge_active_alerts.isEnabled = false
|
||||
omnipod_button_resume_delivery.isEnabled = false
|
||||
omnipod_button_refresh_status.isEnabled = false
|
||||
omnipod_button_pulse_log.isEnabled = false
|
||||
}
|
||||
|
||||
private fun updateRefreshStatusButton() {
|
||||
omnipod_refresh.isEnabled = podStateManager.isPodInitialized && podStateManager.podProgressStatus.isAtLeast(PodProgressStatus.PAIRING_COMPLETED)
|
||||
omnipod_button_refresh_status.isEnabled = podStateManager.isPodInitialized && podStateManager.podProgressStatus.isAtLeast(PodProgressStatus.PAIRING_COMPLETED)
|
||||
&& rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
}
|
||||
|
||||
private fun updateAcknowledgeAlertsButton() {
|
||||
if (podStateManager.isPodInitialized && podStateManager.hasActiveAlerts() && !podStateManager.isPodDead) {
|
||||
omnipod_pod_active_alerts_ack.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_pod_active_alerts_ack.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePulseLogButton() {
|
||||
if (aapsOmnipodManager.isPodDebuggingOptionsEnabled) {
|
||||
omnipod_pod_debug.visibility = View.VISIBLE
|
||||
omnipod_pod_debug.isEnabled = podStateManager.isPodActivationCompleted && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_pod_debug.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateResumeDeliveryButton() {
|
||||
val queueEmptyOrStartingPump = isQueueEmpty() || commandQueue.isRunning(Command.CommandType.START_PUMP)
|
||||
if (podStateManager.isPodActivationCompleted && podStateManager.isSuspended && queueEmptyOrStartingPump) {
|
||||
omnipod_resume_delivery.visibility = View.VISIBLE
|
||||
omnipod_resume_delivery.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
omnipod_button_resume_delivery.visibility = View.VISIBLE
|
||||
omnipod_button_resume_delivery.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_resume_delivery.visibility = View.GONE
|
||||
omnipod_button_resume_delivery.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateAcknowledgeAlertsButton() {
|
||||
if (podStateManager.isPodInitialized && podStateManager.hasActiveAlerts() && !podStateManager.isPodDead) {
|
||||
omnipod_button_acknowledge_active_alerts.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_button_acknowledge_active_alerts.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSuspendDeliveryButton() {
|
||||
if (aapsOmnipodManager.isSuspendDeliveryButtonEnabled) {
|
||||
omnipod_button_suspend_delivery.visibility = View.VISIBLE
|
||||
omnipod_button_suspend_delivery.isEnabled = podStateManager.isPodRunning && !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_button_suspend_delivery.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePulseLogButton() {
|
||||
if (aapsOmnipodManager.isPulseLogButtonEnabled) {
|
||||
omnipod_button_pulse_log.visibility = View.VISIBLE
|
||||
omnipod_button_pulse_log.isEnabled = podStateManager.isPodActivationCompleted && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||
} else {
|
||||
omnipod_button_pulse_log.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -248,21 +248,21 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
|
|||
PodHistoryEntryType entryType = PodHistoryEntryType.getByCode(historyEntry.getPodEntryTypeCode());
|
||||
switch (entryType) {
|
||||
|
||||
case SetTemporaryBasal: {
|
||||
case SET_TEMPORARY_BASAL: {
|
||||
TempBasalPair tempBasalPair = aapsOmnipodUtil.getGsonInstance().fromJson(historyEntry.getData(), TempBasalPair.class);
|
||||
valueView.setText(resourceHelper.gs(R.string.omnipod_cmd_tbr_value, tempBasalPair.getInsulinRate(), tempBasalPair.getDurationMinutes()));
|
||||
}
|
||||
break;
|
||||
|
||||
case FillCannulaSetBasalProfile:
|
||||
case SetBasalSchedule: {
|
||||
case FILL_CANNULA_SET_BASAL_PROFILE:
|
||||
case SET_BASAL_SCHEDULE: {
|
||||
if (historyEntry.getData() != null) {
|
||||
setProfileValue(historyEntry.getData(), valueView);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SetBolus: {
|
||||
case SET_BOLUS: {
|
||||
if (historyEntry.getData().contains(";")) {
|
||||
String[] splitVal = historyEntry.getData().split(";");
|
||||
valueView.setText(resourceHelper.gs(R.string.omnipod_cmd_bolus_value_with_carbs, Double.valueOf(splitVal[0]), Double.valueOf(splitVal[1])));
|
||||
|
@ -272,20 +272,20 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
|
|||
}
|
||||
break;
|
||||
|
||||
case GetPodStatus:
|
||||
case GetPodInfo:
|
||||
case SetTime:
|
||||
case PairAndPrime:
|
||||
case CancelTemporaryBasal:
|
||||
case CancelTemporaryBasalForce:
|
||||
case ConfigureAlerts:
|
||||
case CancelBolus:
|
||||
case DeactivatePod:
|
||||
case ResetPodState:
|
||||
case AcknowledgeAlerts:
|
||||
case SuspendDelivery:
|
||||
case ResumeDelivery:
|
||||
case UnknownEntryType:
|
||||
case GET_POD_STATUS:
|
||||
case GET_POD_INFO:
|
||||
case SET_TIME:
|
||||
case PAIR_AND_PRIME:
|
||||
case CANCEL_TEMPORARY_BASAL_BY_DRIVER:
|
||||
case CANCEL_TEMPORARY_BASAL:
|
||||
case CONFIGURE_ALERTS:
|
||||
case CANCEL_BOLUS:
|
||||
case DEACTIVATE_POD:
|
||||
case RESET_POD_STATE:
|
||||
case ACKNOWLEDGE_ALERTS:
|
||||
case SUSPEND_DELIVERY:
|
||||
case RESUME_DELIVERY:
|
||||
case UNKNOWN_ENTRY_TYPE:
|
||||
default:
|
||||
valueView.setText("");
|
||||
break;
|
||||
|
|
|
@ -59,11 +59,11 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
}
|
||||
|
||||
initpod_remove_pod.setOnClickListener {
|
||||
removePodAction()
|
||||
deactivatePodAction()
|
||||
}
|
||||
|
||||
initpod_reset_pod.setOnClickListener {
|
||||
resetPodAction()
|
||||
discardPodAction()
|
||||
}
|
||||
|
||||
initpod_pod_history.setOnClickListener {
|
||||
|
@ -93,7 +93,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
private fun initPodAction() {
|
||||
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(injector, PodActionType.InitPod)
|
||||
var refreshAction = InitPodRefreshAction(injector, PodActionType.INIT_POD)
|
||||
|
||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||
|
@ -119,9 +119,9 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
this@PodManagementActivity.startActivity(myIntent)
|
||||
}
|
||||
|
||||
private fun removePodAction() {
|
||||
private fun deactivatePodAction() {
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(injector, PodActionType.RemovePod)
|
||||
var refreshAction = InitPodRefreshAction(injector, PodActionType.DEACTIVATE_POD)
|
||||
|
||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||
|
@ -143,10 +143,10 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
}
|
||||
|
||||
private fun resetPodAction() {
|
||||
private fun discardPodAction() {
|
||||
OKDialog.showConfirmation(this,
|
||||
resourceHelper.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
||||
aapsOmnipodManager.resetPodStatus()
|
||||
resourceHelper.gs(R.string.omnipod_cmd_discard_pod_desc), Thread {
|
||||
aapsOmnipodManager.discardPodState()
|
||||
rxBus.send(EventOmnipodPumpValuesChanged())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.defs;
|
||||
|
||||
public enum PodActionType {
|
||||
InitPod,
|
||||
RemovePod,
|
||||
ResetPod
|
||||
INIT_POD,
|
||||
DEACTIVATE_POD,
|
||||
DISCARD_POD
|
||||
}
|
||||
|
|
|
@ -118,9 +118,9 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
|||
mapCheckBoxes.put(child, checkBox1);
|
||||
}
|
||||
|
||||
if (podInitActionType == PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
||||
if (podInitActionType == PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP) {
|
||||
headerView.setText(R.string.omnipod_init_pod_wizard_step4_action_header);
|
||||
} else if (podInitActionType == PodInitActionType.DeactivatePodWizardStep) {
|
||||
} else if (podInitActionType == PodInitActionType.DEACTIVATE_POD_WIZARD_STEP) {
|
||||
headerView.setText(R.string.omnipod_remove_pod_wizard_step2_action_header);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,18 +37,18 @@ public class InitPodTask extends AsyncTask<Void, Void, String> {
|
|||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
if (initActionFragment.podInitActionType == PodInitActionType.PairAndPrimeWizardStep) {
|
||||
if (initActionFragment.podInitActionType == PodInitActionType.PAIR_AND_PRIME_WIZARD_STEP) {
|
||||
initActionFragment.callResult = aapsOmnipodManager.pairAndPrime(
|
||||
initActionFragment.podInitActionType,
|
||||
initActionFragment
|
||||
);
|
||||
} else if (initActionFragment.podInitActionType == PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
||||
} else if (initActionFragment.podInitActionType == PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP) {
|
||||
initActionFragment.callResult = aapsOmnipodManager.setInitialBasalScheduleAndInsertCannula(
|
||||
initActionFragment.podInitActionType,
|
||||
initActionFragment,
|
||||
profileFunction.getProfile()
|
||||
);
|
||||
} else if (initActionFragment.podInitActionType == PodInitActionType.DeactivatePodWizardStep) {
|
||||
} else if (initActionFragment.podInitActionType == PodInitActionType.DEACTIVATE_POD_WIZARD_STEP) {
|
||||
initActionFragment.callResult = aapsOmnipodManager.deactivatePod(initActionFragment);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class FullInitPodWizardModel extends InitPodWizardModel {
|
|||
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step2_title,
|
||||
PodInitActionType.PairAndPrimeWizardStep
|
||||
PodInitActionType.PAIR_AND_PRIME_WIZARD_STEP
|
||||
).setRequired(true).setCancelReason("Cancel"),
|
||||
|
||||
new DisplayTextPage(this,
|
||||
|
@ -41,7 +41,7 @@ public class FullInitPodWizardModel extends InitPodWizardModel {
|
|||
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step4_title,
|
||||
PodInitActionType.FillCannulaSetBasalProfileWizardStep
|
||||
PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP
|
||||
).setRequired(true).setCancelReason("Cancel")
|
||||
);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class RemovePodWizardModel extends AbstractWizardModel {
|
|||
|
||||
new RemovePodActionPage(this,
|
||||
R.string.omnipod_remove_pod_wizard_step2_title,
|
||||
PodInitActionType.DeactivatePodWizardStep
|
||||
PodInitActionType.DEACTIVATE_POD_WIZARD_STEP
|
||||
).setRequired(true).setCancelReason("Cancel")
|
||||
|
||||
);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ShortInitPodWizardModel extends InitPodWizardModel {
|
|||
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step4_title,
|
||||
PodInitActionType.FillCannulaSetBasalProfileWizardStep
|
||||
PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP
|
||||
).setRequired(true).setCancelReason("Cancel")
|
||||
);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (actionType == PodActionType.InitPod) {
|
||||
if (actionType == PodActionType.INIT_POD) {
|
||||
if (podStateManager.isPodRunning()) {
|
||||
uploadCareportalEvent(System.currentTimeMillis(), CareportalEvent.SITECHANGE);
|
||||
}
|
||||
|
|
15
omnipod/src/main/res/drawable/ic_loop_disabled.xml
Normal file
15
omnipod/src/main/res/drawable/ic_loop_disabled.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M24,9.343l-5.781,-3.968l-1.328,6.688l2.102,-1.757c0.014,0.056 0.03,0.111 0.043,0.168c0.116,0.512 0.183,1.042 0.183,1.589c0,3.952 -3.204,7.156 -7.156,7.156s-7.156,-3.204 -7.156,-7.156s3.204,-7.156 7.156,-7.156c1.072,0 2.085,0.242 2.998,0.665c0.325,0.151 0.639,0.321 0.936,0.517l0.002,-0.002l-0.352,-1.784l1.876,-0.538c-1.567,-1.033 -3.442,-1.639 -5.46,-1.639c-5.488,0 -9.938,4.449 -9.938,9.938S6.574,22 12.063,22S22,17.551 22,12.063c0,-0.759 -0.093,-1.496 -0.254,-2.206c-0.04,-0.176 -0.085,-0.35 -0.134,-0.523L24,9.343L24,9.343z"
|
||||
android:fillColor="#FF1313"/>
|
||||
<path
|
||||
android:pathData="M10.2429,8.7408l5.0162,5.0162l-1.5026,1.5026l-5.0162,-5.0162z"
|
||||
android:fillColor="#FF1313"/>
|
||||
<path
|
||||
android:pathData="M8.7408,13.7571l5.0162,-5.0162l1.5026,1.5026l-5.0162,5.0162z"
|
||||
android:fillColor="#FF1313"/>
|
||||
</vector>
|
|
@ -715,7 +715,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_resume_delivery"
|
||||
android:id="@+id/omnipod_button_resume_delivery"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -723,10 +723,11 @@
|
|||
android:drawableTop="@drawable/ic_local_activate"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="@string/omnipod_resume_delivery" />
|
||||
android:text="@string/omnipod_resume_delivery"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_refresh"
|
||||
android:id="@+id/omnipod_button_refresh_status"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -736,9 +737,8 @@
|
|||
android:paddingRight="0dp"
|
||||
android:text="@string/omnipod_refresh" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_pod_mgmt"
|
||||
android:id="@+id/omnipod_button_pod_mgmt"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -749,7 +749,7 @@
|
|||
android:text="@string/omnipod_pod_mgmt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_pod_active_alerts_ack"
|
||||
android:id="@+id/omnipod_button_acknowledge_active_alerts"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -757,10 +757,10 @@
|
|||
android:drawableTop="@drawable/ic_cp_aaps_offline"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="@string/omnipod_ack_short" />
|
||||
android:text="@string/omnipod_acknowledge_active_alerts_short" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_rileylink_stats"
|
||||
android:id="@+id/omnipod_button_rileylink_stats"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -771,7 +771,7 @@
|
|||
android:text="@string/omnipod_rl_stats" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_pod_debug"
|
||||
android:id="@+id/omnipod_button_pulse_log"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -779,7 +779,20 @@
|
|||
android:drawableTop="@drawable/ic_cp_bolus_correction"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="@string/omnipod_read_pulse_log_short" />
|
||||
android:text="@string/omnipod_read_pulse_log_short"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/omnipod_button_suspend_delivery"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@drawable/ic_loop_disabled"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="@string/omnipod_suspend_delivery_short"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_cp_pump_canula"
|
||||
android:text="@string/omnipod_cmd_reset_pod"
|
||||
android:text="@string/omnipod_cmd_discard_pod"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -9,18 +9,20 @@
|
|||
<string name="description_pump_omnipod">Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device.</string>
|
||||
|
||||
<!-- Omnipod Configuration -->
|
||||
<string name="key_omnipod_beep_bolus_enabled" translatable="false">pref_omnipod_beep_bolus_enabled</string>
|
||||
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
|
||||
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
|
||||
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
|
||||
<string name="key_omnipod_pod_debugging_options_enabled" translatable="false">pref_omnipod_pod_debugging_options_enabled</string>
|
||||
<string name="key_omnipod_timechange_enabled" translatable="false">pref_omnipod_timechange_enabled</string>
|
||||
<string name="omnipod_config_beep_bolus_enabled">Bolus beep enabled</string>
|
||||
<string name="omnipod_config_beep_basal_enabled">Basal beep enabled</string>
|
||||
<string name="omnipod_config_beep_smb_enabled">SMB beep enabled</string>
|
||||
<string name="omnipod_config_beep_tbr_enabled">TBR beep enabled</string>
|
||||
<string name="omnipod_config_pod_debugging_options_enabled">Pod debugging options enabled</string>
|
||||
<string name="omnipod_config_timechange_enabled">DST/Time zone detection enabled</string>
|
||||
<string name="key_omnipod_bolus_beeps_enabled" translatable="false">AAPS.Omnipod.bolus_beeps_enabled</string>
|
||||
<string name="key_omnipod_basal_beeps_enabled" translatable="false">AAPS.Omnipod.basal_beeps_enabled</string>
|
||||
<string name="key_omnipod_smb_beeps_enabled" translatable="false">AAPS.Omnipod.smb_beeps_enabled</string>
|
||||
<string name="key_omnipod_tbr_beeps_enabled" translatable="false">AAPS.Omnipod.tbr_beeps_enabled</string>
|
||||
<string name="key_omnipod_suspend_delivery_button_enabled" translatable="false">AAPS.Omnipod.suspend_delivery_button_enabled</string>
|
||||
<string name="key_omnipod_pulse_log_button_enabled" translatable="false">AAPS.Omnipod.pulse_log_button_enabled</string>
|
||||
<string name="key_omnipod_time_change_event_enabled" translatable="false">AAPS.Omnipod.time_change_enabled</string>
|
||||
<string name="omnipod_config_bolus_beeps_enabled">Bolus beeps enabled</string>
|
||||
<string name="omnipod_config_basal_beeps_enabled">Basal beeps enabled</string>
|
||||
<string name="omnipod_config_smb_beeps_enabled">SMB beeps enabled</string>
|
||||
<string name="omnipod_config_tbr_beeps_enabled">TBR beeps enabled</string>
|
||||
<string name="omnipod_config_suspend_delivery_button_enabled">Suspend Delivery button enabled</string>
|
||||
<string name="omnipod_config_pulse_log_button_enabled">Pulse Log button enabled</string>
|
||||
<string name="omnipod_config_time_change_enabled">DST/Time zone detection enabled</string>
|
||||
|
||||
<!-- Omnipod - Fragment -->
|
||||
<string name="omnipod_moments_ago">Moments ago</string>
|
||||
|
@ -43,9 +45,8 @@
|
|||
<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_active_alerts">Active Pod alerts</string>
|
||||
<string name="omnipod_ack_short">Ack alerts</string>
|
||||
<string name="omnipod_acknowledge_active_alerts_short">Ack alerts</string>
|
||||
<string name="omnipod_last_bolus" translatable="false">%1$.2f %2$s (%3$s)</string>
|
||||
<string name="omnipod_pod_status_initalizing">Initializing</string>
|
||||
|
||||
|
||||
<!-- Omnipod - Dialogs -->
|
||||
|
@ -80,13 +81,13 @@
|
|||
<string name="omnipod_pod_mgmt_title">Pod management</string>
|
||||
<string name="omnipod_cmd_init_pod">Init Pod</string>
|
||||
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
|
||||
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
|
||||
<string name="omnipod_cmd_discard_pod">Discard Pod</string>
|
||||
<string name="omnipod_cmd_pod_history">Pod history</string>
|
||||
<string name="omnipod_cmd_set_bolus">Set bolus</string>
|
||||
<string name="omnipod_cmd_cancel_bolus">Cancel bolus</string>
|
||||
<string name="omnipod_cmd_set_tbr">Set temporary basal</string>
|
||||
<string name="omnipod_cmd_cancel_tbr">Cancel temporary basal (internally by driver)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr_forced">Cancel temporary casal (forced by user)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr_by_driver">Cancel temporary basal (internally by driver)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr">Cancel temporary basal</string>
|
||||
<string name="omnipod_cmd_set_basal_schedule">Set basal schedule</string>
|
||||
<string name="omnipod_cmd_get_pod_status">Get Pod status</string>
|
||||
<string name="omnipod_cmd_get_pod_info">Get Pod info</string>
|
||||
|
@ -99,7 +100,7 @@
|
|||
<string name="omnipod_cmd_bolus_value">%1$.2f U</string>
|
||||
<string name="omnipod_cmd_bolus_value_with_carbs">%1$.2f U, CH=%2$.1f g</string>
|
||||
<string name="omnipod_cmd_tbr_value">Rate: %1$.2f U, duration: %2$d min</string>
|
||||
<string name="omnipod_cmd_reset_pod_desc">If you press <b>OK</b>, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.</string>
|
||||
<string name="omnipod_cmd_discard_pod_desc">If you press <b>OK</b>, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.</string>
|
||||
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
||||
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
|
||||
<string name="omnipod_init_pod_wizard_step1_desc">\nFill the new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.</string>
|
||||
|
@ -114,7 +115,7 @@
|
|||
<string name="omnipod_remove_pod_wizard_step1_title">Deactivate Pod</string>
|
||||
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
|
||||
<string name="omnipod_remove_pod_wizard_step2_title">Deactivating the Pod</string>
|
||||
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Reset Pod</b> option to forcibly reset the Pod state.</string>
|
||||
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Discard Pod</b> option to forcibly reset the Pod state.</string>
|
||||
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nPlease remove the Pod from your body and discard it.</string>
|
||||
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
|
||||
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
||||
|
@ -153,6 +154,10 @@
|
|||
<string name="omnipod_resume_delivery">Resume delivery</string>
|
||||
<string name="omnipod_error_pod_suspended">Pod suspended</string>
|
||||
<string name="omnipod_less_than_a_minute_ago">Less than a minute ago</string>
|
||||
<string name="omnipod_suspend_delivery_short">Suspend</string>
|
||||
<string name="omnipod_cmd_pair_and_prime">Pair and prime</string>
|
||||
<string name="omnipod_cmd_fill_cannula_set_basal_profile">Fill cannula and set basal profile</string>
|
||||
<string name="omnipod_cmd_get_pulse_log">Get pulse log</string>
|
||||
|
||||
<plurals name="omnipod_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -16,33 +16,38 @@
|
|||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_bolus_enabled"
|
||||
android:title="@string/omnipod_config_beep_bolus_enabled" />
|
||||
android:key="@string/key_omnipod_bolus_beeps_enabled"
|
||||
android:title="@string/omnipod_config_bolus_beeps_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_basal_enabled"
|
||||
android:title="@string/omnipod_config_beep_basal_enabled" />
|
||||
android:key="@string/key_omnipod_basal_beeps_enabled"
|
||||
android:title="@string/omnipod_config_basal_beeps_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_smb_enabled"
|
||||
android:title="@string/omnipod_config_beep_smb_enabled" />
|
||||
android:key="@string/key_omnipod_smb_beeps_enabled"
|
||||
android:title="@string/omnipod_config_smb_beeps_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_tbr_enabled"
|
||||
android:title="@string/omnipod_config_beep_tbr_enabled" />
|
||||
android:key="@string/key_omnipod_tbr_beeps_enabled"
|
||||
android:title="@string/omnipod_config_tbr_beeps_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_omnipod_pod_debugging_options_enabled"
|
||||
android:title="@string/omnipod_config_pod_debugging_options_enabled" />
|
||||
android:key="@string/key_omnipod_suspend_delivery_button_enabled"
|
||||
android:title="@string/omnipod_config_suspend_delivery_button_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_omnipod_pulse_log_button_enabled"
|
||||
android:title="@string/omnipod_config_pulse_log_button_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_timechange_enabled"
|
||||
android:title="@string/omnipod_config_timechange_enabled" />
|
||||
android:key="@string/key_omnipod_time_change_event_enabled"
|
||||
android:title="@string/omnipod_config_time_change_enabled" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in a new issue