Explicit pump initialization.

(cherry picked from commit d8b244a)
This commit is contained in:
Johannes Mockenhaupt 2017-10-20 15:00:34 +02:00
parent 8b8a135804
commit 57be9bb9b1
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
8 changed files with 32 additions and 2 deletions

View file

@ -175,8 +175,10 @@ public class MainApp extends Application {
public void run() { public void run() {
SystemClock.sleep(5000); SystemClock.sleep(5000);
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
if (pump != null) if (pump != null) {
pump.refreshDataFromPump("Initialization"); log.debug("Initializing pump");
pump.initialize();
}
} }
}); });
t.start(); t.start();

View file

@ -15,6 +15,7 @@ import info.nightscout.androidaps.data.Profile;
*/ */
public interface PumpInterface { public interface PumpInterface {
void initialize();
boolean isInitialized(); boolean isInitialized();
boolean isSuspended(); boolean isSuspended();
boolean isBusy(); boolean isBusy();

View file

@ -222,6 +222,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
return useExtendedBoluses; return useExtendedBoluses;
} }
@Override
public void initialize() {
refreshDataFromPump("Initialization");
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0 && pump.isExtendedBolusEnabled; return pump.lastConnection.getTime() > 0 && pump.isExtendedBolusEnabled;

View file

@ -224,6 +224,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
return useExtendedBoluses; return useExtendedBoluses;
} }
@Override
public void initialize() {
refreshDataFromPump("Initialization");
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled; return pump.lastConnection.getTime() > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled;

View file

@ -357,6 +357,10 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
} }
// Pump interface // Pump interface
@Override
public void initialize() {
refreshDataFromPump("Initialization");
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {

View file

@ -209,6 +209,11 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
return false; return false;
} }
@Override
public void initialize() {
refreshDataFromPump("Initialization");
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0; return pump.lastConnection.getTime() > 0;

View file

@ -109,6 +109,10 @@ public class MDIPlugin implements PluginBase, PumpInterface {
return false; return false;
} }
@Override
public void initialize() {
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return true; return true;

View file

@ -164,6 +164,10 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses; return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses;
} }
@Override
public void initialize() {
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return true; return true;