diff --git a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index 0e5f06d05c..d5a04bdc2e 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory; import de.jotomo.ruffyscripter.commands.Command; import de.jotomo.ruffyscripter.commands.CommandException; import de.jotomo.ruffyscripter.commands.CommandResult; -import de.jotomo.ruffyscripter.commands.PumpAlert; import de.jotomo.ruffyscripter.commands.PumpState; // TODO regularly read "My data" history (boluses, TBR) to double check all commands ran successfully. @@ -122,8 +121,6 @@ public class RuffyScripter { synchronized (this) { cmdResult = null; activeCmd = cmd; - final RuffyScripter scripter = this; - // TODO hackish, to say the least ... // wait till pump is ready for input waitForMenuUpdate(); // check if pump is an an error state @@ -134,10 +131,8 @@ public class RuffyScripter { 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 log.debug("Cmd execution: connection ready, executing cmd " + cmd); + final RuffyScripter scripter = this; cmdThread = new Thread(new Runnable() { @Override public void run() { @@ -240,7 +235,6 @@ public class RuffyScripter { } public void pressMenuKey() { - // TODO build 'wait for menu update' into this method? get current menu, press key, wait for update? log.debug("Pressing menu key"); pressKey(Key.MENU); log.debug("Releasing menu key"); @@ -260,17 +254,6 @@ public class RuffyScripter { } } - /** - * "Virtual" key, emulated by pressing menu and up simultaneously - */ - // Doesn't work -/* public void pressBackKey() throws RemoteException { - ruffyService.rtSendKey(Key.MENU, true); - SystemClock.sleep(50); - ruffyService.rtSendKey(Key.UP, true); - SystemClock.sleep(100); - ruffyService.rtSendKey(Key.NO_KEY, true); - }*/ private void pressKey(final byte key) { try { ruffyService.rtSendKey(key, true); diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java index e87a4ebf2d..043a2de388 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; import de.jotomo.ruffyscripter.RuffyScripter; // TODO robustness: can a TBR run out, whilst we're trying to cancel it? +// Hm, we could just ignore TBRs that run out within the next 60s (0:01 or even 0:02 +// given we need some time to process the request). public class CancelTbrCommand implements Command { private static final Logger log = LoggerFactory.getLogger(CancelTbrCommand.class); diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/Command.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/Command.java index c70384ae36..4763d5d521 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/Command.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/Command.java @@ -4,8 +4,4 @@ import de.jotomo.ruffyscripter.RuffyScripter; public interface Command { CommandResult execute(RuffyScripter ruffyScripter); - -// default String toString() { -// return getClass().getSimpleName(); -// } } diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java index c12d588a51..f826f8a753 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java @@ -110,7 +110,6 @@ public class SetTbrCommand implements Command { for (int i = 0; i < percentageSteps; i++) { if (increasePercentage) scripter.pressUpKey(); else scripter.pressDownKey(); - // TODO waitForMenuChange instead // or have key press method handle that?? SystemClock.sleep(100); log.debug("Push #" + (i + 1)); } @@ -159,7 +158,6 @@ public class SetTbrCommand implements Command { for (int i = 0; i < durationSteps; i++) { if (increaseDuration) scripter.pressUpKey(); else scripter.pressDownKey(); - // TODO waitForMenuChange instead // or have key press method handle that?? SystemClock.sleep(100); log.debug("Push #" + (i + 1)); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 9cf3dd8559..707cde8764 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -209,7 +209,6 @@ public class ComboPlugin implements PluginBase, PumpInterface { return false; } - // TODO @Override public boolean isBusy() { return ruffyScripter.isPumpBusy(); @@ -227,7 +226,6 @@ public class ComboPlugin implements PluginBase, PumpInterface { return false; } - // TODO @Override public Date lastDataTime() { return lastCmdTime;