Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros

This commit is contained in:
Andy Rozman 2019-12-27 21:18:02 +01:00
commit c3236352d4
11 changed files with 53 additions and 55 deletions

View file

@ -26,7 +26,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDevice
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
@ -172,7 +171,7 @@ class OmnipodFragment : Fragment() {
fun setVisibilityOfPodDebugButton() {
val isEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false)
val isEnabled = SP.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false)
if (isEnabled)
omnipod_pod_debug.visibility = View.VISIBLE

View file

@ -40,7 +40,6 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
@ -56,7 +55,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionT
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
@ -65,7 +63,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod.util.LogReceiver;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
@ -188,7 +185,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if ((event.isChanged(R.string.key_omnipod_beep_basal_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_bolus_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_tbr_enabled)) ||
(event.isChanged(R.string.key_omnipod_pod_expert_debug_enabled)) ||
(event.isChanged(R.string.key_omnipod_pod_debugging_options_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_smb_enabled)))
refreshConfiguration();
}, FabricPrivacy::logException)

View file

@ -200,28 +200,15 @@ public class OmnipodManager {
}
}
// CAUTION: cancels temp basal and then sets new temp basal. An OmnipodException[certainFailure=false] indicates that the pod might have cancelled the previous temp basal, but did not set a new temp basal
public synchronized void setTemporaryBasal(TempBasalPair tempBasalPair, boolean acknowledgementBeep, boolean completionBeep) {
assertReadyForDelivery();
logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
try {
cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep);
} catch (Exception ex) {
logCommandExecutionFinished("setTemporaryBasal");
throw ex;
}
try {
executeAndVerify(() -> communicationService.executeAction(new SetTempBasalAction(
podState, tempBasalPair.getInsulinRate(), Duration.standardMinutes(tempBasalPair.getDurationMinutes()),
acknowledgementBeep, completionBeep)));
} catch (OmnipodException ex) {
// Treat all exceptions as uncertain failures, because all delivery has been suspended here.
// Setting this to an uncertain failure will enable for the user to get an appropriate warning
ex.setCertainFailure(false);
throw ex;
} finally {
logCommandExecutionFinished("setTemporaryBasal");
}

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver;
import org.jetbrains.annotations.Nullable;
import org.joda.time.LocalDateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -58,7 +57,7 @@ public class OmnipodPumpStatus extends PumpStatus {
public boolean beepBasalEnabled = true;
public boolean beepSMBEnabled = true;
public boolean beepTBREnabled = true;
public boolean podExpertDebugModeEnabled = false;
public boolean podDebuggingOptionsEnabled = false;
public OmnipodPumpStatus(PumpDescription pumpDescription) {
super(pumpDescription);
@ -106,7 +105,7 @@ public class OmnipodPumpStatus extends PumpStatus {
this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true);
this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true);
this.beepTBREnabled = SP.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true);
this.podExpertDebugModeEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false);
this.podDebuggingOptionsEnabled = SP.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false);
LOG.debug("Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled, this.beepTBREnabled);

View file

@ -335,10 +335,6 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled);
addSuccessToHistory(time, PodHistoryEntryType.SetTemporaryBasal, tempBasalPair);
} catch (Exception ex) {
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
addToHistory(time, PodHistoryEntryType.SetTemporaryBasal, "Uncertain failure", false);
return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_temp_basal_failed_uncertain));
}
String comment = handleAndTranslateException(ex);
addFailureToHistory(time, PodHistoryEntryType.SetTemporaryBasal, comment);
return new PumpEnactResult().success(false).enacted(false).comment(comment);

View file

@ -90,8 +90,21 @@ public class OmnipodUITask {
break;
case GetPodPulseLog:
// This command is very error prone, so retry a few times if it fails
// Can take some time, but that's ok since this is a very specific feature for experts
// And will not be used by normal users
for(int i = 0; 3 > i; i++) {
try {
returnDataObject = communicationManager.readPulseLog();
break;
} catch (Exception ex) {
if (isLogEnabled()) {
LOG.warn("Failed to retrieve pulse log", ex);
}
returnDataObject = null;
}
}
break;
case GetPodStatus:
returnData = communicationManager.getPodStatus();

View file

@ -18,7 +18,7 @@ public class OmnipodConst {
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 PodExpertDebugModeEnabled = R.string.key_omnipod_pod_expert_debug_enabled;
public static final int PodDebuggingOptionsEnabled = R.string.key_omnipod_pod_debugging_options_enabled;
}
public class Statistics {

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
@ -116,4 +117,9 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
}
@Override
public PodInfoRecentHighFlashLogDump readPulseLog() {
return null;
}
}

View file

@ -610,7 +610,7 @@
android:drawableTop="@drawable/icon_danarstats"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="RL Stats" />
android:text="@string/omnipod_rl_stats" />
<Button
android:id="@+id/omnipod_pod_debug"
@ -621,7 +621,7 @@
android:drawableTop="@drawable/icon_cp_bolus_correction"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="Pod Debug"
android:text="@string/omnipod_read_pulse_log_short"
/>
</LinearLayout>

View file

@ -1650,12 +1650,12 @@
<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_expert_debug_enabled" translatable="false">key_omnipod_pod_expert_debug_enabled</string>
<string name="key_omnipod_pod_debugging_options_enabled" translatable="false">pref_omnipod_pod_debugging_options_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_expert_debug_enabled">Pod Debug Expert Mode</string>
<string name="omnipod_config_pod_debugging_options_enabled">Pod Debugging Options Enabled</string>
<!-- Omnipod - Fragment -->
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
@ -1682,16 +1682,16 @@
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occured. Please report! (type: %1$s).</string>
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters.</string>
<string name="omnipod_driver_error_communication_failed">Communication failed.</string>
<string name="omnipod_driver_error_crc_mismatch">Communication failed: Message integrity verification failed.</string>
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the pod.</string>
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the pod is in a wrong state.</string>
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the pod.</string>
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the pod.</string>
<string name="omnipod_driver_error_crc_mismatch">Communication failed: message integrity verification failed.</string>
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod.</string>
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state.</string>
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod.</string>
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod.</string>
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed.</string>
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync.</string>
<string name="omnipod_driver_error_not_enough_data">Communication failed: not enough data received from the pod.</string>
<string name="omnipod_driver_error_pod_fault">A pod fault (%1$03d %2$s) has been detected. Please deactivate your pod and start a new one.</string>
<string name="omnipod_driver_error_pod_returned_error_response">Communication failed: the pod returned an error response.</string>
<string name="omnipod_driver_error_not_enough_data">Communication failed: not enough data received from the Pod.</string>
<string name="omnipod_driver_error_pod_fault">A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one.</string>
<string name="omnipod_driver_error_pod_returned_error_response">Communication failed: the Pod returned an error response.</string>
<!-- Omnipod - Pod Mgmt -->
<string name="omnipod_pod_mgmt_title">Pod Management</string>
@ -1714,7 +1714,7 @@
<string name="omnipod_cmd_resume_delivery">Resume Delivery</string>
<string name="omnipod_cmd_umknown_entry">Unknown Entry</string>
<string name="omnipod_cmd_reset_pod_desc">If you press "OK" Pod will be forcefully removed. Do this only if you can not communicate with Pod anymore.</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_pod_history_na">Pod History not available at the moment.</string>
<string name="omnipod_namex" translatable="false">Omnipod</string>
@ -1723,21 +1723,21 @@
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill new Pod with Insulin.\n\n\nAfter filling Pod, listen for 2 beeps, then press "Next".\n\n\n<b>Note:</b> Do not remove needle cap at this time.</string>
<string name="omnipod_init_pod_wizard_step2_title">Pair and Prime the Pod</string>
<string name="omnipod_init_pod_wizard_step2_action_header">We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If you decide to Cancel, you will have to discard the Pod. If there is an error you will get option to retry.</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill the new Pod with insulin.\n\nListen for two beeps from the Pod during the filling process. 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>
<string name="omnipod_init_pod_wizard_step2_title">Priming</string>
<string name="omnipod_init_pod_wizard_step2_action_header">Trying to pair with and prime the new Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> please keep the Pod very close to the RileyLink at this time.</string>
<string name="omnipod_init_pod_wizard_step3_title">Attach the Pod</string>
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare infusion site. Remove Pods needle cap.\n\nIf cannula sticks out press <b>Cancel</b> (Pod will need to be discarded).\n\nPress <b>Next</b> to insert cannula and begin Basal Delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Fill Cannula and Start Basal delivery</string>
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">Pod is now active.\n\nBasal has been programmed.\n\nCheck infusion site and cannula. If cannula seems incorrectly inserted, please replace the Pod.</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t.</string>
<string name="omnipod_remove_pod_wizard_step1_title">Prepare for Pod Removal</string>
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to begin Pod removal process.\n\n\nThis will stop delivery of insulin and deactivate Pod.</string>
<string name="omnipod_remove_pod_wizard_step2_title">Remove the Pod</string>
<string name="omnipod_remove_pod_wizard_step2_action_header">We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If Pod removal fails you need to click on Cancel.</string>
<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_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nRemove and discard the Pod.\n\nWhen you are ready, prepare the next Pod and start <b>Init Pod</b> action.</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>
@ -1761,9 +1761,10 @@
<string name="omnipod_alert_low_reservoir">Low reservoir</string>
<string name="omnipod_alert_unknown_alert">Unknown alert</string>
<string name="omnipod_error_set_basal_failed_uncertain">Setting basal profile might have failed. Delivery might be suspended! Please refresh pod status.</string>
<string name="omnipod_error_set_temp_basal_failed_uncertain">Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh pod status.</string>
<string name="omnipod_error_set_time_failed_uncertain">Setting time might have failed. Delivery might be suspended! Please refresh pod status.</string>
<string name="omnipod_bolus_failed_uncertain">Unable to verify whether the bolus succeeded. Please verify that your pod is bolusing or cancel the bolus.</string>
<string name="omnipod_rl_stats">RL Stats</string>
<string name="omnipod_read_pulse_log_short">Pulse Log</string>
</resources>

View file

@ -33,8 +33,8 @@
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_omnipod_pod_expert_debug_enabled"
android:title="@string/omnipod_config_pod_expert_debug_enabled" />
android:key="@string/key_omnipod_pod_debugging_options_enabled"
android:title="@string/omnipod_config_pod_debugging_options_enabled" />
</PreferenceCategory>
</PreferenceScreen>