Ignore Pod fault when cancelling delivery before deactivating pod

This commit is contained in:
Bart Sopers 2019-12-26 13:47:24 -05:00
parent 06e72b89a0
commit 1c8c49e61e

View file

@ -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()) {
try {
communicationService.executeAction(new CancelDeliveryAction(podState, communicationService.executeAction(new CancelDeliveryAction(podState,
EnumSet.allOf(DeliveryType.class), acknowledgementBeep)); 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()));