rename InsightPump -> Insight

This commit is contained in:
Milos Kozak 2018-03-23 17:51:05 +01:00
parent 15d8719508
commit 661595792f
11 changed files with 47 additions and 47 deletions

View file

@ -60,7 +60,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; 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.PumpMDI.MDIPlugin;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin; 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(DanaRv2Plugin.getPlugin());
if (Config.HWPUMPS) pluginsList.add(DanaRSPlugin.getPlugin()); if (Config.HWPUMPS) pluginsList.add(DanaRSPlugin.getPlugin());
pluginsList.add(CareportalPlugin.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.HWPUMPS && engineeringMode) pluginsList.add(ComboPlugin.getPlugin()); // <-- Enable Combo plugin here
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin()); if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin()); if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin());

View file

@ -8,7 +8,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import info.nightscout.androidaps.MainApp; 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.getWakeLock;
import static info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers.msSince; 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<UUID, EventInsightPumpCallback> commandResults = new ConcurrentHashMap<>(); private final ConcurrentHashMap<UUID, EventInsightCallback> commandResults = new ConcurrentHashMap<>();
InsightPumpAsyncAdapter() { InsightAsyncAdapter() {
MainApp.bus().register(this); MainApp.bus().register(this);
} }
@ -36,7 +36,7 @@ public class InsightPumpAsyncAdapter {
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventInsightPumpCallback ev) { public void onStatusEvent(final EventInsightCallback ev) {
log("Received callback event: " + ev.toString()); log("Received callback event: " + ev.toString());
commandResults.put(ev.request_uuid, ev); commandResults.put(ev.request_uuid, ev);
} }

View file

@ -19,14 +19,14 @@ import java.util.List;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; 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.StatusItem;
import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter; import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter;
import info.nightscout.utils.FabricPrivacy; import info.nightscout.utils.FabricPrivacy;
public class InsightPumpFragment extends SubscriberFragment { public class InsightFragment extends SubscriberFragment {
private static final Logger log = LoggerFactory.getLogger(InsightPumpFragment.class); private static final Logger log = LoggerFactory.getLogger(InsightFragment.class);
private static final Handler sLoopHandler = new Handler(); private static final Handler sLoopHandler = new Handler();
private static volatile boolean refresh = false; private static volatile boolean refresh = false;
private static volatile boolean pending = false; private static volatile boolean pending = false;
@ -88,7 +88,7 @@ public class InsightPumpFragment extends SubscriberFragment {
@Subscribe @Subscribe
public void onStatusEvent(final EventInsightPumpUpdateGui ev) { public void onStatusEvent(final EventInsightUpdateGui ev) {
updateGUI(); updateGUI();
} }
@ -99,8 +99,8 @@ public class InsightPumpFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
final InsightPumpPlugin insightPumpPlugin = InsightPumpPlugin.getPlugin(); final InsightPlugin insightPlugin = InsightPlugin.getPlugin();
final List<StatusItem> l = insightPumpPlugin.getStatusItems(refresh); final List<StatusItem> l = insightPlugin.getStatusItems(refresh);
holder.removeAllViews(); holder.removeAllViews();

View file

@ -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.SetTBRTaskRunner;
import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner; import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner;
import info.nightscout.androidaps.plugins.PumpInsight.connector.WriteBasalProfileTaskRunner; import info.nightscout.androidaps.plugins.PumpInsight.connector.WriteBasalProfileTaskRunner;
import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCallback; import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightCallback;
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.HistoryReceiver;
import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory; import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory;
import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers; import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers;
@ -74,16 +74,16 @@ import static info.nightscout.androidaps.plugins.PumpInsight.history.PumpIdCache
*/ */
@SuppressWarnings("AccessStaticViaInstance") @SuppressWarnings("AccessStaticViaInstance")
public class InsightPumpPlugin implements PluginBase, PumpInterface, ConstraintsInterface { public class InsightPlugin implements PluginBase, PumpInterface, ConstraintsInterface {
private static final long BUSY_WAIT_TIME = 20000; private static final long BUSY_WAIT_TIME = 20000;
static Integer batteryPercent = 0; static Integer batteryPercent = 0;
static Integer reservoirInUnits = 0; static Integer reservoirInUnits = 0;
static boolean initialized = false; static boolean initialized = false;
private static volatile boolean update_pending = false; private static volatile boolean update_pending = false;
private static Logger log = LoggerFactory.getLogger(InsightPumpPlugin.class); private static Logger log = LoggerFactory.getLogger(InsightPlugin.class);
private static volatile InsightPumpPlugin plugin; private static volatile InsightPlugin plugin;
private final InsightPumpAsyncAdapter async = new InsightPumpAsyncAdapter(); private final InsightAsyncAdapter async = new InsightAsyncAdapter();
private StatusTaskRunner.Result statusResult; private StatusTaskRunner.Result statusResult;
private long statusResultTime = -1; private long statusResultTime = -1;
private Date lastDataTime = new Date(0); private Date lastDataTime = new Date(0);
@ -96,8 +96,8 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
private volatile boolean connector_enabled = false; private volatile boolean connector_enabled = false;
private List<BRProfileBlock.ProfileBlock> profileBlocks; private List<BRProfileBlock.ProfileBlock> profileBlocks;
private InsightPumpPlugin() { private InsightPlugin() {
log("InsightPumpPlugin instantiated"); log("InsightPlugin instantiated");
pumpDescription.isBolusCapable = true; 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?) 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) { if (plugin == null) {
createInstance(); createInstance();
} }
@ -139,7 +139,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
private static synchronized void createInstance() { private static synchronized void createInstance() {
if (plugin == null) { if (plugin == null) {
log("creating instance"); log("creating instance");
plugin = new InsightPumpPlugin(); plugin = new InsightPlugin();
} }
} }
@ -150,10 +150,10 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
private static void updateGui() { private static void updateGui() {
update_pending = false; 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); MainApp.bus().post(e);
} }
@ -184,7 +184,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
@Override @Override
public String getFragmentClass() { public String getFragmentClass() {
return InsightPumpFragment.class.getName(); return InsightFragment.class.getName();
} }
@Override @Override
@ -289,7 +289,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
@Override @Override
public void connect(String reason) { public void connect(String reason) {
log("InsightPumpPlugin::connect()"); log("InsightPlugin::connect()");
try { try {
if (!connector.isPumpConnected()) { if (!connector.isPumpConnected()) {
if (Helpers.ratelimit("insight-connect-timer", 40)) { if (Helpers.ratelimit("insight-connect-timer", 40)) {
@ -311,7 +311,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
@Override @Override
public void disconnect(String reason) { public void disconnect(String reason) {
log("InsightPumpPlugin::disconnect()"); log("InsightPlugin::disconnect()");
try { try {
if (!SP.getBoolean("insight_always_connected", false)) { if (!SP.getBoolean("insight_always_connected", false)) {
log("Requesting disconnect"); log("Requesting disconnect");
@ -326,7 +326,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
@Override @Override
public void stopConnecting() { public void stopConnecting() {
log("InsightPumpPlugin::stopConnecting()"); log("InsightPlugin::stopConnecting()");
try { try {
if (isConnecting()) { if (isConnecting()) {
if (!SP.getBoolean("insight_always_connected", false)) { if (!SP.getBoolean("insight_always_connected", false)) {
@ -1011,7 +1011,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
// if (!isConnected()) return false; // if (!isConnected()) return false;
//if (isBusy()) return false; //if (isBusy()) return false;
log("asyncSinglecommand called: " + name); log("asyncSinglecommand called: " + name);
final EventInsightPumpCallback event = new EventInsightPumpCallback(); final EventInsightCallback event = new EventInsightCallback();
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
@ -1050,7 +1050,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
// if (!isConnected()) return false; // if (!isConnected()) return false;
//if (isBusy()) return false; //if (isBusy()) return false;
log("asyncTaskRunner called: " + name); log("asyncTaskRunner called: " + name);
final EventInsightPumpCallback event = new EventInsightPumpCallback(); final EventInsightCallback event = new EventInsightCallback();
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.PumpInsight; 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. * Created by jamorham on 01/02/2018.
@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpCal
class Mstatus { class Mstatus {
Cstatus cstatus = Cstatus.UNKNOWN; Cstatus cstatus = Cstatus.UNKNOWN;
EventInsightPumpCallback event; EventInsightCallback event;
// comment field preparation for results // comment field preparation for results
String getCommandComment() { String getCommandComment() {

View file

@ -14,7 +14,7 @@ import java.util.Map;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventFeatureRunning; 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.HistoryReceiver;
import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory; import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory;
import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers; import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers;
@ -76,7 +76,7 @@ public class Connector {
extendKeepAliveIfActive(); extendKeepAliveIfActive();
} }
MainApp.bus().post(new EventInsightPumpUpdateGui()); MainApp.bus().post(new EventInsightUpdateGui());
} else { } else {
log("Same status as before: " + status); log("Same status as before: " + status);
} }

View file

@ -7,7 +7,7 @@ import info.nightscout.androidaps.events.Event;
/** /**
* Created by jamorham on 23/01/2018. * Created by jamorham on 23/01/2018.
*/ */
public class EventInsightPumpCallback extends Event { public class EventInsightCallback extends Event {
public UUID request_uuid; public UUID request_uuid;
public boolean success = false; public boolean success = false;
@ -15,7 +15,7 @@ public class EventInsightPumpCallback extends Event {
public int response_id = -1; public int response_id = -1;
public Object response_object = null; public Object response_object = null;
public EventInsightPumpCallback() { public EventInsightCallback() {
request_uuid = UUID.randomUUID(); request_uuid = UUID.randomUUID();
} }

View file

@ -5,5 +5,5 @@ import info.nightscout.androidaps.events.EventUpdateGui;
/** /**
* Created by jamorham on 23/01/2018. * Created by jamorham on 23/01/2018.
*/ */
public class EventInsightPumpUpdateGui extends EventUpdateGui { public class EventInsightUpdateGui extends EventUpdateGui {
} }

View file

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.PumpInsight.InsightPumpFragment"> tools:context="info.nightscout.androidaps.plugins.PumpInsight.InsightFragment">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -31,7 +31,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ComboPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
import info.nightscout.androidaps.plugins.PumpInsight.InsightPumpPlugin; import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin;
import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner; import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.utils.FabricPrivacy; import info.nightscout.utils.FabricPrivacy;
@ -54,7 +54,7 @@ public class ConstraintsCheckerTest {
ComboPlugin comboPlugin; ComboPlugin comboPlugin;
DanaRPlugin danaRPlugin; DanaRPlugin danaRPlugin;
DanaRSPlugin danaRSPlugin; DanaRSPlugin danaRSPlugin;
InsightPumpPlugin insightPlugin; InsightPlugin insightPlugin;
boolean notificationSent = false; boolean notificationSent = false;
@ -258,7 +258,7 @@ public class ConstraintsCheckerTest {
comboPlugin = ComboPlugin.getPlugin(); comboPlugin = ComboPlugin.getPlugin();
danaRPlugin = DanaRPlugin.getPlugin(); danaRPlugin = DanaRPlugin.getPlugin();
danaRSPlugin = DanaRSPlugin.getPlugin(); danaRSPlugin = DanaRSPlugin.getPlugin();
insightPlugin = InsightPumpPlugin.getPlugin(); insightPlugin = InsightPlugin.getPlugin();
ArrayList<PluginBase> constraintsPluginsList = new ArrayList<>(); ArrayList<PluginBase> constraintsPluginsList = new ArrayList<>();
constraintsPluginsList.add(safetyPlugin); constraintsPluginsList.add(safetyPlugin);
constraintsPluginsList.add(objectivesPlugin); constraintsPluginsList.add(objectivesPlugin);

View file

@ -25,9 +25,9 @@ import info.nightscout.utils.ToastUtils;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, ToastUtils.class, Context.class}) @PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, ToastUtils.class, Context.class})
public class PumpInsightTest { public class InsightPluginTest {
InsightPumpPlugin insightPlugin; InsightPlugin insightPlugin;
@Test @Test
public void basalRateShouldBeLimited() throws Exception { public void basalRateShouldBeLimited() throws Exception {
@ -39,8 +39,8 @@ public class PumpInsightTest {
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE); Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
insightPlugin.applyBasalConstraints(c, AAPSMocker.getValidProfile()); insightPlugin.applyBasalConstraints(c, AAPSMocker.getValidProfile());
Assert.assertEquals(1.1d, c.value()); 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("Insight: 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.getMostLimitedReasons());
} }
@Before @Before
@ -50,7 +50,7 @@ public class PumpInsightTest {
AAPSMocker.mockBus(); AAPSMocker.mockBus();
AAPSMocker.mockStrings(); AAPSMocker.mockStrings();
insightPlugin = InsightPumpPlugin.getPlugin(); insightPlugin = InsightPlugin.getPlugin();
} }
} }