Distinguish between normal bolus and SMB in AapsOmnipodManager
This commit is contained in:
parent
b186f01c11
commit
3860a95e20
5 changed files with 16 additions and 13 deletions
|
@ -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.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
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.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.OmnipodCommandType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
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.OmnipodStatusRequest;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
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.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.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.driver.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.LogReceiver;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
|
@ -314,7 +314,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuspended() {
|
public boolean isSuspended() {
|
||||||
return (pumpStatusLocal!=null && !pumpStatusLocal.podAvailable);
|
return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -509,7 +509,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
try {
|
try {
|
||||||
|
|
||||||
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetBolus,
|
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetBolus,
|
||||||
detailedBolusInfo.insulin);
|
detailedBolusInfo.insulin, detailedBolusInfo.isSMB);
|
||||||
|
|
||||||
PumpEnactResult result = responseTask.getResult();
|
PumpEnactResult result = responseTask.getResult();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public interface OmnipodCommunicationManagerInterface {
|
||||||
*
|
*
|
||||||
* @param amount amount of bolus in U
|
* @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)
|
* Cancel Bolus (if bolus is already stopped, return acknowledgment)
|
||||||
|
|
|
@ -147,15 +147,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add boolean isSmb so we can disable progress indication for SMB
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setBolus(Double units/*, boolean isSmb*/) {
|
public PumpEnactResult setBolus(Double units, boolean isSmb) {
|
||||||
OmnipodManager.BolusCommandResult bolusCommandResult;
|
OmnipodManager.BolusCommandResult bolusCommandResult;
|
||||||
|
|
||||||
boolean beepsEnabled = /* isSmb ? isSmbBeepsEnabled() : */ isBolusBeepsEnabled();
|
boolean beepsEnabled = isSmb ? isSmbBeepsEnabled() : isBolusBeepsEnabled();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bolusCommandResult = delegate.bolus(units, beepsEnabled, beepsEnabled, /* isSmb ? null : */
|
bolusCommandResult = delegate.bolus(units, beepsEnabled, beepsEnabled, isSmb ? null :
|
||||||
(estimatedUnitsDelivered, percentage) -> {
|
(estimatedUnitsDelivered, percentage) -> {
|
||||||
EventOverviewBolusProgress progressUpdateEvent = EventOverviewBolusProgress.INSTANCE;
|
EventOverviewBolusProgress progressUpdateEvent = EventOverviewBolusProgress.INSTANCE;
|
||||||
progressUpdateEvent.setStatus(getStringResource(R.string.bolusdelivering, units));
|
progressUpdateEvent.setStatus(getStringResource(R.string.bolusdelivering, units));
|
||||||
|
|
|
@ -80,9 +80,10 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
case SetBolus: {
|
case SetBolus: {
|
||||||
Double amount = getDoubleFromParameters(0);
|
Double amount = getDoubleFromParameters(0);
|
||||||
|
boolean isSmb = getBooleanFromParameters(1);
|
||||||
|
|
||||||
if (amount != null)
|
if (amount != null)
|
||||||
returnData = communicationManager.setBolus(amount);
|
returnData = communicationManager.setBolus(amount, isSmb);
|
||||||
// TODO returnData = communicationManager.bolus(amount);
|
// TODO returnData = communicationManager.bolus(amount);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -138,6 +139,9 @@ public class OmnipodUITask {
|
||||||
return (Double) parameters[index];
|
return (Double) parameters[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBooleanFromParameters(int index) {
|
||||||
|
return (boolean) parameters[index];
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getIntegerFromParameters(int index) {
|
public Integer getIntegerFromParameters(int index) {
|
||||||
return (Integer) parameters[index];
|
return (Integer) parameters[index];
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PumpEnactResult setBolus(Double parameter) {
|
public PumpEnactResult setBolus(Double parameter, boolean isSmb) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue