diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index dc1dea851f..aa6789844c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -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(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java index 5805fc550e..d7239d240f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java @@ -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) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java index 50ff2192c2..fdd8787806 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java @@ -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)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index b92ffdf2f5..64b4610c7f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -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]; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java index f03a3b056b..90c88953db 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java @@ -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; }