Ignore PodFaultException when deactivating pod

This commit is contained in:
Bart Sopers 2019-12-08 18:46:51 +01:00
parent 29d12eeb26
commit 057927d24e
3 changed files with 16 additions and 5 deletions

View file

@ -43,6 +43,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalDelivery
import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalSetupProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.exception.NonceOutOfSyncException;
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodFaultException;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.Completable;
@ -286,7 +287,13 @@ public class OmnipodManager {
throw new IllegalSetupProgressException(SetupProgress.ADDRESS_ASSIGNED, null);
}
executeAndVerify(() -> communicationService.executeAction(new DeactivatePodAction(podState, acknowledgementBeep)));
try {
executeAndVerify(() -> communicationService.executeAction(new DeactivatePodAction(podState, acknowledgementBeep)));
} catch (PodFaultException ex) {
if (isLoggingEnabled()) {
LOG.info("Ignoring PodFaultException in deactivatePod", ex);
}
}
resetPodState();
}

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import java.util.Locale;
public enum FaultEventCode {
NO_FAULTS((byte) 0x00),
FAILED_FLASH_ERASE((byte) 0x01),
@ -138,4 +140,9 @@ public enum FaultEventCode {
public byte getValue() {
return value;
}
@Override
public String toString() {
return String.format(Locale.getDefault(), "Pod fault (%d): %s", value, name());
}
}

View file

@ -1,15 +1,12 @@
package info.nightscout.androidaps.plugins.pump.omnipod.exception;
import java.util.Locale;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
public class PodFaultException extends OmnipodException {
private final PodInfoFaultEvent faultEvent;
public PodFaultException(PodInfoFaultEvent faultEvent) {
super(String.format(Locale.getDefault(), "Pod fault (%d): %s", faultEvent.getFaultEventCode().getValue(),
faultEvent.getFaultEventCode().toString()), true);
super(faultEvent.getFaultEventCode().toString(), true);
this.faultEvent = faultEvent;
}