rename InsightPump -> Insight
This commit is contained in:
parent
15d8719508
commit
661595792f
11 changed files with 47 additions and 47 deletions
|
@ -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());
|
||||
|
|
|
@ -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<UUID, EventInsightPumpCallback> commandResults = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<UUID, EventInsightCallback> 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);
|
||||
}
|
|
@ -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<StatusItem> l = insightPumpPlugin.getStatusItems(refresh);
|
||||
final InsightPlugin insightPlugin = InsightPlugin.getPlugin();
|
||||
final List<StatusItem> l = insightPlugin.getStatusItems(refresh);
|
||||
|
||||
holder.removeAllViews();
|
||||
|
|
@ -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<BRProfileBlock.ProfileBlock> 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() {
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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 {
|
||||
}
|
|
@ -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">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -31,7 +31,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ComboPlugin;
|
|||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
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.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
|
@ -54,7 +54,7 @@ public class ConstraintsCheckerTest {
|
|||
ComboPlugin comboPlugin;
|
||||
DanaRPlugin danaRPlugin;
|
||||
DanaRSPlugin danaRSPlugin;
|
||||
InsightPumpPlugin insightPlugin;
|
||||
InsightPlugin insightPlugin;
|
||||
|
||||
boolean notificationSent = false;
|
||||
|
||||
|
@ -258,7 +258,7 @@ public class ConstraintsCheckerTest {
|
|||
comboPlugin = ComboPlugin.getPlugin();
|
||||
danaRPlugin = DanaRPlugin.getPlugin();
|
||||
danaRSPlugin = DanaRSPlugin.getPlugin();
|
||||
insightPlugin = InsightPumpPlugin.getPlugin();
|
||||
insightPlugin = InsightPlugin.getPlugin();
|
||||
ArrayList<PluginBase> constraintsPluginsList = new ArrayList<>();
|
||||
constraintsPluginsList.add(safetyPlugin);
|
||||
constraintsPluginsList.add(objectivesPlugin);
|
||||
|
|
|
@ -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<Double> 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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue