Some templating around setting time/date.
This commit is contained in:
parent
cc6db3a059
commit
e9d3e90758
|
@ -32,11 +32,6 @@ public class CommandResult {
|
|||
@Nullable
|
||||
public Bolus lastBolus;
|
||||
|
||||
public long pumpTime;
|
||||
|
||||
public CommandResult() {
|
||||
}
|
||||
|
||||
public CommandResult success(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package de.jotomo.ruffy.spi;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||
|
||||
public interface RuffyCommands {
|
||||
|
@ -35,13 +33,13 @@ public interface RuffyCommands {
|
|||
* what types of data and how far back data is returned. */
|
||||
CommandResult readHistory(PumpHistoryRequest request);
|
||||
|
||||
CommandResult readBasalProfile(int number);
|
||||
CommandResult readBasalProfile();
|
||||
|
||||
CommandResult setBasalProfile(BasalProfile basalProfile);
|
||||
|
||||
CommandResult getDateAndTime();
|
||||
|
||||
CommandResult setDateAndTime(Date date);
|
||||
CommandResult setDateAndTime();
|
||||
|
||||
// TODO below methods are drafts
|
||||
void requestPairing();
|
||||
|
|
|
@ -79,8 +79,8 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CommandResult readBasalProfile(int number) {
|
||||
return delegate.readBasalProfile(number);
|
||||
public CommandResult readBasalProfile() {
|
||||
return delegate.readBasalProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,8 +89,8 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CommandResult setDateAndTime(Date date) {
|
||||
return delegate.setDateAndTime(date);
|
||||
public CommandResult setDateAndTime() {
|
||||
return delegate.setDateAndTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,6 +43,7 @@ import de.jotomo.ruffyscripter.commands.ReadHistoryCommand;
|
|||
import de.jotomo.ruffyscripter.commands.ReadPumpStateCommand;
|
||||
import de.jotomo.ruffyscripter.commands.ReadReservoirLevelAndLastBolus;
|
||||
import de.jotomo.ruffyscripter.commands.SetBasalProfileCommand;
|
||||
import de.jotomo.ruffyscripter.commands.SetDateAndTimeCommand;
|
||||
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
||||
|
||||
/**
|
||||
|
@ -723,8 +724,8 @@ public class RuffyScripter implements RuffyCommands {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CommandResult readBasalProfile(int number) {
|
||||
return runCommand(new ReadBasalProfileCommand(number));
|
||||
public CommandResult readBasalProfile() {
|
||||
return runCommand(new ReadBasalProfileCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -738,9 +739,8 @@ public class RuffyScripter implements RuffyCommands {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CommandResult setDateAndTime(Date date) {
|
||||
// TODO
|
||||
return new CommandResult().success(false);
|
||||
public CommandResult setDateAndTime() {
|
||||
return runCommand(new SetDateAndTimeCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package de.jotomo.ruffyscripter.commands;
|
||||
|
||||
public class ReadBasalProfileCommand extends BaseCommand {
|
||||
private final int number;
|
||||
|
||||
public ReadBasalProfileCommand(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// TODO
|
||||
|
|
|
@ -17,6 +17,7 @@ import de.jotomo.ruffy.spi.history.PumpError;
|
|||
import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||
|
||||
// Note: TBRs are added to history only after they've completed running
|
||||
public class ReadHistoryCommand extends BaseCommand {
|
||||
private static Logger log = LoggerFactory.getLogger(ReadHistoryCommand.class);
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package de.jotomo.ruffyscripter.commands;
|
||||
|
||||
import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
|
||||
|
||||
import de.jotomo.ruffy.spi.CommandResult;
|
||||
|
||||
/**
|
||||
* Created by joe on 08/11/17.
|
||||
*/
|
||||
|
||||
public class SetDateAndTimeCommand extends BaseCommand {
|
||||
@Override
|
||||
public void execute() {
|
||||
/* scripter.navigateToMenu(MenuType.DATE_AND_TIME_MENU);
|
||||
scripter.pressCheckKey();
|
||||
// TODO ruffy does'n support date/time menu yet*/
|
||||
// result.success = true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue