Combo: ruffyscripter: abort a command if an unparsable menu is encountered.

This happens when the pump is misconfigured (e.g. quick info is
labeled wrong), or the bolus history has no entries yet.
This commit is contained in:
Johannes Mockenhaupt 2018-03-17 14:06:39 +01:00
parent 926bea55c0
commit 30a191c6eb
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -56,6 +56,8 @@ public class RuffyScripter implements RuffyCommands {
@Nullable
private volatile Menu currentMenu;
private volatile long menuLastUpdated = 0;
private volatile boolean unparsableMenuEncountered;
private String previousCommand = "<none>";
private volatile Command activeCmd = null;
@ -125,6 +127,7 @@ public class RuffyScripter implements RuffyCommands {
@Override
public void rtDisplayHandleNoMenu() throws RemoteException {
log.warn("rtDisplayHandleNoMenu callback invoked");
unparsableMenuEncountered = true;
}
};
@ -323,6 +326,12 @@ public class RuffyScripter implements RuffyCommands {
break;
}
if (unparsableMenuEncountered) {
log.error("UnparsableMenuEncountered flagged, aborting command");
cmdThread.interrupt();
activeCmd.getResult().success = false;
}
log.trace("Waiting for running command to complete");
SystemClock.sleep(500);
}