- added CustomeAction for FillCanula
This commit is contained in:
parent
5becad4127
commit
7ab813ef22
11 changed files with 92 additions and 25 deletions
|
@ -28,14 +28,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) {
|
||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
|
||||
PumpEnactResult result = delegate.pairAndPrime();
|
||||
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
||||
return result;
|
||||
} else if(PodInitActionType.FillCannulaWizardStep.equals(podInitActionType)) {
|
||||
} else if (PodInitActionType.FillCannulaSetBasalProfileWizardStep.equals(podInitActionType)) {
|
||||
// FIXME we need a basal profile here
|
||||
PumpEnactResult result = delegate.insertCannula(null);
|
||||
PumpEnactResult result = delegate.insertCannula(profile);
|
||||
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionT
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.LogReceiver;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
|
@ -763,8 +765,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
private CustomAction customActionResetRLConfig = new CustomAction(
|
||||
R.string.medtronic_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
|
||||
|
||||
protected CustomAction customActionInitPod = new CustomAction(
|
||||
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.InitPod, true);
|
||||
protected CustomAction customActionPairAndPrime = new CustomAction(
|
||||
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.PairAndPrime, true);
|
||||
|
||||
protected CustomAction customActionFillCanullaSetBasalProfile = new CustomAction(
|
||||
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.FillCanulaSetBasalProfile, false);
|
||||
|
||||
protected CustomAction customActionDeactivatePod = new CustomAction(
|
||||
R.string.omnipod_cmd_deactivate_pod, OmnipodCustomActionType.DeactivatePod, false);
|
||||
|
@ -779,7 +784,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
if (customActions == null) {
|
||||
this.customActions = Arrays.asList(
|
||||
customActionResetRLConfig, //
|
||||
customActionInitPod, //
|
||||
customActionPairAndPrime, //
|
||||
customActionFillCanullaSetBasalProfile, //
|
||||
customActionDeactivatePod, //
|
||||
customActionResetPod);
|
||||
}
|
||||
|
@ -787,6 +793,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return this.customActions;
|
||||
}
|
||||
|
||||
|
||||
LogReceiver logReceiver = new LogReceiver();
|
||||
|
||||
// TODO we need to brainstorm how we want to do this -- Andy
|
||||
@Override
|
||||
public void executeCustomAction(CustomActionType customActionType) {
|
||||
|
@ -800,8 +809,13 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
break;
|
||||
|
||||
case InitPod: {
|
||||
omnipodUIComm.executeCommand(OmnipodCommandType.InitPod);
|
||||
case PairAndPrime: {
|
||||
omnipodUIComm.executeCommand(OmnipodCommandType.PairAndPrimePod, PodInitActionType.PairAndPrimeWizardStep, logReceiver);
|
||||
}
|
||||
break;
|
||||
|
||||
case FillCanulaSetBasalProfile: {
|
||||
omnipodUIComm.executeCommand(OmnipodCommandType.FillCanulaAndSetBasalProfile, PodInitActionType.FillCannulaSetBasalProfileWizardStep, this.currentProfile, logReceiver);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -835,11 +849,17 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
switch (customAction) {
|
||||
|
||||
case InitPod: {
|
||||
this.customActionInitPod.setEnabled(isEnabled);
|
||||
case PairAndPrime: {
|
||||
this.customActionPairAndPrime.setEnabled(isEnabled);
|
||||
}
|
||||
break;
|
||||
|
||||
case FillCanulaSetBasalProfile: {
|
||||
this.customActionFillCanullaSetBasalProfile.setEnabled(isEnabled);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case DeactivatePod: {
|
||||
this.customActionDeactivatePod.setEnabled(isEnabled);
|
||||
}
|
||||
|
|
|
@ -33,15 +33,26 @@ public class OmnipodUIPostprocessor {
|
|||
|
||||
switch (uiTask.commandType) {
|
||||
|
||||
case InitPod: {
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.InitPod, false);
|
||||
case PairAndPrimePod: {
|
||||
if (uiTask.returnData.success) {
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, true);
|
||||
}
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case FillCanulaAndSetBasalProfile: {
|
||||
if (uiTask.returnData.success) {
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, false);
|
||||
}
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case DeactivatePod:
|
||||
case ResetPodStatus: {
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.InitPod, true);
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, true);
|
||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, false);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -56,8 +56,13 @@ public class OmnipodUITask {
|
|||
// }
|
||||
// break;
|
||||
|
||||
case InitPod:
|
||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1]);
|
||||
case PairAndPrimePod:
|
||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], null);
|
||||
// TODO returnData = communicationManager.pairAndPrime();
|
||||
break;
|
||||
|
||||
case FillCanulaAndSetBasalProfile:
|
||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], (Profile) parameters[2]);
|
||||
// TODO returnData = communicationManager.pairAndPrime();
|
||||
break;
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
|||
*/
|
||||
public enum OmnipodCommandType {
|
||||
|
||||
InitPod, //
|
||||
PairAndPrimePod, //
|
||||
FillCanulaAndSetBasalProfile, //
|
||||
//InitPod, //
|
||||
DeactivatePod, //
|
||||
SetBasalProfile, //
|
||||
SetBolus, //
|
||||
|
|
|
@ -11,7 +11,7 @@ public interface OmnipodCommunicationManagerInterface {
|
|||
/**
|
||||
* Initialize Pod
|
||||
*/
|
||||
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver);
|
||||
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile);
|
||||
|
||||
/**
|
||||
* Get Pod Status (is pod running, battery left ?, reservoir, etc)
|
||||
|
|
|
@ -9,7 +9,9 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
|||
public enum OmnipodCustomActionType implements CustomActionType {
|
||||
|
||||
ResetRileyLinkConfiguration(), //
|
||||
InitPod(), //
|
||||
PairAndPrime(), //
|
||||
FillCanulaSetBasalProfile(), //
|
||||
//InitPod(), //
|
||||
DeactivatePod(), //
|
||||
ResetPodStatus(), //
|
||||
;
|
||||
|
|
|
@ -10,9 +10,9 @@ public enum PodInitActionType {
|
|||
PairPod(PairAndPrimeWizardStep), //
|
||||
PrimePod(PairAndPrimeWizardStep), //
|
||||
|
||||
FillCannulaWizardStep,
|
||||
FillCannula(FillCannulaWizardStep),
|
||||
SetBasalProfile(FillCannulaWizardStep);
|
||||
FillCannulaSetBasalProfileWizardStep,
|
||||
FillCannula(FillCannulaSetBasalProfileWizardStep),
|
||||
SetBasalProfile(FillCannulaSetBasalProfileWizardStep);
|
||||
|
||||
|
||||
private PodInitActionType[] parent;
|
||||
|
@ -41,7 +41,7 @@ public enum PodInitActionType {
|
|||
|
||||
if (podType == OmnipodPodType.Eros) {
|
||||
outList.add(PodInitActionType.PairAndPrimeWizardStep);
|
||||
outList.add(PodInitActionType.FillCannulaWizardStep);
|
||||
outList.add(PodInitActionType.FillCannulaSetBasalProfileWizardStep);
|
||||
} else {
|
||||
// TODO we might have different wizard steps, with different handling for Dash
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||
|
||||
public class LogReceiver implements PodInitReceiver {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LogReceiver.class);
|
||||
|
||||
@Override
|
||||
public void returnInitTaskStatus(PodInitActionType podInitActionType, boolean isSuccess, String errorMessage) {
|
||||
|
||||
if (errorMessage != null) {
|
||||
LOG.error(podInitActionType.name() + " - Success: " + isSuccess + ", Error Message: " + errorMessage);
|
||||
} else {
|
||||
if (isSuccess) {
|
||||
LOG.info(podInitActionType.name() + " - Success: " + isSuccess);
|
||||
} else {
|
||||
LOG.error(podInitActionType.name() + " - NOT Succesful");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -271,7 +271,8 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
|
||||
if (customActions == null) {
|
||||
this.customActions = Arrays.asList(
|
||||
customActionInitPod, //
|
||||
customActionPairAndPrime, //
|
||||
customActionFillCanullaSetBasalProfile, //
|
||||
customActionDeactivatePod, //
|
||||
customActionResetPod);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
|||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) {
|
||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue