diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 28c3add9ba..d369b13fa7 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -60,7 +60,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; -import info.nightscout.androidaps.plugins.PumpInsight.InsightPumpPlugin; +import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin; import info.nightscout.androidaps.plugins.PumpMDI.MDIPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin; @@ -156,7 +156,7 @@ public class MainApp extends Application { if (Config.HWPUMPS) pluginsList.add(DanaRv2Plugin.getPlugin()); if (Config.HWPUMPS) pluginsList.add(DanaRSPlugin.getPlugin()); pluginsList.add(CareportalPlugin.getPlugin()); - if (Config.HWPUMPS && engineeringMode) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here + if (Config.HWPUMPS && engineeringMode) pluginsList.add(InsightPlugin.getPlugin()); // <-- Enable Insight plugin here if (Config.HWPUMPS && engineeringMode) pluginsList.add(ComboPlugin.getPlugin()); // <-- Enable Combo plugin here if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin()); if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpAsyncAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightAsyncAdapter.java similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpAsyncAdapter.java rename to app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightAsyncAdapter.java index 6f48934059..3759a3f721 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpAsyncAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightAsyncAdapter.java @@ -8,7 +8,7 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCallback; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightCallback; import static info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers.getWakeLock; import static info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers.msSince; @@ -22,11 +22,11 @@ import static info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers.tsl; * */ -public class InsightPumpAsyncAdapter { +public class InsightAsyncAdapter { - private final ConcurrentHashMap commandResults = new ConcurrentHashMap<>(); + private final ConcurrentHashMap commandResults = new ConcurrentHashMap<>(); - InsightPumpAsyncAdapter() { + InsightAsyncAdapter() { MainApp.bus().register(this); } @@ -36,7 +36,7 @@ public class InsightPumpAsyncAdapter { } @Subscribe - public void onStatusEvent(final EventInsightPumpCallback ev) { + public void onStatusEvent(final EventInsightCallback ev) { log("Received callback event: " + ev.toString()); commandResults.put(ev.request_uuid, ev); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightFragment.java similarity index 89% rename from app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpFragment.java rename to app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightFragment.java index 3dfcb9b0a3..156c8271e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightFragment.java @@ -19,14 +19,14 @@ import java.util.List; import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.Common.SubscriberFragment; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightUpdateGui; import info.nightscout.androidaps.plugins.PumpInsight.utils.StatusItem; import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter; import info.nightscout.utils.FabricPrivacy; -public class InsightPumpFragment extends SubscriberFragment { - private static final Logger log = LoggerFactory.getLogger(InsightPumpFragment.class); +public class InsightFragment extends SubscriberFragment { + private static final Logger log = LoggerFactory.getLogger(InsightFragment.class); private static final Handler sLoopHandler = new Handler(); private static volatile boolean refresh = false; private static volatile boolean pending = false; @@ -88,7 +88,7 @@ public class InsightPumpFragment extends SubscriberFragment { @Subscribe - public void onStatusEvent(final EventInsightPumpUpdateGui ev) { + public void onStatusEvent(final EventInsightUpdateGui ev) { updateGUI(); } @@ -99,8 +99,8 @@ public class InsightPumpFragment extends SubscriberFragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - final InsightPumpPlugin insightPumpPlugin = InsightPumpPlugin.getPlugin(); - final List l = insightPumpPlugin.getStatusItems(refresh); + final InsightPlugin insightPlugin = InsightPlugin.getPlugin(); + final List l = insightPlugin.getStatusItems(refresh); holder.removeAllViews(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpPlugin.java rename to app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java index 9b84f56da6..ba58093d84 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java @@ -36,8 +36,8 @@ import info.nightscout.androidaps.plugins.PumpInsight.connector.Connector; import info.nightscout.androidaps.plugins.PumpInsight.connector.SetTBRTaskRunner; import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner; import info.nightscout.androidaps.plugins.PumpInsight.connector.WriteBasalProfileTaskRunner; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCallback; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightCallback; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightUpdateGui; import info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver; import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory; import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers; @@ -74,16 +74,16 @@ import static info.nightscout.androidaps.plugins.PumpInsight.history.PumpIdCache */ @SuppressWarnings("AccessStaticViaInstance") -public class InsightPumpPlugin implements PluginBase, PumpInterface, ConstraintsInterface { +public class InsightPlugin implements PluginBase, PumpInterface, ConstraintsInterface { private static final long BUSY_WAIT_TIME = 20000; static Integer batteryPercent = 0; static Integer reservoirInUnits = 0; static boolean initialized = false; private static volatile boolean update_pending = false; - private static Logger log = LoggerFactory.getLogger(InsightPumpPlugin.class); - private static volatile InsightPumpPlugin plugin; - private final InsightPumpAsyncAdapter async = new InsightPumpAsyncAdapter(); + private static Logger log = LoggerFactory.getLogger(InsightPlugin.class); + private static volatile InsightPlugin plugin; + private final InsightAsyncAdapter async = new InsightAsyncAdapter(); private StatusTaskRunner.Result statusResult; private long statusResultTime = -1; private Date lastDataTime = new Date(0); @@ -96,8 +96,8 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints private volatile boolean connector_enabled = false; private List profileBlocks; - private InsightPumpPlugin() { - log("InsightPumpPlugin instantiated"); + private InsightPlugin() { + log("InsightPlugin instantiated"); pumpDescription.isBolusCapable = true; pumpDescription.bolusStep = 0.05d; // specification says 0.05U up to 2U then 0.1U @ 2-5U 0.2U @ 10-20U 0.5U 10-20U (are these just UI restrictions?) @@ -129,7 +129,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints } - public static InsightPumpPlugin getPlugin() { + public static InsightPlugin getPlugin() { if (plugin == null) { createInstance(); } @@ -139,7 +139,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints private static synchronized void createInstance() { if (plugin == null) { log("creating instance"); - plugin = new InsightPumpPlugin(); + plugin = new InsightPlugin(); } } @@ -150,10 +150,10 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints private static void updateGui() { update_pending = false; - MainApp.bus().post(new EventInsightPumpUpdateGui()); + MainApp.bus().post(new EventInsightUpdateGui()); } - private static void pushCallbackEvent(EventInsightPumpCallback e) { + private static void pushCallbackEvent(EventInsightCallback e) { MainApp.bus().post(e); } @@ -184,7 +184,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints @Override public String getFragmentClass() { - return InsightPumpFragment.class.getName(); + return InsightFragment.class.getName(); } @Override @@ -289,7 +289,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints @Override public void connect(String reason) { - log("InsightPumpPlugin::connect()"); + log("InsightPlugin::connect()"); try { if (!connector.isPumpConnected()) { if (Helpers.ratelimit("insight-connect-timer", 40)) { @@ -311,7 +311,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints @Override public void disconnect(String reason) { - log("InsightPumpPlugin::disconnect()"); + log("InsightPlugin::disconnect()"); try { if (!SP.getBoolean("insight_always_connected", false)) { log("Requesting disconnect"); @@ -326,7 +326,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints @Override public void stopConnecting() { - log("InsightPumpPlugin::stopConnecting()"); + log("InsightPlugin::stopConnecting()"); try { if (isConnecting()) { if (!SP.getBoolean("insight_always_connected", false)) { @@ -1011,7 +1011,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints // if (!isConnected()) return false; //if (isBusy()) return false; log("asyncSinglecommand called: " + name); - final EventInsightPumpCallback event = new EventInsightPumpCallback(); + final EventInsightCallback event = new EventInsightCallback(); new Thread() { @Override public void run() { @@ -1050,7 +1050,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints // if (!isConnected()) return false; //if (isBusy()) return false; log("asyncTaskRunner called: " + name); - final EventInsightPumpCallback event = new EventInsightPumpCallback(); + final EventInsightCallback event = new EventInsightCallback(); new Thread() { @Override public void run() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/Mstatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/Mstatus.java index 57e6da7f2a..8797325f7c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/Mstatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/Mstatus.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.PumpInsight; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCallback; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightCallback; /** * Created by jamorham on 01/02/2018. @@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCal class Mstatus { Cstatus cstatus = Cstatus.UNKNOWN; - EventInsightPumpCallback event; + EventInsightCallback event; // comment field preparation for results String getCommandComment() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java index 311e487b9f..a96c98a39a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java @@ -14,7 +14,7 @@ import java.util.Map; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventFeatureRunning; -import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui; +import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightUpdateGui; import info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver; import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory; import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers; @@ -76,7 +76,7 @@ public class Connector { extendKeepAliveIfActive(); } - MainApp.bus().post(new EventInsightPumpUpdateGui()); + MainApp.bus().post(new EventInsightUpdateGui()); } else { log("Same status as before: " + status); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpCallback.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightCallback.java similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpCallback.java rename to app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightCallback.java index 964270cb45..16cb5af457 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpCallback.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightCallback.java @@ -7,7 +7,7 @@ import info.nightscout.androidaps.events.Event; /** * Created by jamorham on 23/01/2018. */ -public class EventInsightPumpCallback extends Event { +public class EventInsightCallback extends Event { public UUID request_uuid; public boolean success = false; @@ -15,7 +15,7 @@ public class EventInsightPumpCallback extends Event { public int response_id = -1; public Object response_object = null; - public EventInsightPumpCallback() { + public EventInsightCallback() { request_uuid = UUID.randomUUID(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpUpdateGui.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightUpdateGui.java similarity index 72% rename from app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpUpdateGui.java rename to app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightUpdateGui.java index 79e975ac31..3741c607c4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightPumpUpdateGui.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/events/EventInsightUpdateGui.java @@ -5,5 +5,5 @@ import info.nightscout.androidaps.events.EventUpdateGui; /** * Created by jamorham on 23/01/2018. */ -public class EventInsightPumpUpdateGui extends EventUpdateGui { +public class EventInsightUpdateGui extends EventUpdateGui { } diff --git a/app/src/main/res/layout/insightpump_fragment.xml b/app/src/main/res/layout/insightpump_fragment.xml index 4d3d580336..2ab1a50d2a 100644 --- a/app/src/main/res/layout/insightpump_fragment.xml +++ b/app/src/main/res/layout/insightpump_fragment.xml @@ -2,7 +2,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="info.nightscout.androidaps.plugins.PumpInsight.InsightPumpFragment"> + tools:context="info.nightscout.androidaps.plugins.PumpInsight.InsightFragment"> constraintsPluginsList = new ArrayList<>(); constraintsPluginsList.add(safetyPlugin); constraintsPluginsList.add(objectivesPlugin); diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/PumpInsightTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPluginTest.java similarity index 81% rename from app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/PumpInsightTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPluginTest.java index e8481f64ef..a4432b6ffc 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/PumpInsightTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPluginTest.java @@ -25,9 +25,9 @@ import info.nightscout.utils.ToastUtils; @RunWith(PowerMockRunner.class) @PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, ToastUtils.class, Context.class}) -public class PumpInsightTest { +public class InsightPluginTest { - InsightPumpPlugin insightPlugin; + InsightPlugin insightPlugin; @Test public void basalRateShouldBeLimited() throws Exception { @@ -39,8 +39,8 @@ public class PumpInsightTest { Constraint c = new Constraint<>(Constants.REALLYHIGHBASALRATE); insightPlugin.applyBasalConstraints(c, AAPSMocker.getValidProfile()); Assert.assertEquals(1.1d, c.value()); - Assert.assertEquals("InsightPump: Limiting basal rate to 1.10 U/h because of pump limit", c.getReasons()); - Assert.assertEquals("InsightPump: Limiting basal rate to 1.10 U/h because of pump limit", c.getMostLimitedReasons()); + Assert.assertEquals("Insight: Limiting basal rate to 1.10 U/h because of pump limit", c.getReasons()); + Assert.assertEquals("Insight: Limiting basal rate to 1.10 U/h because of pump limit", c.getMostLimitedReasons()); } @Before @@ -50,7 +50,7 @@ public class PumpInsightTest { AAPSMocker.mockBus(); AAPSMocker.mockStrings(); - insightPlugin = InsightPumpPlugin.getPlugin(); + insightPlugin = InsightPlugin.getPlugin(); } }