Some templating around setting time/date.
This commit is contained in:
parent
cc6db3a059
commit
e9d3e90758
|
@ -32,11 +32,6 @@ public class CommandResult {
|
||||||
@Nullable
|
@Nullable
|
||||||
public Bolus lastBolus;
|
public Bolus lastBolus;
|
||||||
|
|
||||||
public long pumpTime;
|
|
||||||
|
|
||||||
public CommandResult() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandResult success(boolean success) {
|
public CommandResult success(boolean success) {
|
||||||
this.success = success;
|
this.success = success;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package de.jotomo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
|
|
||||||
public interface RuffyCommands {
|
public interface RuffyCommands {
|
||||||
|
@ -35,13 +33,13 @@ public interface RuffyCommands {
|
||||||
* what types of data and how far back data is returned. */
|
* what types of data and how far back data is returned. */
|
||||||
CommandResult readHistory(PumpHistoryRequest request);
|
CommandResult readHistory(PumpHistoryRequest request);
|
||||||
|
|
||||||
CommandResult readBasalProfile(int number);
|
CommandResult readBasalProfile();
|
||||||
|
|
||||||
CommandResult setBasalProfile(BasalProfile basalProfile);
|
CommandResult setBasalProfile(BasalProfile basalProfile);
|
||||||
|
|
||||||
CommandResult getDateAndTime();
|
CommandResult getDateAndTime();
|
||||||
|
|
||||||
CommandResult setDateAndTime(Date date);
|
CommandResult setDateAndTime();
|
||||||
|
|
||||||
// TODO below methods are drafts
|
// TODO below methods are drafts
|
||||||
void requestPairing();
|
void requestPairing();
|
||||||
|
|
|
@ -79,8 +79,8 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult readBasalProfile(int number) {
|
public CommandResult readBasalProfile() {
|
||||||
return delegate.readBasalProfile(number);
|
return delegate.readBasalProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,8 +89,8 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult setDateAndTime(Date date) {
|
public CommandResult setDateAndTime() {
|
||||||
return delegate.setDateAndTime(date);
|
return delegate.setDateAndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,6 +43,7 @@ import de.jotomo.ruffyscripter.commands.ReadHistoryCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.ReadPumpStateCommand;
|
import de.jotomo.ruffyscripter.commands.ReadPumpStateCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.ReadReservoirLevelAndLastBolus;
|
import de.jotomo.ruffyscripter.commands.ReadReservoirLevelAndLastBolus;
|
||||||
import de.jotomo.ruffyscripter.commands.SetBasalProfileCommand;
|
import de.jotomo.ruffyscripter.commands.SetBasalProfileCommand;
|
||||||
|
import de.jotomo.ruffyscripter.commands.SetDateAndTimeCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -723,8 +724,8 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult readBasalProfile(int number) {
|
public CommandResult readBasalProfile() {
|
||||||
return runCommand(new ReadBasalProfileCommand(number));
|
return runCommand(new ReadBasalProfileCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -738,9 +739,8 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult setDateAndTime(Date date) {
|
public CommandResult setDateAndTime() {
|
||||||
// TODO
|
return runCommand(new SetDateAndTimeCommand());
|
||||||
return new CommandResult().success(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
package de.jotomo.ruffyscripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
public class ReadBasalProfileCommand extends BaseCommand {
|
public class ReadBasalProfileCommand extends BaseCommand {
|
||||||
private final int number;
|
|
||||||
|
|
||||||
public ReadBasalProfileCommand(int number) {
|
|
||||||
this.number = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
// TODO
|
// 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.PumpHistory;
|
||||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
|
|
||||||
|
// Note: TBRs are added to history only after they've completed running
|
||||||
public class ReadHistoryCommand extends BaseCommand {
|
public class ReadHistoryCommand extends BaseCommand {
|
||||||
private static Logger log = LoggerFactory.getLogger(ReadHistoryCommand.class);
|
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