From e01e85c54f06e9148d57dc38ca67b64941752a63 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 15 Jul 2017 16:14:11 +0200 Subject: [PATCH] On connect, check if pump is in an error state. --- .../main/java/de/jotomo/ruffyscripter/RuffyScripter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index a26cf8acbd..69aa33bc44 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -126,6 +126,15 @@ public class RuffyScripter { // TODO hackish, to say the least ... // wait till pump is ready for input waitForMenuUpdate(); + // check if pump is an an error state + if (currentMenu != null && currentMenu.getType() == MenuType.WARNING_OR_ERROR) { + try { + PumpAlert alert = readDisplayPumpAlert(); + return new CommandResult().message("Pump is in an error state: " + alert + " (" + alert.code + ")"); + } catch (Exception e) { + return new CommandResult().message("Pump is in an error state, reading the error state resulted in the attached exception").exception(e); + } + } // TODO check pump state; currently most command check their in the MAIN_MENU; // run ReadStateCommand, which handles possible states ... and then do wait? // Return an unsuccessful CommandResult and make the caller do something loud with it