- added additional init step in enum in case Ibnit failed

- moved al lot of exception files into different package
This commit is contained in:
Andy Rozman 2020-03-16 09:16:45 +00:00
parent 8c803f7e0c
commit 51fea3b912
44 changed files with 137 additions and 94 deletions

View file

@ -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() + '"'

View file

@ -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() {

View file

@ -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;
}

View file

@ -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()

View file

@ -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;

View file

@ -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.

View file

@ -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;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<VersionResponse> {

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<PodInfoResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private static final Logger LOG = LoggerFactory.getLogger(InsertCannulaAction.class);

View file

@ -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<StatusResponse> {
private static final Logger LOG = LoggerFactory.getLogger(PrimeAction.class);

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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<StatusResponse> {
private final PodSessionState podState;

View file

@ -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) {

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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;
/**

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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();
}

View file

@ -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
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -1,7 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.exception;
public class NonceResyncException extends OmnipodException {
public NonceResyncException() {
super("Nonce resync failed", true);
}
}