Move initialized flag to ComoPump class.

This commit is contained in:
Johannes Mockenhaupt 2017-10-28 13:12:55 +02:00
parent 4befa38d46
commit 255e9d0dff
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 6 additions and 7 deletions

View file

@ -45,8 +45,6 @@ public class ComboPlugin implements PluginBase, PumpInterface {
private boolean fragmentEnabled = false; private boolean fragmentEnabled = false;
private boolean fragmentVisible = false; private boolean fragmentVisible = false;
private boolean initialized = false;
private PumpDescription pumpDescription = new PumpDescription(); private PumpDescription pumpDescription = new PumpDescription();
@NonNull @NonNull
@ -180,7 +178,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return initialized; return pump.initialized;
} }
@Override @Override
@ -193,13 +191,11 @@ public class ComboPlugin implements PluginBase, PumpInterface {
return ruffyScripter.isPumpBusy() && !pump.state.suspended; return ruffyScripter.isPumpBusy() && !pump.state.suspended;
} }
// TODO
@Override @Override
public int setNewBasalProfile(Profile profile) { public int setNewBasalProfile(Profile profile) {
return FAILED; return FAILED;
} }
// TODO
@Override @Override
public boolean isThisProfileSet(Profile profile) { public boolean isThisProfileSet(Profile profile) {
return false; return false;
@ -215,7 +211,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
public synchronized void refreshDataFromPump(String reason) { public synchronized void refreshDataFromPump(String reason) {
log.debug("RefreshDataFromPump called"); log.debug("RefreshDataFromPump called");
if (!initialized) { if (!pump.initialized) {
runCommand(MainApp.sResources.getString(R.string.connecting), new CommandExecution() { runCommand(MainApp.sResources.getString(R.string.connecting), new CommandExecution() {
@Override @Override
public CommandResult execute() { public CommandResult execute() {
@ -223,7 +219,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
} }
}); });
checkPumpHistory(); checkPumpHistory();
initialized = true; pump.initialized = true;
} else { } else {
runCommand(MainApp.sResources.getString(R.string.combo_action_refreshing), new CommandExecution() { runCommand(MainApp.sResources.getString(R.string.combo_action_refreshing), new CommandExecution() {
@Override @Override

View file

@ -9,6 +9,8 @@ import de.jotomo.ruffy.spi.history.PumpHistory;
class ComboPump { class ComboPump {
// TODO actually ... this isn't about successful command execution, but whether we could connect to the pump at all // TODO actually ... this isn't about successful command execution, but whether we could connect to the pump at all
boolean initialized = false;
volatile long lastSuccessfulConnection; volatile long lastSuccessfulConnection;
volatile long lastConnectionAttempt; volatile long lastConnectionAttempt;
@Nullable @Nullable

View file

@ -18,6 +18,7 @@ public class PumpState {
* longer to read that and the pump connection gets interrupted if we're not * longer to read that and the pump connection gets interrupted if we're not
* reacting quickly. * reacting quickly.
*/ */
// TODO pump errors (EXX) vs. errors talking to the pump
public String errorMsg; public String errorMsg;
public boolean suspended; public boolean suspended;