From 06e72b89a027ec7300883ded2b2835ab43cf28a0 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 26 Dec 2019 13:27:11 -0500 Subject: [PATCH 1/5] Match PDM beep type for cancel delivery, log status response after cancelling delivery --- .../plugins/pump/omnipod/comm/OmnipodManager.java | 7 ++++++- .../pump/omnipod/comm/action/CancelDeliveryAction.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java index 3262014a58..f8f5edfcb2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java @@ -241,7 +241,12 @@ public class OmnipodManager { logStartingCommandExecution("cancelDelivery [deliveryTypes=" + deliveryTypes + ", acknowledgementBeep=" + acknowledgementBeep + "]"); try { - executeAndVerify(() -> communicationService.executeAction(new CancelDeliveryAction(podState, deliveryTypes, acknowledgementBeep))); + executeAndVerify(() -> { + StatusResponse statusResponse = communicationService.executeAction(new CancelDeliveryAction(podState, deliveryTypes, acknowledgementBeep)); + if (isLoggingEnabled()) { + LOG.info("Status response after cancel delivery[types={}]: {}", deliveryTypes.toString(), statusResponse.toString()); + } + }); } finally { logCommandExecutionFinished("cancelDelivery"); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java index 686fc0036b..dddc686d1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java @@ -39,7 +39,7 @@ public class CancelDeliveryAction implements OmnipodAction { List messageBlocks = new ArrayList<>(); messageBlocks.add(new CancelDeliveryCommand(podState.getCurrentNonce(), - acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BIP_BIP : BeepType.NO_BEEP, deliveryTypes)); + acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BEEEEEEP : BeepType.NO_BEEP, deliveryTypes)); if (acknowledgementBeep && deliveryTypes.size() > 1) { // Workaround for strange beep behaviour when cancelling multiple delivery types at the same time @@ -49,7 +49,7 @@ public class CancelDeliveryAction implements OmnipodAction { // we should keep the beep config for delivery types that we're not cancelling. // We currently have no use case that though, // as we either cancel 1 type or all types, - messageBlocks.add(new BeepConfigCommand(BeepConfigType.BIP_BIP)); + messageBlocks.add(new BeepConfigCommand(BeepConfigType.BEEEEEEP)); } return communicationService.exchangeMessages(StatusResponse.class, podState, From 1c8c49e61e1e57d8a765a0779c07e6dea2f8b202 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 26 Dec 2019 13:47:24 -0500 Subject: [PATCH 2/5] Ignore Pod fault when cancelling delivery before deactivating pod --- .../pump/omnipod/comm/action/DeactivatePodAction.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java index 24dc6cbcb0..e88fafdb6c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java @@ -8,6 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodFaultException; public class DeactivatePodAction implements OmnipodAction { private final PodSessionState podState; @@ -24,8 +25,12 @@ public class DeactivatePodAction implements OmnipodAction { @Override public StatusResponse execute(OmnipodCommunicationService communicationService) { if (!podState.isSuspended() && !podState.hasFaultEvent()) { - communicationService.executeAction(new CancelDeliveryAction(podState, - EnumSet.allOf(DeliveryType.class), acknowledgementBeep)); + try { + communicationService.executeAction(new CancelDeliveryAction(podState, + EnumSet.allOf(DeliveryType.class), acknowledgementBeep)); + } catch(PodFaultException ex) { + // Ignore + } } return communicationService.sendCommand(StatusResponse.class, podState, new DeactivatePodCommand(podState.getCurrentNonce())); From 641b0a800ecf9ba90cd09607e954a112d35dbb4d Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 26 Dec 2019 13:57:56 -0500 Subject: [PATCH 3/5] Also sound beeps for cancellng current (temp) basal when setting (temp) basal --- .../plugins/pump/omnipod/comm/OmnipodManager.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java index f8f5edfcb2..37171446e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java @@ -179,9 +179,7 @@ public class OmnipodManager { logStartingCommandExecution("setBasalSchedule [basalSchedule=" + schedule + ", acknowledgementBeep=" + acknowledgementBeep + "]"); try { - // Never emit a beep for suspending delivery, so if the user has beeps enabled, - // they can verify that setting the basal schedule succeeded (not suspending the delivery) - cancelDelivery(EnumSet.allOf(DeliveryType.class), false); + cancelDelivery(EnumSet.allOf(DeliveryType.class), acknowledgementBeep); } catch (Exception ex) { logCommandExecutionFinished("setBasalSchedule"); throw ex; @@ -209,9 +207,7 @@ public class OmnipodManager { logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]"); try { - // Never emit a beep for cancelling temp basal, so if the user has beeps enabled, - // they can verify that setting the temp basal succeeded (and not cancelling it) - cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), false); + cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep); } catch (Exception ex) { logCommandExecutionFinished("setTemporaryBasal"); throw ex; From bcb7530a9afb00c8b3e9ef9c14407fd51ea18768 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 26 Dec 2019 14:06:29 -0500 Subject: [PATCH 4/5] More logging --- .../androidaps/plugins/pump/omnipod/comm/OmnipodManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java index 37171446e9..684e8f234f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java @@ -538,8 +538,11 @@ public class OmnipodManager { } try { logStartingCommandExecution("verifyCommand"); - communicationService.sendCommand(StatusResponse.class, podState, + StatusResponse statusResponse = communicationService.sendCommand(StatusResponse.class, podState, new CancelDeliveryCommand(podState.getCurrentNonce(), BeepType.NO_BEEP, DeliveryType.NONE), false); + if (isLoggingEnabled()) { + LOG.info("Status response after verifyCommand (cancelDelivery[types=DeliveryType.NONE]): {}", statusResponse.toString()); + } } catch (NonceOutOfSyncException ex) { if (isLoggingEnabled()) { LOG.info("Command resolved to FAILURE (CERTAIN_FAILURE)", ex); From 505604580de6c150902fc91c5eef09f348f1d9fd Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 26 Dec 2019 19:50:58 -0500 Subject: [PATCH 5/5] Use shorter beep for cancel delivery --- .../pump/omnipod/comm/action/CancelDeliveryAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java index dddc686d1b..91590272a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java @@ -39,7 +39,7 @@ public class CancelDeliveryAction implements OmnipodAction { List messageBlocks = new ArrayList<>(); messageBlocks.add(new CancelDeliveryCommand(podState.getCurrentNonce(), - acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BEEEEEEP : BeepType.NO_BEEP, deliveryTypes)); + acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BEEP : BeepType.NO_BEEP, deliveryTypes)); if (acknowledgementBeep && deliveryTypes.size() > 1) { // Workaround for strange beep behaviour when cancelling multiple delivery types at the same time @@ -49,7 +49,7 @@ public class CancelDeliveryAction implements OmnipodAction { // we should keep the beep config for delivery types that we're not cancelling. // We currently have no use case that though, // as we either cancel 1 type or all types, - messageBlocks.add(new BeepConfigCommand(BeepConfigType.BEEEEEEP)); + messageBlocks.add(new BeepConfigCommand(BeepConfigType.BEEP)); } return communicationService.exchangeMessages(StatusResponse.class, podState,