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)
This commit is contained in:
Johannes Mockenhaupt 2017-08-27 19:08:27 +02:00
parent fea1309fa3
commit b53db22ae1
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -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?