diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyCommandsV1Impl.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyCommandsV1Impl.java index 79ab969a27..6be28b3074 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyCommandsV1Impl.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyCommandsV1Impl.java @@ -9,16 +9,21 @@ import de.jotomo.ruffy.spi.BasalProfile; import de.jotomo.ruffy.spi.BolusProgressReporter; import de.jotomo.ruffy.spi.CommandResult; import de.jotomo.ruffy.spi.RuffyCommands; +import de.jotomo.ruffy.spi.history.PumpHistory; import de.jotomo.ruffy.spi.history.PumpHistoryRequest; public class RuffyCommandsV1Impl implements RuffyCommands { + private static RuffyCommandsV1Impl instance; private static RuffyCommands delegate; @NonNull public static RuffyCommands getInstance(Context context) { - if (delegate == null) delegate = new RuffyScripter(context); - return delegate; + if (instance == null) { + instance = new RuffyCommandsV1Impl(); + delegate = new RuffyScripter(context); + } + return instance; } private RuffyCommandsV1Impl() {} @@ -85,19 +90,17 @@ public class RuffyCommandsV1Impl implements RuffyCommands { @Override public CommandResult readHistory(PumpHistoryRequest request) { - return delegate.readHistory(request); + return delegate.readPumpState().history(new PumpHistory()); } - /** Not supported by RuffyScripter */ @Override public CommandResult readBasalProfile() { - return new CommandResult().success(false); + return delegate.readBasalProfile(); } - /** Not supported by RuffyScripter */ @Override public CommandResult setBasalProfile(BasalProfile basalProfile) { - return new CommandResult().success(false); + return delegate.setBasalProfile(basalProfile); } /** Not supported by RuffyScripter */ diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index 26fb60affa..db58b8cdc2 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -43,7 +43,6 @@ 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; /** @@ -793,7 +792,7 @@ public class RuffyScripter implements RuffyCommands { @Override public CommandResult setDateAndTime() { - return runCommand(new SetDateAndTimeCommand()); + throw new RuntimeException("Not supported"); } @Override diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetDateAndTimeCommand.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetDateAndTimeCommand.java deleted file mode 100644 index edccbd4072..0000000000 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetDateAndTimeCommand.java +++ /dev/null @@ -1,24 +0,0 @@ -package de.jotomo.ruffyscripter.commands; - -import android.os.SystemClock; - -import org.monkey.d.ruffy.ruffy.driver.display.MenuType; - -import de.jotomo.ruffy.spi.CommandResult; - -public class SetDateAndTimeCommand extends BaseCommand { - @Override - public void execute() { - throw new RuntimeException("Not implemented yet"); -/* scripter.navigateToMenu(MenuType.DATE_AND_TIME_MENU); - scripter.pressCheckKey(); - // TODO ruffy does'n support date/time menu yet - result.success = true; -*/ - } - - @Override - public String toString() { - return "SetDateAndTimeCommand{}"; - } -}