Distinguish between normal bolus and SMB in AapsOmnipodManager

This commit is contained in:
Bart Sopers 2019-12-07 16:18:37 +01:00
parent b186f01c11
commit 3860a95e20
5 changed files with 16 additions and 13 deletions

View file

@ -43,9 +43,6 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
@ -54,9 +51,12 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInt
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.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
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.driver.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;
@ -314,7 +314,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
@Override
public boolean isSuspended() {
return (pumpStatusLocal!=null && !pumpStatusLocal.podAvailable);
return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable);
}
@Override
@ -509,7 +509,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
try {
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetBolus,
detailedBolusInfo.insulin);
detailedBolusInfo.insulin, detailedBolusInfo.isSMB);
PumpEnactResult result = responseTask.getResult();

View file

@ -40,7 +40,7 @@ public interface OmnipodCommunicationManagerInterface {
*
* @param amount amount of bolus in U
*/
PumpEnactResult setBolus(Double amount);
PumpEnactResult setBolus(Double amount, boolean isSmb);
/**
* Cancel Bolus (if bolus is already stopped, return acknowledgment)

View file

@ -147,15 +147,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
return new PumpEnactResult().success(true).enacted(true);
}
// TODO add boolean isSmb so we can disable progress indication for SMB
@Override
public PumpEnactResult setBolus(Double units/*, boolean isSmb*/) {
public PumpEnactResult setBolus(Double units, boolean isSmb) {
OmnipodManager.BolusCommandResult bolusCommandResult;
boolean beepsEnabled = /* isSmb ? isSmbBeepsEnabled() : */ isBolusBeepsEnabled();
boolean beepsEnabled = isSmb ? isSmbBeepsEnabled() : isBolusBeepsEnabled();
try {
bolusCommandResult = delegate.bolus(units, beepsEnabled, beepsEnabled, /* isSmb ? null : */
bolusCommandResult = delegate.bolus(units, beepsEnabled, beepsEnabled, isSmb ? null :
(estimatedUnitsDelivered, percentage) -> {
EventOverviewBolusProgress progressUpdateEvent = EventOverviewBolusProgress.INSTANCE;
progressUpdateEvent.setStatus(getStringResource(R.string.bolusdelivering, units));

View file

@ -80,9 +80,10 @@ public class OmnipodUITask {
case SetBolus: {
Double amount = getDoubleFromParameters(0);
boolean isSmb = getBooleanFromParameters(1);
if (amount != null)
returnData = communicationManager.setBolus(amount);
returnData = communicationManager.setBolus(amount, isSmb);
// TODO returnData = communicationManager.bolus(amount);
}
break;
@ -138,6 +139,9 @@ public class OmnipodUITask {
return (Double) parameters[index];
}
public boolean getBooleanFromParameters(int index) {
return (boolean) parameters[index];
}
public Integer getIntegerFromParameters(int index) {
return (Integer) parameters[index];

View file

@ -85,7 +85,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
return null;
}
public PumpEnactResult setBolus(Double parameter) {
public PumpEnactResult setBolus(Double parameter, boolean isSmb) {
return null;
}