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