Add timestamp to State and rename to PumpState.
This commit is contained in:
parent
f28a27a93f
commit
f5ef666061
|
@ -5,7 +5,7 @@ public class CommandResult {
|
|||
public boolean enacted;
|
||||
public Exception exception;
|
||||
public String message;
|
||||
public State state;
|
||||
public PumpState state;
|
||||
public History history;
|
||||
|
||||
public CommandResult() {
|
||||
|
@ -31,7 +31,7 @@ public class CommandResult {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CommandResult state(State state) {
|
||||
public CommandResult state(PumpState state) {
|
||||
this.state = state;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,48 +1,52 @@
|
|||
package de.jotomo.ruffyscripter.commands;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* State represeting the state of the MAIN_MENU
|
||||
* State representing the state of the MAIN_MENU.
|
||||
*/
|
||||
public class State {
|
||||
public class PumpState {
|
||||
public Date timestamp = new Date();
|
||||
public boolean tbrActive = false;
|
||||
public int tbrPercent = -1;
|
||||
public int tbrRemainingDuration = -1;
|
||||
public boolean isErrorOrWarning = false;
|
||||
public int errorCode = -1;
|
||||
|
||||
public State tbrActive(boolean tbrActive) {
|
||||
public PumpState tbrActive(boolean tbrActive) {
|
||||
this.tbrActive = tbrActive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public State tbrPercent(int tbrPercent) {
|
||||
public PumpState tbrPercent(int tbrPercent) {
|
||||
this.tbrPercent = tbrPercent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public State tbrRemainingDuration(int tbrRemainingDuration) {
|
||||
public PumpState tbrRemainingDuration(int tbrRemainingDuration) {
|
||||
this.tbrRemainingDuration = tbrRemainingDuration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public State isErrorOrWarning(boolean isErrorOrWarning) {
|
||||
public PumpState isErrorOrWarning(boolean isErrorOrWarning) {
|
||||
this.isErrorOrWarning = isErrorOrWarning;
|
||||
return this;
|
||||
}
|
||||
|
||||
public State errorCode(int errorCode) {
|
||||
public PumpState errorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "State{" +
|
||||
return "PumpState{" +
|
||||
"tbrActive=" + tbrActive +
|
||||
", tbrPercent=" + tbrPercent +
|
||||
", tbrRemainingDuration=" + tbrRemainingDuration +
|
||||
", isErrorOrWarning=" + isErrorOrWarning +
|
||||
", errorCode=" + errorCode +
|
||||
", timestamp=" + timestamp +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public class ReadStateCommand implements Command {
|
|||
@Override
|
||||
public CommandResult execute(RuffyScripter scripter) {
|
||||
try {
|
||||
State state = new State();
|
||||
PumpState state = new PumpState();
|
||||
Menu displayedMenu = scripter.currentMenu;
|
||||
MenuType displayedMenuType = displayedMenu.getType();
|
||||
if (displayedMenuType == MenuType.MAIN_MENU) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import de.jotomo.ruffyscripter.commands.Command;
|
|||
import de.jotomo.ruffyscripter.commands.CommandResult;
|
||||
import de.jotomo.ruffyscripter.commands.ReadStateCommand;
|
||||
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
||||
import de.jotomo.ruffyscripter.commands.State;
|
||||
import de.jotomo.ruffyscripter.commands.PumpState;
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -59,7 +59,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
|||
private ServiceConnection mRuffyServiceConnection;
|
||||
|
||||
@Nullable
|
||||
private volatile State pumpState;
|
||||
private volatile PumpState pumpState;
|
||||
|
||||
private static PumpEnactResult OPERATION_NOT_SUPPORTED = new PumpEnactResult();
|
||||
|
||||
|
|
Loading…
Reference in a new issue