ExperimentalBolusCommand: update progress when starting to programm the pump.
This commit is contained in:
parent
cb24d13cae
commit
960586b79d
3 changed files with 22 additions and 8 deletions
|
@ -370,23 +370,26 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
|||
new ExperimentalBolusCommand.ProgressReportCallback() {
|
||||
@Override
|
||||
public void report(ExperimentalBolusCommand.ProgressReportCallback.State state, int percent, double delivered) {
|
||||
EventOverviewBolusProgress enent = EventOverviewBolusProgress.getInstance();
|
||||
EventOverviewBolusProgress event = EventOverviewBolusProgress.getInstance();
|
||||
switch (state) {
|
||||
case PROGRAMMING:
|
||||
event.status = MainApp.sResources.getString(R.string.bolusprogramming);
|
||||
break;
|
||||
case DELIVERING:
|
||||
enent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), delivered);
|
||||
event.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), delivered);
|
||||
break;
|
||||
case DELIVERED:
|
||||
enent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivered), delivered);
|
||||
event.status = String.format(MainApp.sResources.getString(R.string.bolusdelivered), delivered);
|
||||
break;
|
||||
case STOPPING:
|
||||
enent.status = MainApp.sResources.getString(R.string.bolusstopping);
|
||||
event.status = MainApp.sResources.getString(R.string.bolusstopping);
|
||||
break;
|
||||
case STOPPED:
|
||||
enent.status = MainApp.sResources.getString(R.string.bolusstopped);
|
||||
event.status = MainApp.sResources.getString(R.string.bolusstopped);
|
||||
break;
|
||||
}
|
||||
enent.percent = percent;
|
||||
MainApp.bus().post(enent);
|
||||
event.percent = percent;
|
||||
MainApp.bus().post(event);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.scripter.RuffyScripter;
|
|||
|
||||
import static info.nightscout.androidaps.plugins.PumpCombo.scripter.commands.ExperimentalBolusCommand.ProgressReportCallback.State.DELIVERED;
|
||||
import static info.nightscout.androidaps.plugins.PumpCombo.scripter.commands.ExperimentalBolusCommand.ProgressReportCallback.State.DELIVERING;
|
||||
import static info.nightscout.androidaps.plugins.PumpCombo.scripter.commands.ExperimentalBolusCommand.ProgressReportCallback.State.PROGRAMMING;
|
||||
import static info.nightscout.androidaps.plugins.PumpCombo.scripter.commands.ExperimentalBolusCommand.ProgressReportCallback.State.STOPPED;
|
||||
import static info.nightscout.androidaps.plugins.PumpCombo.scripter.commands.ExperimentalBolusCommand.ProgressReportCallback.State.STOPPING;
|
||||
|
||||
|
@ -44,8 +45,11 @@ public class ExperimentalBolusCommand extends BolusCommand {
|
|||
public CommandResult execute() {
|
||||
try {
|
||||
// TODO read reservoir level and reject request if reservoir < bolus
|
||||
enterBolusMenu();
|
||||
// TODO also check if there's a bolus in history we're not aware of
|
||||
// press check twice to get reservoir level and last bolus quickly
|
||||
|
||||
progressReportCallback.report(PROGRAMMING, 0, 0);
|
||||
enterBolusMenu();
|
||||
inputBolusAmount();
|
||||
verifyDisplayedBolusAmount();
|
||||
|
||||
|
@ -218,6 +222,7 @@ public class ExperimentalBolusCommand extends BolusCommand {
|
|||
|
||||
public interface ProgressReportCallback {
|
||||
enum State {
|
||||
PROGRAMMING,
|
||||
DELIVERING,
|
||||
DELIVERED,
|
||||
STOPPING,
|
||||
|
|
|
@ -730,5 +730,11 @@
|
|||
<string name="key_combo_disable_alerts">combo_disable_alerts</string>
|
||||
<string name="combo_disable_alerts">Disable alerts</string>
|
||||
<string name="combo_disable_alerts_summary">Ignore all errors encountered while communicating with the pump. Alerts raised by the pump (including those caused by AAPS) will still be raised.</string>
|
||||
<string name="bolusprogramming">Programming pump for bolusing</string>
|
||||
<string name="key_wizard_include_bg">wizard_include_bg</string>
|
||||
<string name="key_wizard_include_cob">wizard_include_cob</string>
|
||||
<string name="key_wizard_include_trend_bg">wizard_include_trend_bg</string>
|
||||
<string name="key_wizard_include_bolus_iob">wizard_include_bolus_iob</string>
|
||||
<string name="key_wizard_include_basal_iob">wizard_include_basal_iob</string>
|
||||
</resources>
|
||||
|
||||
|
|
Loading…
Reference in a new issue