AndroidAPS/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandResult.java

81 lines
2 KiB
Java
Raw Normal View History

package de.jotomo.ruffyscripter.commands;
import java.util.Date;
2017-07-16 15:28:39 +02:00
import de.jotomo.ruffyscripter.History;
2017-07-26 18:11:45 +02:00
import de.jotomo.ruffyscripter.PumpCapabilities;
2017-07-16 15:28:39 +02:00
import de.jotomo.ruffyscripter.PumpState;
public class CommandResult {
public boolean success;
public boolean enacted;
public long completionTime;
public Exception exception;
public String message;
public PumpState state;
2017-07-15 12:40:06 +02:00
public History history;
2017-07-26 18:11:45 +02:00
public PumpCapabilities capabilities;
public String duration;
public CommandResult() {
}
public CommandResult success(boolean success) {
this.success = success;
return this;
}
public CommandResult enacted(boolean enacted) {
this.enacted = enacted;
return this;
}
public CommandResult completionTime(long completionTime) {
2017-08-17 10:56:33 +02:00
this.completionTime = completionTime;
return this;
}
public CommandResult duration(String duration) {
this.duration = duration;
return this;
}
public CommandResult exception(Exception exception) {
this.exception = exception;
return this;
}
public CommandResult message(String message) {
this.message = message;
return this;
}
public CommandResult state(PumpState state) {
2017-07-15 12:40:06 +02:00
this.state = state;
return this;
}
public CommandResult history(History history) {
this.history = history;
2017-08-17 10:56:33 +02:00
return this;
2017-07-15 12:40:06 +02:00
}
2017-07-26 18:11:45 +02:00
public CommandResult capabilities(PumpCapabilities capabilities) {
this.capabilities = capabilities;
2017-08-17 10:56:33 +02:00
return this;
2017-07-26 18:11:45 +02:00
}
@Override
public String toString() {
return "CommandResult{" +
"success=" + success +
", enacted=" + enacted +
", completionTime=" + completionTime + "(" + new Date(completionTime) + ")" +
"' duration=" + duration +
", exception=" + exception +
", message='" + message + '\'' +
", state=" + state +
'}';
}
}