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:
parent
926bea55c0
commit
30a191c6eb
1 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue