diff --git a/app/build.gradle b/app/build.gradle index 3817db6af3..19cd265928 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -109,7 +109,7 @@ android { targetSdkVersion 28 multiDexEnabled true versionCode 1500 - version "2.7-omnipod-0.3-SNAPSHOT" + version "2.7-omnipod-0.4-SNAPSHOT" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java index 1fb24821e1..de809fd431 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java @@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion; import info.nightscout.androidaps.utils.SP; /** @@ -115,6 +116,12 @@ public class RFSpy { } } + public boolean isRileyLinkStillAvailable() { + RileyLinkFirmwareVersion firmwareVersion = getFirmwareVersion(); + + return (firmwareVersion!= RileyLinkFirmwareVersion.UnknownVersion); + } + public RileyLinkFirmwareVersion getFirmwareVersion() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java index 063cdb877b..00243a387c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java @@ -63,7 +63,7 @@ public class RFSpyReader { LOG.trace(ThreadUtil.sig() + "Entering poll at t==" + SystemClock.uptimeMillis() + ", timeout is " + timeout_ms + " mDataQueue size is " + mDataQueue.size()); - if (mDataQueue.isEmpty()) + if (mDataQueue.isEmpty()) { try { // block until timeout or data available. // returns null if timeout. @@ -71,7 +71,7 @@ public class RFSpyReader { if (dataFromQueue != null) { if (isLogEnabled()) LOG.debug("Got data [" + ByteUtil.shortHexString(dataFromQueue) + "] at t==" - + SystemClock.uptimeMillis()); + + SystemClock.uptimeMillis()); } else { if (isLogEnabled()) LOG.debug("Got data [null] at t==" + SystemClock.uptimeMillis()); @@ -80,6 +80,8 @@ public class RFSpyReader { } catch (InterruptedException e) { LOG.error("poll: Interrupted waiting for data"); } + } + return null; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt index e64eb9f787..71434fd3ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt @@ -234,7 +234,13 @@ class OmnipodFragment : Fragment() { omnipod_pod_status.text = MainApp.gs(R.string.omnipod_pod_no_pod_connected) pumpStatus.podAvailable = false pumpStatus.podNumber == null - } else { + } else if (driverState == OmnipodDriverState.Initalized_PodInitializing) { + omnipod_pod_address.text = pumpStatus.podSessionState.address.toString() + omnipod_pod_expiry.text = "-" + omnipod_pod_status.text = OmnipodUtil.getPodSessionState().getSetupProgress().name + pumpStatus.podAvailable = false + pumpStatus.podNumber == pumpStatus.podSessionState.address.toString() + }else { pumpStatus.podLotNumber = "" + pumpStatus.podSessionState.lot pumpStatus.podAvailable = true omnipod_pod_address.text = pumpStatus.podSessionState.address.toString() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index 1bb491694e..64f11f1c0a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -494,7 +494,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump //getPodPumpStatusObject().driverState = OmnipodDriverState.Initalized_PodAvailable; //driverState = OmnipodDriverState.Initalized_PodAvailable; - OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAvailable); + OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAttached); // we would probably need to read Basal Profile here too } @@ -948,7 +948,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump if (isLoggingEnabled()) LOG.warn(getLogPrefix() + "Time, Date and/or TimeZone changed. [changeType={}, eventHandlingEnabled={}]", timeChangeType.name(), pumpStatusLocal.timeChangeEventEnabled); - if (OmnipodUtil.getDriverState() == OmnipodDriverState.Initalized_PodAvailable) { + if (OmnipodUtil.getDriverState() == OmnipodDriverState.Initalized_PodAttached) { if (pumpStatusLocal.timeChangeEventEnabled) { LOG.info(getLogPrefix() + "Time,and/or TimeZone changed event received and will be consumed by driver."); this.hasTimeDateOrTimeZoneChanged = true; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationService.java index 7222376e7e..2fc3a4339a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationService.java @@ -28,15 +28,15 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; 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.state.PodState; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommunicationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPacketTypeException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalResponseException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NonceOutOfSyncException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NonceResyncException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NotEnoughDataException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalResponseException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceResyncException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException; 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.exception.PodReturnedErrorResponseException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodReturnedErrorResponseException; /** * Created by andy on 6/29/18. 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 3acaa7e712..8a461d5b31 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 @@ -37,12 +37,12 @@ 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.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateChangedHandler; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommunicationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalDeliveryStatusException; -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.comm.exception.CommunicationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalDeliveryStatusException; +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.exception.OmnipodException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodFaultException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; import info.nightscout.androidaps.utils.SP; import io.reactivex.Completable; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/AcknowledgeAlertsAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/AcknowledgeAlertsAction.java index 70cea8da0a..a6baa7e2ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/AcknowledgeAlertsAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/AcknowledgeAlertsAction.java @@ -8,7 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet; import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot; 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.comm.exception.ActionInitializationException; public class AcknowledgeAlertsAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/BolusAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/BolusAction.java index 49bff8bff0..0cecf23c06 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/BolusAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/BolusAction.java @@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetI import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BolusDeliverySchedule; 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.comm.exception.ActionInitializationException; public class BolusAction implements OmnipodAction { private final PodSessionState podState; 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 9dc84d18ab..b7db3b4eca 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 @@ -12,7 +12,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType; 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.comm.exception.ActionInitializationException; public class CancelDeliveryAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigureAlertsAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigureAlertsAction.java index b89588b72b..9f7a202fc2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigureAlertsAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigureAlertsAction.java @@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.Conf import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfiguration; 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.comm.exception.ActionInitializationException; public class ConfigureAlertsAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java index 8b60c92e6b..9ac2ccc74e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java @@ -12,9 +12,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus; import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPacketTypeException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPodProgressException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalSetupProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; public class ConfigurePodAction implements OmnipodAction { 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 e88fafdb6c..a953a4280c 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 @@ -7,8 +7,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.Deac import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; 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; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException; public class DeactivatePodAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetPodInfoAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetPodInfoAction.java index a120bc02d9..5925a3b831 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetPodInfoAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetPodInfoAction.java @@ -5,7 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetS import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType; 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.comm.exception.ActionInitializationException; public class GetPodInfoAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetStatusAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetStatusAction.java index a76f7cd3fa..79db3256c1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetStatusAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/GetStatusAction.java @@ -5,7 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetS import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType; 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.comm.exception.ActionInitializationException; public class GetStatusAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/InsertCannulaAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/InsertCannulaAction.java index f2cc3328d3..4505ae7a60 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/InsertCannulaAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/InsertCannulaAction.java @@ -9,8 +9,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta 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.state.PodSessionState; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.ActionInitializationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalSetupProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException; public class InsertCannulaAction implements OmnipodAction { private static final Logger LOG = LoggerFactory.getLogger(InsertCannulaAction.class); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/PrimeAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/PrimeAction.java index 57eff83694..65d250e399 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/PrimeAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/PrimeAction.java @@ -9,8 +9,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus; import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress; 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.IllegalSetupProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException; public class PrimeAction implements OmnipodAction { private static final Logger LOG = LoggerFactory.getLogger(PrimeAction.class); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetBasalScheduleAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetBasalScheduleAction.java index f954a2c466..49b9bd3010 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetBasalScheduleAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetBasalScheduleAction.java @@ -9,12 +9,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessa import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.BasalScheduleExtraCommand; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetInsulinScheduleCommand; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; -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.schedule.BasalSchedule; 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.IllegalDeliveryStatusException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException; public class SetBasalScheduleAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetTempBasalAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetTempBasalAction.java index 52c37d329c..b1288ab242 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetTempBasalAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetTempBasalAction.java @@ -12,7 +12,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetI import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.TempBasalExtraCommand; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; 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.comm.exception.ActionInitializationException; public class SetTempBasalAction implements OmnipodAction { private final PodSessionState podState; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/ActionInitializationException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/ActionInitializationException.java similarity index 51% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/ActionInitializationException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/ActionInitializationException.java index f451192510..5682b0c6c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/ActionInitializationException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/ActionInitializationException.java @@ -1,4 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class ActionInitializationException extends OmnipodException { public ActionInitializationException(String message) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommandInitializationException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommandInitializationException.java similarity index 65% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommandInitializationException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommandInitializationException.java index 79e54934ca..cb0553f292 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommandInitializationException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommandInitializationException.java @@ -1,4 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class CommandInitializationException extends OmnipodException { public CommandInitializationException(String message) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommunicationException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommunicationException.java similarity index 83% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommunicationException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommunicationException.java index d33da5a3e1..c7392fd42e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CommunicationException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CommunicationException.java @@ -1,4 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class CommunicationException extends OmnipodException { private final Type type; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CrcMismatchException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CrcMismatchException.java similarity index 76% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CrcMismatchException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CrcMismatchException.java index c75a173c44..3de98e6f49 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/CrcMismatchException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/CrcMismatchException.java @@ -1,7 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; + public class CrcMismatchException extends OmnipodException { private final int expected; private final int actual; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalDeliveryStatusException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalDeliveryStatusException.java similarity index 83% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalDeliveryStatusException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalDeliveryStatusException.java index f8aa00586d..01bf4db04f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalDeliveryStatusException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalDeliveryStatusException.java @@ -1,9 +1,10 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class IllegalDeliveryStatusException extends OmnipodException { private final DeliveryStatus expected; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPacketTypeException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPacketTypeException.java similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPacketTypeException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPacketTypeException.java index 0e4fb1da2e..9856d3368c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPacketTypeException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPacketTypeException.java @@ -1,8 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class IllegalPacketTypeException extends OmnipodException { private final PacketType expected; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPodProgressException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPodProgressException.java similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPodProgressException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPodProgressException.java index 0b88427d76..e4e575405e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalPodProgressException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalPodProgressException.java @@ -1,8 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class IllegalPodProgressException extends OmnipodException { private final PodProgressStatus expected; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalResponseException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalResponseException.java similarity index 83% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalResponseException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalResponseException.java index fc38ef92f3..647309c478 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalResponseException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalResponseException.java @@ -1,8 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class IllegalResponseException extends OmnipodException { private final String actualClass; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalSetupProgressException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalSetupProgressException.java similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalSetupProgressException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalSetupProgressException.java index 402c40820d..852d5ea3c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/IllegalSetupProgressException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/IllegalSetupProgressException.java @@ -1,8 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import java.util.Locale; import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class IllegalSetupProgressException extends OmnipodException { private final SetupProgress expected; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/MessageDecodingException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/MessageDecodingException.java similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/MessageDecodingException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/MessageDecodingException.java index aff582cfcf..5e1c4f3523 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/MessageDecodingException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/MessageDecodingException.java @@ -1,4 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class MessageDecodingException extends OmnipodException { public MessageDecodingException(String message) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceOutOfSyncException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceOutOfSyncException.java new file mode 100644 index 0000000000..929afbb855 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceOutOfSyncException.java @@ -0,0 +1,9 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; + +public class NonceOutOfSyncException extends OmnipodException { + public NonceOutOfSyncException() { + super("Nonce out of sync", true); + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceResyncException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceResyncException.java new file mode 100644 index 0000000000..a4910c9a42 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NonceResyncException.java @@ -0,0 +1,9 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; + +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; + +public class NonceResyncException extends OmnipodException { + public NonceResyncException() { + super("Nonce resync failed", true); + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NotEnoughDataException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NotEnoughDataException.java similarity index 71% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NotEnoughDataException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NotEnoughDataException.java index b067a5590d..728fa4d734 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NotEnoughDataException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/NotEnoughDataException.java @@ -1,6 +1,7 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class NotEnoughDataException extends OmnipodException { private final byte[] data; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodFaultException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodFaultException.java similarity index 75% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodFaultException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodFaultException.java index 77e6a9c900..6269f1c39c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodFaultException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodFaultException.java @@ -1,6 +1,7 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class PodFaultException extends OmnipodException { private final PodInfoFaultEvent faultEvent; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodReturnedErrorResponseException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodReturnedErrorResponseException.java similarity index 77% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodReturnedErrorResponseException.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodReturnedErrorResponseException.java index 2f1d083a67..f43987b755 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/PodReturnedErrorResponseException.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/exception/PodReturnedErrorResponseException.java @@ -1,6 +1,7 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; +package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.ErrorResponse; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException; public class PodReturnedErrorResponseException extends OmnipodException { private final ErrorResponse errorResponse; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodMessage.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodMessage.java index f3dc4a1856..c328997172 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodMessage.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodMessage.java @@ -7,9 +7,9 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand; import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CrcMismatchException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.MessageDecodingException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NotEnoughDataException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.MessageDecodingException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC; public class OmnipodMessage { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java index a065801081..fd90ffb640 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.message; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CrcMismatchException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPacketTypeException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC; /** diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommand.java index e12aece3fc..3554f85e0a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommand.java @@ -5,7 +5,7 @@ import org.joda.time.Duration; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommandInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; public class BolusExtraCommand extends MessageBlock { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommand.java index 8f1dae6edb..301435e6a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommand.java @@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedu import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BolusDeliverySchedule; import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.DeliverySchedule; import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.TempBasalDeliverySchedule; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommandInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommand.java index 8f21c69a5e..212f748bf1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommand.java @@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.RateEntry; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommandInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; public class TempBasalExtraCommand extends MessageBlock { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java index 1b98976aa5..66d4ea1056 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages; import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction; import com.atech.android.library.wizardpager.defs.action.FinishActionInterface; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType; import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState; @@ -36,8 +37,15 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish @Override public void execute() { - OmnipodUtil.setDriverState(actionType==PodActionType.InitPod ? - OmnipodDriverState.Initalized_PodAvailable : OmnipodDriverState.Initalized_NoPod); + if (actionType==PodActionType.InitPod) { + if (OmnipodUtil.getPodSessionState().getSetupProgress().isBefore(SetupProgress.COMPLETED)) { + OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodInitializing); + } else { + OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAttached); + } + } else { + OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod); + } podManagementActivity.refreshButtons(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java index 8e619dcecb..c2910dab89 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java @@ -2,8 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver; public enum OmnipodDriverState { - NotInitalized, - Initalized_NoPod, - Initalized_PodAvailable, + NotInitalized, // when we start + Initalized_NoPod, // driver is initalized, but there is no pod + Initalized_PodInitializing, // driver is initalized, pod is initalizing + Initalized_PodAttached, // driver is initalized, pod is there } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java index 17a54953d3..8399bfdf4b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java @@ -55,22 +55,22 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory; import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistoryEntryType; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.ActionInitializationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommandInitializationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommunicationException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.CrcMismatchException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalDeliveryStatusException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPacketTypeException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalPodProgressException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalResponseException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.IllegalSetupProgressException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.MessageDecodingException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NonceOutOfSyncException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NonceResyncException; -import info.nightscout.androidaps.plugins.pump.omnipod.exception.NotEnoughDataException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException; +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.IllegalPodProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalResponseException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.MessageDecodingException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceResyncException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException; 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.exception.PodReturnedErrorResponseException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodReturnedErrorResponseException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import io.reactivex.disposables.Disposable; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceOutOfSyncException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceOutOfSyncException.java deleted file mode 100644 index 79e63bd05d..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceOutOfSyncException.java +++ /dev/null @@ -1,7 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; - -public class NonceOutOfSyncException extends OmnipodException { - public NonceOutOfSyncException() { - super("Nonce out of sync", true); - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceResyncException.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceResyncException.java deleted file mode 100644 index fd37149c75..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/exception/NonceResyncException.java +++ /dev/null @@ -1,7 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.exception; - -public class NonceResyncException extends OmnipodException { - public NonceResyncException() { - super("Nonce resync failed", true); - } -}