- fix for #44
This commit is contained in:
parent
a719d44851
commit
7628e1d0a7
2 changed files with 20 additions and 10 deletions
|
@ -9,6 +9,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodResponseType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +52,14 @@ public class OmnipodUIPostprocessor {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case CancelTemporaryBasal: {
|
||||||
|
pumpStatus.tempBasalStart = 0;
|
||||||
|
pumpStatus.tempBasalEnd = 0;
|
||||||
|
pumpStatus.tempBasalAmount = null;
|
||||||
|
pumpStatus.tempBasalLength = null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// case PairAndPrimePod: {
|
// case PairAndPrimePod: {
|
||||||
// if (uiTask.returnData.success) {
|
// if (uiTask.returnData.success) {
|
||||||
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);
|
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);
|
||||||
|
@ -82,6 +91,10 @@ public class OmnipodUIPostprocessor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class OmnipodUITask {
|
||||||
public PumpEnactResult returnData;
|
public PumpEnactResult returnData;
|
||||||
private String errorDescription;
|
private String errorDescription;
|
||||||
private Object[] parameters;
|
private Object[] parameters;
|
||||||
private PodResponseType responseType;
|
public PodResponseType responseType;
|
||||||
public Object returnDataObject;
|
public Object returnDataObject;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,15 +51,9 @@ public class OmnipodUITask {
|
||||||
LOG.debug("OmnipodUITask: @@@ In execute. {}", commandType);
|
LOG.debug("OmnipodUITask: @@@ In execute. {}", commandType);
|
||||||
|
|
||||||
switch (commandType) {
|
switch (commandType) {
|
||||||
// TODO add commands this is just sample
|
|
||||||
// case PumpModel: {
|
|
||||||
// returnData = communicationManager.getPumpModel();
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
|
|
||||||
case PairAndPrimePod:
|
case PairAndPrimePod:
|
||||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], null);
|
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], null);
|
||||||
// TODO returnData = communicationManager.pairAndPrime();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FillCanulaAndSetBasalProfile:
|
case FillCanulaAndSetBasalProfile:
|
||||||
|
@ -72,7 +66,6 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
case ResetPodStatus:
|
case ResetPodStatus:
|
||||||
returnData = communicationManager.resetPodStatus();
|
returnData = communicationManager.resetPodStatus();
|
||||||
// TODO returnData = communicationManager.resetPodState();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SetBasalProfile:
|
case SetBasalProfile:
|
||||||
|
@ -85,7 +78,6 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
if (amount != null)
|
if (amount != null)
|
||||||
returnData = communicationManager.setBolus(amount, isSmb);
|
returnData = communicationManager.setBolus(amount, isSmb);
|
||||||
// TODO returnData = communicationManager.bolus(amount);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -96,12 +88,14 @@ public class OmnipodUITask {
|
||||||
for(int i = 0; 3 > i; i++) {
|
for(int i = 0; 3 > i; i++) {
|
||||||
try {
|
try {
|
||||||
returnDataObject = communicationManager.readPulseLog();
|
returnDataObject = communicationManager.readPulseLog();
|
||||||
|
responseType = PodResponseType.Acknowledgment;
|
||||||
break;
|
break;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (isLogEnabled()) {
|
if (isLogEnabled()) {
|
||||||
LOG.warn("Failed to retrieve pulse log", ex);
|
LOG.warn("Failed to retrieve pulse log", ex);
|
||||||
}
|
}
|
||||||
returnDataObject = null;
|
returnDataObject = null;
|
||||||
|
responseType = PodResponseType.Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -136,11 +130,14 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
||||||
|
responseType = PodResponseType.Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO response
|
if (returnData!=null) {
|
||||||
|
responseType = returnData.success ? PodResponseType.Acknowledgment : PodResponseType.Error;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue