RuffyCommandsV1Impl: actually do delegation.
(cherry picked from commit 5e447ad)
This commit is contained in:
parent
dfcf0a7e2a
commit
a6cba8b2d1
3 changed files with 11 additions and 33 deletions
|
@ -9,16 +9,21 @@ import de.jotomo.ruffy.spi.BasalProfile;
|
||||||
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import de.jotomo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import de.jotomo.ruffy.spi.RuffyCommands;
|
import de.jotomo.ruffy.spi.RuffyCommands;
|
||||||
|
import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||||
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
|
|
||||||
|
|
||||||
public class RuffyCommandsV1Impl implements RuffyCommands {
|
public class RuffyCommandsV1Impl implements RuffyCommands {
|
||||||
|
private static RuffyCommandsV1Impl instance;
|
||||||
private static RuffyCommands delegate;
|
private static RuffyCommands delegate;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static RuffyCommands getInstance(Context context) {
|
public static RuffyCommands getInstance(Context context) {
|
||||||
if (delegate == null) delegate = new RuffyScripter(context);
|
if (instance == null) {
|
||||||
return delegate;
|
instance = new RuffyCommandsV1Impl();
|
||||||
|
delegate = new RuffyScripter(context);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RuffyCommandsV1Impl() {}
|
private RuffyCommandsV1Impl() {}
|
||||||
|
@ -85,19 +90,17 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult readHistory(PumpHistoryRequest request) {
|
public CommandResult readHistory(PumpHistoryRequest request) {
|
||||||
return delegate.readHistory(request);
|
return delegate.readPumpState().history(new PumpHistory());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Not supported by RuffyScripter */
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult readBasalProfile() {
|
public CommandResult readBasalProfile() {
|
||||||
return new CommandResult().success(false);
|
return delegate.readBasalProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Not supported by RuffyScripter */
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult setBasalProfile(BasalProfile basalProfile) {
|
public CommandResult setBasalProfile(BasalProfile basalProfile) {
|
||||||
return new CommandResult().success(false);
|
return delegate.setBasalProfile(basalProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Not supported by RuffyScripter */
|
/** Not supported by RuffyScripter */
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -793,7 +792,7 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult setDateAndTime() {
|
public CommandResult setDateAndTime() {
|
||||||
return runCommand(new SetDateAndTimeCommand());
|
throw new RuntimeException("Not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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{}";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue