Ignore IllegalPacketTypeException in AssignAddressAction if packetType is ACK and we already successfully assigned the address before
This commit is contained in:
parent
dd795463cf
commit
159c1f941d
1 changed files with 13 additions and 2 deletions
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.Inser
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalDeliveryStatusException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalDeliveryStatusException;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException;
|
||||||
|
@ -36,6 +37,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.pod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
|
||||||
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.PacketType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||||
|
@ -83,8 +85,17 @@ public class OmnipodManager {
|
||||||
try {
|
try {
|
||||||
if (!podStateManager.hasState() || !podStateManager.isPaired() || podStateManager.getSetupProgress().isBefore(SetupProgress.POD_CONFIGURED)) {
|
if (!podStateManager.hasState() || !podStateManager.isPaired() || podStateManager.getSetupProgress().isBefore(SetupProgress.POD_CONFIGURED)) {
|
||||||
// Always send both 0x07 and 0x03 on retries
|
// Always send both 0x07 and 0x03 on retries
|
||||||
|
try {
|
||||||
communicationService.executeAction(
|
communicationService.executeAction(
|
||||||
new AssignAddressAction(podStateManager));
|
new AssignAddressAction(podStateManager));
|
||||||
|
} catch (IllegalPacketTypeException ex) {
|
||||||
|
if (ex.getActual() == PacketType.ACK && podStateManager.isPaired()) {
|
||||||
|
// When we already assigned the address before, it's possible to only get an ACK here
|
||||||
|
aapsLogger.debug("Received ACK instead of response. Ignoring because we already assigned the address successfully");
|
||||||
|
} else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
communicationService.executeAction(new SetupPodAction(podStateManager));
|
communicationService.executeAction(new SetupPodAction(podStateManager));
|
||||||
} else if (SetupProgress.PRIMING.isBefore(podStateManager.getSetupProgress())) {
|
} else if (SetupProgress.PRIMING.isBefore(podStateManager.getSetupProgress())) {
|
||||||
|
|
Loading…
Reference in a new issue