From 57be9bb9b1ee439166484864e9a658adbb18f64c Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 20 Oct 2017 15:00:34 +0200 Subject: [PATCH] Explicit pump initialization. (cherry picked from commit d8b244a) --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 6 ++++-- .../nightscout/androidaps/interfaces/PumpInterface.java | 1 + .../androidaps/plugins/PumpDanaR/DanaRPlugin.java | 5 +++++ .../plugins/PumpDanaRKorean/DanaRKoreanPlugin.java | 5 +++++ .../androidaps/plugins/PumpDanaRS/DanaRSPlugin.java | 4 ++++ .../androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java | 5 +++++ .../nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java | 4 ++++ .../androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java | 4 ++++ 8 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 0de381f2e8..d5cd60fb9c 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -175,8 +175,10 @@ public class MainApp extends Application { public void run() { SystemClock.sleep(5000); PumpInterface pump = MainApp.getConfigBuilder(); - if (pump != null) - pump.refreshDataFromPump("Initialization"); + if (pump != null) { + log.debug("Initializing pump"); + pump.initialize(); + } } }); t.start(); diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java index 60b7367100..5f75720a97 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java @@ -15,6 +15,7 @@ import info.nightscout.androidaps.data.Profile; */ public interface PumpInterface { + void initialize(); boolean isInitialized(); boolean isSuspended(); boolean isBusy(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java index 65dd5192e4..ea3bc6936c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java @@ -222,6 +222,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C return useExtendedBoluses; } + @Override + public void initialize() { + refreshDataFromPump("Initialization"); + } + @Override public boolean isInitialized() { return pump.lastConnection.getTime() > 0 && pump.isExtendedBolusEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java index c8b2d04759..b1f68deffc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java @@ -224,6 +224,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf return useExtendedBoluses; } + @Override + public void initialize() { + refreshDataFromPump("Initialization"); + } + @Override public boolean isInitialized() { return pump.lastConnection.getTime() > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java index 04a82ed1bd..a9294aa939 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java @@ -357,6 +357,10 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, } // Pump interface + @Override + public void initialize() { + refreshDataFromPump("Initialization"); + } @Override public boolean isInitialized() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java index ea174e4608..93e525066c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java @@ -209,6 +209,11 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface, return false; } + @Override + public void initialize() { + refreshDataFromPump("Initialization"); + } + @Override public boolean isInitialized() { return pump.lastConnection.getTime() > 0; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java index ca3f7a62a0..67fd1b8e53 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java @@ -109,6 +109,10 @@ public class MDIPlugin implements PluginBase, PumpInterface { return false; } + @Override + public void initialize() { + } + @Override public boolean isInitialized() { return true; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index e7323f48af..51382a4a56 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -164,6 +164,10 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses; } + @Override + public void initialize() { + } + @Override public boolean isInitialized() { return true;