Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros
This commit is contained in:
commit
3ebb85df46
3 changed files with 21 additions and 12 deletions
|
@ -179,9 +179,7 @@ public class OmnipodManager {
|
||||||
logStartingCommandExecution("setBasalSchedule [basalSchedule=" + schedule + ", acknowledgementBeep=" + acknowledgementBeep + "]");
|
logStartingCommandExecution("setBasalSchedule [basalSchedule=" + schedule + ", acknowledgementBeep=" + acknowledgementBeep + "]");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Never emit a beep for suspending delivery, so if the user has beeps enabled,
|
cancelDelivery(EnumSet.allOf(DeliveryType.class), acknowledgementBeep);
|
||||||
// they can verify that setting the basal schedule succeeded (not suspending the delivery)
|
|
||||||
cancelDelivery(EnumSet.allOf(DeliveryType.class), false);
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logCommandExecutionFinished("setBasalSchedule");
|
logCommandExecutionFinished("setBasalSchedule");
|
||||||
throw ex;
|
throw ex;
|
||||||
|
@ -209,9 +207,7 @@ public class OmnipodManager {
|
||||||
logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
|
logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Never emit a beep for cancelling temp basal, so if the user has beeps enabled,
|
cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep);
|
||||||
// they can verify that setting the temp basal succeeded (and not cancelling it)
|
|
||||||
cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), false);
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logCommandExecutionFinished("setTemporaryBasal");
|
logCommandExecutionFinished("setTemporaryBasal");
|
||||||
throw ex;
|
throw ex;
|
||||||
|
@ -241,7 +237,12 @@ public class OmnipodManager {
|
||||||
logStartingCommandExecution("cancelDelivery [deliveryTypes=" + deliveryTypes + ", acknowledgementBeep=" + acknowledgementBeep + "]");
|
logStartingCommandExecution("cancelDelivery [deliveryTypes=" + deliveryTypes + ", acknowledgementBeep=" + acknowledgementBeep + "]");
|
||||||
|
|
||||||
try {
|
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 {
|
} finally {
|
||||||
logCommandExecutionFinished("cancelDelivery");
|
logCommandExecutionFinished("cancelDelivery");
|
||||||
}
|
}
|
||||||
|
@ -537,8 +538,11 @@ public class OmnipodManager {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
logStartingCommandExecution("verifyCommand");
|
logStartingCommandExecution("verifyCommand");
|
||||||
communicationService.sendCommand(StatusResponse.class, podState,
|
StatusResponse statusResponse = communicationService.sendCommand(StatusResponse.class, podState,
|
||||||
new CancelDeliveryCommand(podState.getCurrentNonce(), BeepType.NO_BEEP, DeliveryType.NONE), false);
|
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) {
|
} catch (NonceOutOfSyncException ex) {
|
||||||
if (isLoggingEnabled()) {
|
if (isLoggingEnabled()) {
|
||||||
LOG.info("Command resolved to FAILURE (CERTAIN_FAILURE)", ex);
|
LOG.info("Command resolved to FAILURE (CERTAIN_FAILURE)", ex);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class CancelDeliveryAction implements OmnipodAction<StatusResponse> {
|
||||||
List<MessageBlock> messageBlocks = new ArrayList<>();
|
List<MessageBlock> messageBlocks = new ArrayList<>();
|
||||||
|
|
||||||
messageBlocks.add(new CancelDeliveryCommand(podState.getCurrentNonce(),
|
messageBlocks.add(new CancelDeliveryCommand(podState.getCurrentNonce(),
|
||||||
acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BIP_BIP : BeepType.NO_BEEP, deliveryTypes));
|
acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BEEP : BeepType.NO_BEEP, deliveryTypes));
|
||||||
|
|
||||||
if (acknowledgementBeep && deliveryTypes.size() > 1) {
|
if (acknowledgementBeep && deliveryTypes.size() > 1) {
|
||||||
// Workaround for strange beep behaviour when cancelling multiple delivery types at the same time
|
// Workaround for strange beep behaviour when cancelling multiple delivery types at the same time
|
||||||
|
@ -49,7 +49,7 @@ public class CancelDeliveryAction implements OmnipodAction<StatusResponse> {
|
||||||
// we should keep the beep config for delivery types that we're not cancelling.
|
// we should keep the beep config for delivery types that we're not cancelling.
|
||||||
// We currently have no use case that though,
|
// We currently have no use case that though,
|
||||||
// as we either cancel 1 type or all types,
|
// as we either cancel 1 type or all types,
|
||||||
messageBlocks.add(new BeepConfigCommand(BeepConfigType.BIP_BIP));
|
messageBlocks.add(new BeepConfigCommand(BeepConfigType.BEEP));
|
||||||
}
|
}
|
||||||
|
|
||||||
return communicationService.exchangeMessages(StatusResponse.class, podState,
|
return communicationService.exchangeMessages(StatusResponse.class, podState,
|
||||||
|
|
|
@ -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.DeliveryType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
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.ActionInitializationException;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodFaultException;
|
||||||
|
|
||||||
public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
|
public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
|
||||||
private final PodSessionState podState;
|
private final PodSessionState podState;
|
||||||
|
@ -24,8 +25,12 @@ public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
|
||||||
@Override
|
@Override
|
||||||
public StatusResponse execute(OmnipodCommunicationService communicationService) {
|
public StatusResponse execute(OmnipodCommunicationService communicationService) {
|
||||||
if (!podState.isSuspended() && !podState.hasFaultEvent()) {
|
if (!podState.isSuspended() && !podState.hasFaultEvent()) {
|
||||||
communicationService.executeAction(new CancelDeliveryAction(podState,
|
try {
|
||||||
EnumSet.allOf(DeliveryType.class), acknowledgementBeep));
|
communicationService.executeAction(new CancelDeliveryAction(podState,
|
||||||
|
EnumSet.allOf(DeliveryType.class), acknowledgementBeep));
|
||||||
|
} catch(PodFaultException ex) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return communicationService.sendCommand(StatusResponse.class, podState, new DeactivatePodCommand(podState.getCurrentNonce()));
|
return communicationService.sendCommand(StatusResponse.class, podState, new DeactivatePodCommand(podState.getCurrentNonce()));
|
||||||
|
|
Loading…
Reference in a new issue