Clean up commands package.

This commit is contained in:
Johannes Mockenhaupt 2017-07-16 15:28:39 +02:00
parent c63c86f98a
commit 362c3681d5
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
7 changed files with 12 additions and 11 deletions

View file

@ -1,4 +1,4 @@
package de.jotomo.ruffyscripter.commands; package de.jotomo.ruffyscripter;
/** The history data read from "My data" */ /** The history data read from "My data" */
public class History { public class History {

View file

@ -1,4 +1,4 @@
package de.jotomo.ruffyscripter.commands; package de.jotomo.ruffyscripter;
import java.util.Date; import java.util.Date;

View file

@ -16,7 +16,6 @@ import org.slf4j.LoggerFactory;
import de.jotomo.ruffyscripter.commands.Command; import de.jotomo.ruffyscripter.commands.Command;
import de.jotomo.ruffyscripter.commands.CommandException; import de.jotomo.ruffyscripter.commands.CommandException;
import de.jotomo.ruffyscripter.commands.CommandResult; import de.jotomo.ruffyscripter.commands.CommandResult;
import de.jotomo.ruffyscripter.commands.PumpState;
// TODO regularly read "My data" history (boluses, TBR) to double check all commands ran successfully. // TODO regularly read "My data" history (boluses, TBR) to double check all commands ran successfully.
// Automatically compare against AAPS db, or log all requests in the PumpInterface (maybe Milos // Automatically compare against AAPS db, or log all requests in the PumpInterface (maybe Milos

View file

@ -1,5 +1,8 @@
package de.jotomo.ruffyscripter.commands; package de.jotomo.ruffyscripter.commands;
import de.jotomo.ruffyscripter.History;
import de.jotomo.ruffyscripter.PumpState;
public class CommandResult { public class CommandResult {
public boolean success; public boolean success;
public boolean enacted; public boolean enacted;

View file

@ -2,7 +2,7 @@ package de.jotomo.ruffyscripter.commands;
import de.jotomo.ruffyscripter.RuffyScripter; import de.jotomo.ruffyscripter.RuffyScripter;
public class NoOpCommand implements Command { public class ReadPumpStateCommand implements Command {
@Override @Override
public CommandResult execute(RuffyScripter ruffyScripter) { public CommandResult execute(RuffyScripter ruffyScripter) {
return new CommandResult().success(true).enacted(false).message("Returning pump state only"); return new CommandResult().success(true).enacted(false).message("Returning pump state only");
@ -10,6 +10,6 @@ public class NoOpCommand implements Command {
@Override @Override
public String toString() { public String toString() {
return "NoOpCommand{}"; return "ReadPumpStateCommand{}";
} }
} }

View file

@ -16,7 +16,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import de.jotomo.ruffyscripter.commands.PumpState; import de.jotomo.ruffyscripter.PumpState;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI; import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;

View file

@ -7,7 +7,6 @@ import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -24,9 +23,9 @@ import de.jotomo.ruffyscripter.commands.BolusCommand;
import de.jotomo.ruffyscripter.commands.CancelTbrCommand; import de.jotomo.ruffyscripter.commands.CancelTbrCommand;
import de.jotomo.ruffyscripter.commands.Command; import de.jotomo.ruffyscripter.commands.Command;
import de.jotomo.ruffyscripter.commands.CommandResult; import de.jotomo.ruffyscripter.commands.CommandResult;
import de.jotomo.ruffyscripter.commands.NoOpCommand; import de.jotomo.ruffyscripter.commands.ReadPumpStateCommand;
import de.jotomo.ruffyscripter.commands.SetTbrCommand; import de.jotomo.ruffyscripter.commands.SetTbrCommand;
import de.jotomo.ruffyscripter.commands.PumpState; import de.jotomo.ruffyscripter.PumpState;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -104,7 +103,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override @Override
public void run() { public void run() {
log.debug("Querying pump for initial state"); log.debug("Querying pump for initial state");
runCommand(new NoOpCommand()); runCommand(new ReadPumpStateCommand());
} }
}).start(); }).start();
} }
@ -311,7 +310,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
// TODO if there was some clue as to what refreshDataFromPump would do with the data ... // TODO if there was some clue as to what refreshDataFromPump would do with the data ...
// that method calls NSUpload.uploadDeviceStatus(); in VirtualPump ... // that method calls NSUpload.uploadDeviceStatus(); in VirtualPump ...
void fetchPumpState() { void fetchPumpState() {
runCommand(new NoOpCommand()); runCommand(new ReadPumpStateCommand());
} }
private CommandResult runCommand(Command command) { private CommandResult runCommand(Command command) {