Remove unclear error message field from CommandResult, use codes from pump warnings/errors.
This commit is contained in:
parent
6b6d252173
commit
a2460180f9
|
@ -88,9 +88,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
// state
|
// state
|
||||||
stateView.setText(plugin.getStateSummary());
|
stateView.setText(plugin.getStateSummary());
|
||||||
PumpState ps = plugin.getPump().state;
|
PumpState ps = plugin.getPump().state;
|
||||||
if (plugin.getPump().state.errorMsg != null
|
if ( ps.insulinState == PumpState.EMPTY || ps.batteryState == PumpState.EMPTY) {
|
||||||
|| ps.insulinState == PumpState.EMPTY
|
|
||||||
|| ps.batteryState == PumpState.EMPTY) {
|
|
||||||
stateView.setTextColor(Color.RED);
|
stateView.setTextColor(Color.RED);
|
||||||
} else if (plugin.getPump().state.suspended) {
|
} else if (plugin.getPump().state.suspended) {
|
||||||
stateView.setTextColor(Color.YELLOW);
|
stateView.setTextColor(Color.YELLOW);
|
||||||
|
|
|
@ -417,7 +417,6 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
PumpEnactResult pumpEnactResult = new PumpEnactResult();
|
PumpEnactResult pumpEnactResult = new PumpEnactResult();
|
||||||
pumpEnactResult.success = bolusCmdResult.success;
|
pumpEnactResult.success = bolusCmdResult.success;
|
||||||
pumpEnactResult.enacted = bolusCmdResult.enacted;
|
pumpEnactResult.enacted = bolusCmdResult.enacted;
|
||||||
// pumpEnactResult.comment = bolusCmdResult.message;
|
|
||||||
|
|
||||||
// if enacted, add bolus and carbs to treatment history
|
// if enacted, add bolus and carbs to treatment history
|
||||||
if (pumpEnactResult.enacted) {
|
if (pumpEnactResult.enacted) {
|
||||||
|
@ -500,7 +499,6 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
PumpEnactResult pumpEnactResult = new PumpEnactResult();
|
PumpEnactResult pumpEnactResult = new PumpEnactResult();
|
||||||
pumpEnactResult.success = commandResult.success;
|
pumpEnactResult.success = commandResult.success;
|
||||||
pumpEnactResult.enacted = commandResult.enacted;
|
pumpEnactResult.enacted = commandResult.enacted;
|
||||||
// pumpEnactResult.comment = commandResult.message;
|
|
||||||
pumpEnactResult.isPercent = true;
|
pumpEnactResult.isPercent = true;
|
||||||
// Combo would have bailed if this wasn't set properly. Maybe we should
|
// Combo would have bailed if this wasn't set properly. Maybe we should
|
||||||
// have the command return this anyways ...
|
// have the command return this anyways ...
|
||||||
|
@ -570,7 +568,6 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
if (commandResult != null) {
|
if (commandResult != null) {
|
||||||
pumpEnactResult.success = commandResult.success;
|
pumpEnactResult.success = commandResult.success;
|
||||||
pumpEnactResult.enacted = commandResult.enacted;
|
pumpEnactResult.enacted = commandResult.enacted;
|
||||||
// pumpEnactResult.comment = commandResult.message;
|
|
||||||
}
|
}
|
||||||
return pumpEnactResult;
|
return pumpEnactResult;
|
||||||
}
|
}
|
||||||
|
@ -752,8 +749,8 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
extendedJson.put("TempBasalPercent", ps.tbrPercent);
|
extendedJson.put("TempBasalPercent", ps.tbrPercent);
|
||||||
extendedJson.put("TempBasalRemaining", ps.tbrRemainingDuration);
|
extendedJson.put("TempBasalRemaining", ps.tbrRemainingDuration);
|
||||||
}
|
}
|
||||||
if (ps.errorMsg != null) {
|
if (ps.alertCodes.errorCode != null) {
|
||||||
extendedJson.put("ErrorMessage", ps.errorMsg);
|
extendedJson.put("ErrorCode", ps.alertCodes.errorCode);
|
||||||
}
|
}
|
||||||
pumpJson.put("extended", extendedJson);
|
pumpJson.put("extended", extendedJson);
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,6 @@ public class CommandResult {
|
||||||
public boolean enacted;
|
public boolean enacted;
|
||||||
/** Null unless an unhandled exception was raised. */
|
/** Null unless an unhandled exception was raised. */
|
||||||
public Exception exception;
|
public Exception exception;
|
||||||
/** (Error)message describing the result of the command. */
|
|
||||||
// TODO work outh this message
|
|
||||||
// public String message;
|
|
||||||
/** State of the pump *after* command execution. */
|
/** State of the pump *after* command execution. */
|
||||||
public PumpState state;
|
public PumpState state;
|
||||||
/** History if requested by the command. */
|
/** History if requested by the command. */
|
||||||
|
@ -60,11 +57,6 @@ public class CommandResult {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public CommandResult message(String message) {
|
|
||||||
// this.message = message;
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public CommandResult state(PumpState state) {
|
public CommandResult state(PumpState state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
return this;
|
return this;
|
||||||
|
@ -86,7 +78,6 @@ public class CommandResult {
|
||||||
", success=" + success +
|
", success=" + success +
|
||||||
", enacted=" + enacted +
|
", enacted=" + enacted +
|
||||||
", exception=" + exception +
|
", exception=" + exception +
|
||||||
// ", message='" + message + '\'' +
|
|
||||||
", state=" + state +
|
", state=" + state +
|
||||||
", history=" + history +
|
", history=" + history +
|
||||||
", basalProfile=" + basalProfile +
|
", basalProfile=" + basalProfile +
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package de.jotomo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
|
import de.jotomo.ruffy.spi.history.WarningOrErrorCode;
|
||||||
|
|
||||||
/** State displayed on the main screen of the pump. */
|
/** State displayed on the main screen of the pump. */
|
||||||
public class PumpState {
|
public class PumpState {
|
||||||
public long timestamp;
|
public long timestamp;
|
||||||
public String menu = null;
|
public String menu = null;
|
||||||
|
public boolean suspended;
|
||||||
|
|
||||||
public boolean tbrActive = false;
|
public boolean tbrActive = false;
|
||||||
/** TBR percentage. 100% means no TBR active, just the normal basal rate running. */
|
/** TBR percentage. 100% means no TBR active, just the normal basal rate running. */
|
||||||
public int tbrPercent = -1;
|
public int tbrPercent = -1;
|
||||||
|
@ -12,16 +16,10 @@ public class PumpState {
|
||||||
/** Remaining time of an active TBR. Note that 0:01 is te lowest displayed, the pump
|
/** Remaining time of an active TBR. Note that 0:01 is te lowest displayed, the pump
|
||||||
* jumps from that to TBR end, skipping 0:00(xx). */
|
* jumps from that to TBR end, skipping 0:00(xx). */
|
||||||
public int tbrRemainingDuration = -1;
|
public int tbrRemainingDuration = -1;
|
||||||
/**
|
|
||||||
* This is the error message (if any) displayed by the pump if there is an alarm,
|
/** Warning or error code displayed if a warning or alert alert is active,
|
||||||
* e.g. if a "TBR cancelled alarm" is active, the value will be "TBR CANCELLED".
|
* see {@link PumpWarningCodes}, {@link PumpErrorCodes} */
|
||||||
* Generally, an error code is also displayed, but it flashes and it might take
|
public WarningOrErrorCode alertCodes;
|
||||||
* longer to read that and the pump connection gets interrupted if we're not
|
|
||||||
* reacting quickly.
|
|
||||||
*/
|
|
||||||
// TODO pump errors (EXX) vs. errors talking to the pump
|
|
||||||
public String errorMsg;
|
|
||||||
public boolean suspended;
|
|
||||||
|
|
||||||
public static final int UNKNOWN = -1;
|
public static final int UNKNOWN = -1;
|
||||||
public static final int LOW = 1;
|
public static final int LOW = 1;
|
||||||
|
@ -56,11 +54,6 @@ public class PumpState {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PumpState errorMsg(String errorMsg) {
|
|
||||||
this.errorMsg = errorMsg;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PumpState suspended(boolean suspended) {
|
public PumpState suspended(boolean suspended) {
|
||||||
this.suspended = suspended;
|
this.suspended = suspended;
|
||||||
return this;
|
return this;
|
||||||
|
@ -89,7 +82,6 @@ public class PumpState {
|
||||||
", tbrPercent=" + tbrPercent +
|
", tbrPercent=" + tbrPercent +
|
||||||
", tbrRate=" + tbrRate +
|
", tbrRate=" + tbrRate +
|
||||||
", tbrRemainingDuration=" + tbrRemainingDuration +
|
", tbrRemainingDuration=" + tbrRemainingDuration +
|
||||||
", errorMsg='" + errorMsg + '\'' +
|
|
||||||
", suspended=" + suspended +
|
", suspended=" + suspended +
|
||||||
", batteryState=" + batteryState +
|
", batteryState=" + batteryState +
|
||||||
", insulinState=" + insulinState +
|
", insulinState=" + insulinState +
|
||||||
|
|
|
@ -31,6 +31,7 @@ public interface RuffyCommands {
|
||||||
|
|
||||||
CommandResult getDateAndTime();
|
CommandResult getDateAndTime();
|
||||||
|
|
||||||
|
// TODO see how dana does this, autosync on DST change
|
||||||
CommandResult setDateAndTime(Date date);
|
CommandResult setDateAndTime(Date date);
|
||||||
|
|
||||||
void requestPairing();
|
void requestPairing();
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
|
public class WarningOrErrorCode {
|
||||||
|
public final Integer warningCode;
|
||||||
|
public final Integer errorCode;
|
||||||
|
|
||||||
|
public WarningOrErrorCode(Integer warningCode, Integer errorCode) {
|
||||||
|
this.warningCode = warningCode;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import de.jotomo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import de.jotomo.ruffy.spi.RuffyCommands;
|
import de.jotomo.ruffy.spi.RuffyCommands;
|
||||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
|
import de.jotomo.ruffy.spi.history.WarningOrErrorCode;
|
||||||
import de.jotomo.ruffyscripter.commands.BolusCommand;
|
import de.jotomo.ruffyscripter.commands.BolusCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.CancelTbrCommand;
|
import de.jotomo.ruffyscripter.commands.CancelTbrCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.Command;
|
import de.jotomo.ruffyscripter.commands.Command;
|
||||||
|
@ -218,13 +219,11 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
/** Always returns a CommandResult, never throws */
|
/** Always returns a CommandResult, never throws */
|
||||||
private CommandResult runCommand(final Command cmd) {
|
private CommandResult runCommand(final Command cmd) {
|
||||||
log.debug("Attempting to run cmd: " + cmd);
|
log.debug("Attempting to run cmd: " + cmd);
|
||||||
if (unrecoverableError != null) {
|
|
||||||
return new CommandResult().success(false).enacted(false).message(unrecoverableError).state(readPumpStateInternal());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> violations = cmd.validateArguments();
|
List<String> violations = cmd.validateArguments();
|
||||||
if (!violations.isEmpty()) {
|
if (!violations.isEmpty()) {
|
||||||
return new CommandResult().message(Joiner.on("\n").join(violations)).state(readPumpStateInternal());
|
log.error("Command argument violations: " + Joiner.on(", ").join(violations));
|
||||||
|
return new CommandResult().state(readPumpStateInternal());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO simplify, hard to reason about exists
|
// TODO simplify, hard to reason about exists
|
||||||
|
@ -240,7 +239,8 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
Menu localCurrentMenu = currentMenu;
|
Menu localCurrentMenu = currentMenu;
|
||||||
if (localCurrentMenu == null || localCurrentMenu.getType() == MenuType.STOP) {
|
if (localCurrentMenu == null || localCurrentMenu.getType() == MenuType.STOP) {
|
||||||
if (cmd.needsRunMode()) {
|
if (cmd.needsRunMode()) {
|
||||||
activeCmd.getResult().success(false).message("Pump is suspended but operations requires to the pump to be running");
|
log.error("Requested command requires run mode, but pump is suspended");
|
||||||
|
activeCmd.getResult().success = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,10 +255,11 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
long cmdEndTime = System.currentTimeMillis();
|
long cmdEndTime = System.currentTimeMillis();
|
||||||
log.debug("Executing " + cmd + " took " + (cmdEndTime - cmdStartTime) + "ms");
|
log.debug("Executing " + cmd + " took " + (cmdEndTime - cmdStartTime) + "ms");
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
activeCmd.getResult().message(e.getMessage());
|
log.error("CommandException running command", e);
|
||||||
|
activeCmd.getResult().success = false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unexpected exception running cmd", e);
|
log.error("Unexpected exception running cmd", e);
|
||||||
activeCmd.getResult().message("Unexpected exception running cmd");
|
activeCmd.getResult().success = false;
|
||||||
} finally {
|
} finally {
|
||||||
lastCmdExecutionTime = System.currentTimeMillis();
|
lastCmdExecutionTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
@ -294,14 +295,13 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
cmdThread.interrupt();
|
cmdThread.interrupt();
|
||||||
SystemClock.sleep(5000);
|
SystemClock.sleep(5000);
|
||||||
log.error("Timed out thread dead yet? " + cmdThread.isAlive());
|
log.error("Timed out thread dead yet? " + cmdThread.isAlive());
|
||||||
activeCmd.getResult().success(false).message("Command stalled, check pump!");
|
activeCmd.getResult().success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (now > overallTimeout) {
|
if (now > overallTimeout) {
|
||||||
String msg = "Command " + cmd + " timed out after 4 min, check pump!";
|
log.error("Command " + cmd + " timed out");
|
||||||
log.error(msg);
|
activeCmd.getResult().success = false;
|
||||||
activeCmd.getResult().success(false).message(msg);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,12 +315,13 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
log.debug("Connect: " + connectDurationSec + "s, execution: " + executionDurationSec + "s");
|
log.debug("Connect: " + connectDurationSec + "s, execution: " + executionDurationSec + "s");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
// TOD under which circumstances can these occur?
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
return activeCmd.getResult().success(false).message(e.getMessage()).state(readPumpStateInternal());
|
log.error("CommandException while executing command", e);
|
||||||
|
return activeCmd.getResult().success(false).state(readPumpStateInternal());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unexpected exception communication with ruffy", e);
|
log.error("Unexpected exception communication with ruffy", e);
|
||||||
return activeCmd.getResult().success(false).exception(e)
|
return activeCmd.getResult().success(false).exception(e).state(readPumpStateInternal());
|
||||||
.message("Unexpected exception communication with ruffy: " + e.getMessage()).state(readPumpStateInternal());
|
|
||||||
} finally {
|
} finally {
|
||||||
activeCmd = null;
|
activeCmd = null;
|
||||||
}
|
}
|
||||||
|
@ -473,25 +474,26 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||||
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
||||||
state.errorMsg = (String) menu.getAttribute(MenuAttribute.MESSAGE);
|
state.alertCodes = readWarningOrErrorCode();
|
||||||
} else if (menuType == MenuType.STOP) {
|
} else if (menuType == MenuType.STOP) {
|
||||||
state.suspended = true;
|
state.suspended = true;
|
||||||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||||
} else {
|
|
||||||
// just return the PumpState with the menu set
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int readWarningCode() {
|
public WarningOrErrorCode readWarningOrErrorCode() {
|
||||||
verifyMenuIsDisplayed(MenuType.WARNING_OR_ERROR);
|
verifyMenuIsDisplayed(MenuType.WARNING_OR_ERROR);
|
||||||
Integer warningCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.WARNING);
|
Integer warningCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.WARNING);
|
||||||
while (warningCode == null) {
|
Integer errorCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.ERROR);
|
||||||
|
while (warningCode == null && errorCode == null) {
|
||||||
waitForScreenUpdate();
|
waitForScreenUpdate();
|
||||||
warningCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.WARNING);
|
warningCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.WARNING);
|
||||||
|
errorCode = (Integer) getCurrentMenu().getAttribute(MenuAttribute.ERROR);
|
||||||
}
|
}
|
||||||
return warningCode;
|
return new WarningOrErrorCode(warningCode, errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// below: methods to be used by commands
|
// below: methods to be used by commands
|
||||||
|
@ -810,7 +812,12 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
// A wait till the error code can be read results in the code hanging, despite
|
// A wait till the error code can be read results in the code hanging, despite
|
||||||
// menu updates coming in, so just check the message.
|
// menu updates coming in, so just check the message.
|
||||||
|
|
||||||
int displayedWarningCode = readWarningCode();
|
WarningOrErrorCode warningOrErrorCode = readWarningOrErrorCode();
|
||||||
|
if (warningOrErrorCode.errorCode != 0) {
|
||||||
|
// TODO proper way to display such things in the UI;
|
||||||
|
throw new CommandException("Pump is in error state");
|
||||||
|
}
|
||||||
|
int displayedWarningCode = warningOrErrorCode.warningCode;
|
||||||
String errorMsg = (String) getCurrentMenu().getAttribute(MenuAttribute.MESSAGE);
|
String errorMsg = (String) getCurrentMenu().getAttribute(MenuAttribute.MESSAGE);
|
||||||
if (displayedWarningCode != warningCode) {
|
if (displayedWarningCode != warningCode) {
|
||||||
throw new CommandException("An alert other than the expected warning " + warningCode+ " was raised by the pump: "
|
throw new CommandException("An alert other than the expected warning " + warningCode+ " was raised by the pump: "
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
||||||
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import de.jotomo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import de.jotomo.ruffy.spi.PumpWarningCodes;
|
import de.jotomo.ruffy.spi.PumpWarningCodes;
|
||||||
|
import de.jotomo.ruffy.spi.history.WarningOrErrorCode;
|
||||||
import de.jotomo.ruffyscripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
|
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERED;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERED;
|
||||||
|
@ -108,7 +109,11 @@ public class BolusCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
if (scripter.getCurrentMenu().getType() == MenuType.WARNING_OR_ERROR) {
|
if (scripter.getCurrentMenu().getType() == MenuType.WARNING_OR_ERROR) {
|
||||||
// confirm warning alerts and update the result to indicate alerts occurred
|
// confirm warning alerts and update the result to indicate alerts occurred
|
||||||
int warningCode = scripter.readWarningCode();
|
WarningOrErrorCode warningOrErrorCode = scripter.readWarningOrErrorCode();
|
||||||
|
if (warningOrErrorCode.errorCode != 0) {
|
||||||
|
throw new CommandException("Pump is in error state");
|
||||||
|
}
|
||||||
|
int warningCode = warningOrErrorCode.warningCode;
|
||||||
if (warningCode == PumpWarningCodes.BOLUS_CANCELLED) {
|
if (warningCode == PumpWarningCodes.BOLUS_CANCELLED) {
|
||||||
scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 2000);
|
scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 2000);
|
||||||
bolusProgressReporter.report(STOPPED, 0, 0);
|
bolusProgressReporter.report(STOPPED, 0, 0);
|
||||||
|
@ -128,7 +133,6 @@ public class BolusCommand extends BaseCommand {
|
||||||
bolusProgressReporter.report(DELIVERING, percentDelivered, bolus - bolusRemaining);
|
bolusProgressReporter.report(DELIVERING, percentDelivered, bolus - bolusRemaining);
|
||||||
lastBolusReported = bolusRemaining;
|
lastBolusReported = bolusRemaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemClock.sleep(50);
|
SystemClock.sleep(50);
|
||||||
bolusRemaining = (Double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING);
|
bolusRemaining = (Double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import de.jotomo.ruffy.spi.PumpWarningCodes;
|
import de.jotomo.ruffy.spi.PumpWarningCodes;
|
||||||
|
|
||||||
|
@ -89,11 +88,10 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
// check main menu shows the same values we just set
|
// check main menu shows the same values we just set
|
||||||
if (cancellingTbr) {
|
if (cancellingTbr) {
|
||||||
verifyMainMenuShowsNoActiveTbr();
|
verifyMainMenuShowsNoActiveTbr();
|
||||||
result.success(true).enacted(true).message("TBR was cancelled");
|
result.success(true).enacted(true);
|
||||||
} else {
|
} else {
|
||||||
verifyMainMenuShowsExpectedTbrActive();
|
verifyMainMenuShowsExpectedTbrActive();
|
||||||
result.success(true).enacted(true)
|
result.success(true).enacted(true);
|
||||||
.message(String.format(Locale.US, "TBR set to %d%% for %d min", percentage, duration));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue