From b53db22ae14952656906d4e70d87630ac9e72584 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 27 Aug 2017 19:08:27 +0200 Subject: [PATCH] Report bolus delivered if the pump raised a warning/error during delivery. Most likely this is due to a low cartridge warning, but might also be an occlusion alert. This lets the alarm ring and asks the user to check it. The treatment is also recorded in the db as enacted. (cherry picked from commit 6cc017a) --- .../de/jotomo/ruffyscripter/commands/BolusCommand.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java index bc81be3942..84f56e62e7 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java @@ -58,9 +58,16 @@ public class BolusCommand extends BaseCommand { while (bolusRemaining != null) { log.debug("Delivering bolus, remaining: " + bolusRemaining); SystemClock.sleep(200); + if (scripter.getCurrentMenu().getType() == MenuType.WARNING_OR_ERROR) { + throw new CommandException().success(false).enacted(true) + .message("Warning/error raised after bolus delivery started. " + + "The treatment has been recorded, please check it against the " + + "pumps records and delete it if it hasn't finished successfully."); + } bolusRemaining = (Double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING); } + // TODO what if we hit 'cartridge low' alert here? is it immediately displayed or after the bolus? // TODO how are error states reported back to the caller that occur outside of calls in genal? Low battery, low cartridge?