diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 8c6d9f5c35..9d82370f4a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -81,9 +81,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain static ArrayList pluginList; - private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(); - private static ScheduledFuture scheduledPost = null; - PowerManager.WakeLock mWakeLock; public ConfigBuilderPlugin() { @@ -815,11 +812,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain return maxIobAfterConstrain; } - @Subscribe - public void onStatusEvent(final EventNewBG ev) { - uploadDeviceStatus(120); - } - public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) { try { Context context = MainApp.instance().getApplicationContext(); @@ -923,7 +915,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain } } - public void doUploadDeviceStatus() { + public void uploadDeviceStatus() { DeviceStatus deviceStatus = new DeviceStatus(); try { LoopPlugin.LastRun lastRun = LoopPlugin.lastRun; @@ -981,22 +973,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain } } - static public void uploadDeviceStatus(int sec) { - class PostRunnable implements Runnable { - public void run() { - MainApp.getConfigBuilder().doUploadDeviceStatus(); - scheduledPost = null; - } - } - // prepare task for execution - // cancel waiting task to prevent sending multiple posts - if (scheduledPost != null) - scheduledPost.cancel(false); - Runnable task = new PostRunnable(); - scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS); - log.debug("Scheduling devicestatus upload in " + sec + " sec"); - } - public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) { JSONObject data = new JSONObject(); try { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java index 323b139bda..a6e7a2b278 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java @@ -341,7 +341,7 @@ public class ExecutionService extends Service { danaRPump.lastConnection = now; MainApp.bus().post(new EventDanaRNewStatus()); MainApp.bus().post(new EventInitializationChanged()); - MainApp.getConfigBuilder().uploadDeviceStatus(15); + MainApp.getConfigBuilder().uploadDeviceStatus(); if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) { log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits); Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/Services/ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/Services/ExecutionService.java index 1a0267dd67..2d8e04109d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/Services/ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/Services/ExecutionService.java @@ -332,7 +332,7 @@ public class ExecutionService extends Service { danaRKoreanPump.lastConnection = now; MainApp.bus().post(new EventDanaRNewStatus()); MainApp.bus().post(new EventInitializationChanged()); - MainApp.getConfigBuilder().uploadDeviceStatus(15); + MainApp.getConfigBuilder().uploadDeviceStatus(); if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) { log.debug("Approaching daily limit: " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits); Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index 59ddcfc3b8..a357d519b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -228,7 +228,7 @@ public class LoopPlugin implements PluginBase { } MainApp.bus().post(new EventLoopUpdateGui()); - MainApp.getConfigBuilder().uploadDeviceStatus(60); + MainApp.getConfigBuilder().uploadDeviceStatus(); } finally { if (Config.logFunctionCalls) log.debug("invoke end"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index ac9035b7fd..ea3d8d551a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -272,7 +272,7 @@ public class OverviewFragment extends Fragment { finalLastRun.setByPump = applyResult; finalLastRun.lastEnact = new Date(); finalLastRun.lastOpenModeAccept = new Date(); - MainApp.getConfigBuilder().uploadDeviceStatus(15); + MainApp.getConfigBuilder().uploadDeviceStatus(); ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class); if (objectivesPlugin != null) { objectivesPlugin.manualEnacts++;