Add Command.getReconnectAlarm() to safely confirm alerts caused by an interrupted command.
This commit is contained in:
parent
2b8b6828e5
commit
e800bd5092
|
@ -15,4 +15,11 @@ public abstract class BaseCommand implements Command {
|
||||||
public boolean needsRunMode() {
|
public boolean needsRunMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO i18n; can we work with error codes instead of messages? Like W07? that way we're language agnostic
|
||||||
|
// error message ist still needed to cancel TBR though, let next-gen ruffy take care of that?
|
||||||
|
/** An alarm (or null) caused by a disconnect we can safely confirm on reconnect,
|
||||||
|
* knowing it's not severe as it was caused by this command. */
|
||||||
|
@Override
|
||||||
|
public String getReconnectAlarm() { return null; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,11 @@ public class BolusCommand extends BaseCommand {
|
||||||
return violations;
|
return violations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReconnectAlarm() {
|
||||||
|
return "BOLUS CANCELLED";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute() {
|
public CommandResult execute() {
|
||||||
try {
|
try {
|
||||||
|
@ -184,7 +189,7 @@ public class BolusCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check date so we don't pick a false record if the previous bolus had the same amount;
|
// TODO check date so we don't pick a false record if the previous bolus had the same amount;
|
||||||
// also, report back partial bolus. Just call ReadHsstory(timestamp, boluses=true) cmd ...
|
// also, report back partial bolus. Just call ReadHistory(timestamp, boluses=true) cmd ...
|
||||||
double lastBolusInHistory = (double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BOLUS);
|
double lastBolusInHistory = (double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BOLUS);
|
||||||
if (Math.abs(bolus - lastBolusInHistory) > 0.05) {
|
if (Math.abs(bolus - lastBolusInHistory) > 0.05) {
|
||||||
throw new CommandException().success(false).enacted(true)
|
throw new CommandException().success(false).enacted(true)
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CancelTbrCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String reconnectAlarm() {
|
public String getReconnectAlarm() {
|
||||||
return "TBR CANCELLED";
|
return "TBR CANCELLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,5 @@ public interface Command {
|
||||||
List<String> validateArguments();
|
List<String> validateArguments();
|
||||||
void setScripter(RuffyScripter scripter);
|
void setScripter(RuffyScripter scripter);
|
||||||
boolean needsRunMode();
|
boolean needsRunMode();
|
||||||
|
String getReconnectAlarm();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,11 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
return violations;
|
return violations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReconnectAlarm() {
|
||||||
|
return "TBR CANCELLED";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute() {
|
public CommandResult execute() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue