From 53f7cf0dcf119c9373e2a6aa9110e72b8887e97a Mon Sep 17 00:00:00 2001 From: TebbeUbben Date: Fri, 25 Jan 2019 22:53:35 +0100 Subject: [PATCH] Revert "Improve connection routine" This reverts commit 8116a24 --- .../plugins/PumpInsightLocal/LocalInsightPlugin.java | 9 +++++++-- .../connection_service/InsightConnectionService.java | 4 ---- app/src/main/res/values/strings.xml | 7 ------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java index 280c488b5e..0e182e0d6b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java @@ -261,12 +261,17 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con @Override public boolean isConnected() { - return connectionService != null && alertService != null && connectionService.getState() == InsightState.CONNECTED; + if (connectionService == null || alertService == null) return false; + return connectionService.getState() == InsightState.CONNECTED; } @Override public boolean isConnecting() { - return connectionService != null && alertService != null && connectionService.hasRequestedConnection(this); + if (connectionService == null || alertService == null) return false; + InsightState state = connectionService.getState(); + return state == InsightState.CONNECTING + || state == InsightState.APP_CONNECT_MESSAGE + || state == InsightState.RECOVERING; } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/connection_service/InsightConnectionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/connection_service/InsightConnectionService.java index 1cd4bbfe68..b4ee726a6b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/connection_service/InsightConnectionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/connection_service/InsightConnectionService.java @@ -249,10 +249,6 @@ public class InsightConnectionService extends Service implements ConnectionEstab log.info("Insight state changed: " + state.name()); } - public synchronized boolean hasRequestedConnection(Object lock) { - return connectionRequests.contains(lock); - } - public synchronized void requestConnection(Object lock) { if (connectionRequests.contains(lock)) return; connectionRequests.add(lock); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ed1380c79f..8785dba800 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1266,13 +1266,6 @@ Refresh Pump integration for Accu-Chek Insight pumps Not inserted - Last conn: %1$d min ago - TBR: %1$d%% for %2$d / %3$d min - Extended: %1$.2f / %2$.2f U for %3$d min - Extended: %1$.2f / %2$.2f U for %3$d min - TDD: %1$.2f - Reser.: %1$.2fU - Batt.: %1$d%% %1$d day