LoopPluginTest
This commit is contained in:
parent
30f09dc416
commit
044a3fc10f
55 changed files with 221 additions and 113 deletions
|
@ -28,7 +28,7 @@ public interface PluginBase {
|
||||||
boolean canBeHidden(int type);
|
boolean canBeHidden(int type);
|
||||||
boolean hasFragment();
|
boolean hasFragment();
|
||||||
boolean showInList(int type);
|
boolean showInList(int type);
|
||||||
void setFragmentEnabled(int type, boolean fragmentEnabled);
|
void setPluginEnabled(int type, boolean fragmentEnabled);
|
||||||
void setFragmentVisible(int type, boolean fragmentVisible);
|
void setFragmentVisible(int type, boolean fragmentVisible);
|
||||||
int getPreferencesId();
|
int getPreferencesId();
|
||||||
}
|
}
|
|
@ -65,7 +65,7 @@ public class ActionsPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class CareportalPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class ConfigBuilderFragment extends Fragment {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
CheckBox cb = (CheckBox) v;
|
CheckBox cb = (CheckBox) v;
|
||||||
PluginBase plugin = (PluginBase) cb.getTag();
|
PluginBase plugin = (PluginBase) cb.getTag();
|
||||||
plugin.setFragmentEnabled(type, cb.isChecked());
|
plugin.setPluginEnabled(type, cb.isChecked());
|
||||||
plugin.setFragmentVisible(type, cb.isChecked());
|
plugin.setFragmentVisible(type, cb.isChecked());
|
||||||
onEnabledCategoryChanged(plugin, type);
|
onEnabledCategoryChanged(plugin, type);
|
||||||
configBuilderPlugin.storeSettings();
|
configBuilderPlugin.storeSettings();
|
||||||
|
@ -316,7 +316,7 @@ public class ConfigBuilderFragment extends Fragment {
|
||||||
if (type == PluginBase.INSULIN || type == PluginBase.PUMP || type == PluginBase.TREATMENT || type == PluginBase.PROFILE || type == PluginBase.SENSITIVITY)
|
if (type == PluginBase.INSULIN || type == PluginBase.PUMP || type == PluginBase.TREATMENT || type == PluginBase.PROFILE || type == PluginBase.SENSITIVITY)
|
||||||
if (pluginList.size() < 2) {
|
if (pluginList.size() < 2) {
|
||||||
holder.checkboxEnabled.setEnabled(false);
|
holder.checkboxEnabled.setEnabled(false);
|
||||||
plugin.setFragmentEnabled(type, true);
|
plugin.setPluginEnabled(type, true);
|
||||||
getPlugin().storeSettings();
|
getPlugin().storeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,21 +390,21 @@ public class ConfigBuilderFragment extends Fragment {
|
||||||
if (p.getName().equals(changedPlugin.getName())) {
|
if (p.getName().equals(changedPlugin.getName())) {
|
||||||
// this is new selected
|
// this is new selected
|
||||||
} else {
|
} else {
|
||||||
p.setFragmentEnabled(type, false);
|
p.setPluginEnabled(type, false);
|
||||||
p.setFragmentVisible(type, false);
|
p.setFragmentVisible(type, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // enable first plugin in list
|
} else { // enable first plugin in list
|
||||||
if (type == PluginBase.PUMP)
|
if (type == PluginBase.PUMP)
|
||||||
MainApp.getSpecificPlugin(VirtualPumpPlugin.class).setFragmentEnabled(type, true);
|
MainApp.getSpecificPlugin(VirtualPumpPlugin.class).setPluginEnabled(type, true);
|
||||||
else if (type == PluginBase.INSULIN)
|
else if (type == PluginBase.INSULIN)
|
||||||
MainApp.getSpecificPlugin(InsulinFastactingPlugin.class).setFragmentEnabled(type, true);
|
MainApp.getSpecificPlugin(InsulinFastactingPlugin.class).setPluginEnabled(type, true);
|
||||||
else if (type == PluginBase.SENSITIVITY)
|
else if (type == PluginBase.SENSITIVITY)
|
||||||
MainApp.getSpecificPlugin(SensitivityOref0Plugin.class).setFragmentEnabled(type, true);
|
MainApp.getSpecificPlugin(SensitivityOref0Plugin.class).setPluginEnabled(type, true);
|
||||||
else if (type == PluginBase.PROFILE)
|
else if (type == PluginBase.PROFILE)
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentEnabled(type, true);
|
MainApp.getSpecificPlugin(NSProfilePlugin.class).setPluginEnabled(type, true);
|
||||||
else
|
else
|
||||||
pluginsInCategory.get(0).setFragmentEnabled(type, true);
|
pluginsInCategory.get(0).setPluginEnabled(type, true);
|
||||||
}
|
}
|
||||||
setViews();
|
setViews();
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class ConfigBuilderPlugin implements PluginBase, TreatmentsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
// Always enabled
|
// Always enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class ConfigBuilderPlugin implements PluginBase, TreatmentsInterface {
|
||||||
String settingEnabled = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Enabled";
|
String settingEnabled = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Enabled";
|
||||||
String settingVisible = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Visible";
|
String settingVisible = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Visible";
|
||||||
if (SP.contains(settingEnabled))
|
if (SP.contains(settingEnabled))
|
||||||
p.setFragmentEnabled(type, SP.getBoolean(settingEnabled, true));
|
p.setPluginEnabled(type, SP.getBoolean(settingEnabled, true));
|
||||||
if (SP.contains(settingVisible))
|
if (SP.contains(settingVisible))
|
||||||
p.setFragmentVisible(type, SP.getBoolean(settingVisible, true) && SP.getBoolean(settingEnabled, true));
|
p.setFragmentVisible(type, SP.getBoolean(settingVisible, true) && SP.getBoolean(settingEnabled, true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -338,7 +338,7 @@ public class ConfigBuilderPlugin implements PluginBase, TreatmentsInterface {
|
||||||
found = p;
|
found = p;
|
||||||
} else if (p.isEnabled(type)) {
|
} else if (p.isEnabled(type)) {
|
||||||
// set others disabled
|
// set others disabled
|
||||||
p.setFragmentEnabled(type, false);
|
p.setPluginEnabled(type, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If none enabled, enable first one
|
// If none enabled, enable first one
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class FoodPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class InsulinFastactingPlugin implements PluginBase, InsulinInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import info.nightscout.utils.SP;
|
||||||
public class LoopPlugin implements PluginBase {
|
public class LoopPlugin implements PluginBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(LoopPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(LoopPlugin.class);
|
||||||
|
|
||||||
private static LoopPlugin loopPlugin;
|
protected static LoopPlugin loopPlugin;
|
||||||
|
|
||||||
public static LoopPlugin getPlugin() {
|
public static LoopPlugin getPlugin() {
|
||||||
if (loopPlugin == null) {
|
if (loopPlugin == null) {
|
||||||
|
@ -55,7 +55,7 @@ public class LoopPlugin implements PluginBase {
|
||||||
return loopPlugin;
|
return loopPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fragmentEnabled = false;
|
private boolean pluginEnabled = false;
|
||||||
private boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private long loopSuspendedTill = 0L; // end of manual loop suspend
|
private long loopSuspendedTill = 0L; // end of manual loop suspend
|
||||||
|
@ -94,12 +94,12 @@ public class LoopPlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return MainApp.instance().getString(R.string.loop);
|
return MainApp.instance().gs(R.string.loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameShort() {
|
public String getNameShort() {
|
||||||
String name = MainApp.sResources.getString(R.string.loop_shortname);
|
String name = MainApp.gs(R.string.loop_shortname);
|
||||||
if (!name.trim().isEmpty()) {
|
if (!name.trim().isEmpty()) {
|
||||||
//only if translation exists
|
//only if translation exists
|
||||||
return name;
|
return name;
|
||||||
|
@ -111,7 +111,7 @@ public class LoopPlugin implements PluginBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(int type) {
|
public boolean isEnabled(int type) {
|
||||||
boolean pumpCapable = ConfigBuilderPlugin.getActivePump() == null || ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable;
|
boolean pumpCapable = ConfigBuilderPlugin.getActivePump() == null || ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable;
|
||||||
return type == LOOP && fragmentEnabled && pumpCapable;
|
return type == LOOP && pluginEnabled && pumpCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -136,8 +136,8 @@ public class LoopPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean pluginEnabled) {
|
||||||
if (type == LOOP) this.fragmentEnabled = fragmentEnabled;
|
if (type == LOOP) this.pluginEnabled = pluginEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
if (type == APS) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
return true;
|
return true;
|
||||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
if (item.getTitle().equals(MainApp.sResources.getString(R.string.disableloop))) {
|
if (item.getTitle().equals(MainApp.sResources.getString(R.string.disableloop))) {
|
||||||
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
|
activeloop.setPluginEnabled(PluginBase.LOOP, false);
|
||||||
activeloop.setFragmentVisible(PluginBase.LOOP, false);
|
activeloop.setFragmentVisible(PluginBase.LOOP, false);
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
|
@ -494,7 +494,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
NSUpload.uploadOpenAPSOffline(24 * 60); // upload 24h, we don't know real duration
|
NSUpload.uploadOpenAPSOffline(24 * 60); // upload 24h, we don't know real duration
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.enableloop))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.enableloop))) {
|
||||||
activeloop.setFragmentEnabled(PluginBase.LOOP, true);
|
activeloop.setPluginEnabled(PluginBase.LOOP, true);
|
||||||
activeloop.setFragmentVisible(PluginBase.LOOP, true);
|
activeloop.setFragmentVisible(PluginBase.LOOP, true);
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class OverviewPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
// Always enabled
|
// Always enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class PersistentNotificationPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (getType() == type) {
|
if (getType() == type) {
|
||||||
this.fragmentEnabled = fragmentEnabled;
|
this.fragmentEnabled = fragmentEnabled;
|
||||||
enableDisableNotification(fragmentEnabled);
|
enableDisableNotification(fragmentEnabled);
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
@ -106,16 +105,16 @@ public abstract class AbstractDanaRPlugin implements PluginBase, PumpInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PluginBase.PROFILE)
|
if (type == PluginBase.PROFILE)
|
||||||
mPluginProfileEnabled = fragmentEnabled;
|
mPluginProfileEnabled = fragmentEnabled;
|
||||||
else if (type == PluginBase.PUMP)
|
else if (type == PluginBase.PUMP)
|
||||||
mPluginPumpEnabled = fragmentEnabled;
|
mPluginPumpEnabled = fragmentEnabled;
|
||||||
// if pump profile was enabled need to switch to another too
|
// if pump profile was enabled need to switch to another too
|
||||||
if (type == PluginBase.PUMP && !fragmentEnabled && mPluginProfileEnabled) {
|
if (type == PluginBase.PUMP && !fragmentEnabled && mPluginProfileEnabled) {
|
||||||
setFragmentEnabled(PluginBase.PROFILE, false);
|
setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
setFragmentVisible(PluginBase.PROFILE, false);
|
setFragmentVisible(PluginBase.PROFILE, false);
|
||||||
NSProfilePlugin.getPlugin().setFragmentEnabled(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
NSProfilePlugin.getPlugin().setFragmentVisible(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentVisible(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,17 +31,17 @@ public class MsgInitConnStatusTime extends MessageBase {
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to Korean DanaR");
|
log.debug("Wrong model selected. Switching to Korean DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
||||||
|
|
||||||
DanaRPump.reset(); // mark not initialized
|
DanaRPump.reset(); // mark not initialized
|
||||||
|
|
||||||
//If profile coming from pump, switch it as well
|
//If profile coming from pump, switch it as well
|
||||||
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, true);
|
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
|
|
|
@ -33,17 +33,17 @@ public class MsgInitConnStatusTime_k extends MessageBase {
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to export DanaR");
|
log.debug("Wrong model selected. Switching to export DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
||||||
|
|
||||||
DanaRPump.reset(); // mark not initialized
|
DanaRPump.reset(); // mark not initialized
|
||||||
|
|
||||||
//If profile coming from pump, switch it as well
|
//If profile coming from pump, switch it as well
|
||||||
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PROFILE)) {
|
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PROFILE)) {
|
||||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, true);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
@ -114,16 +113,16 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PluginBase.PROFILE)
|
if (type == PluginBase.PROFILE)
|
||||||
this.fragmentProfileEnabled = fragmentEnabled;
|
this.fragmentProfileEnabled = fragmentEnabled;
|
||||||
else if (type == PluginBase.PUMP)
|
else if (type == PluginBase.PUMP)
|
||||||
this.fragmentPumpEnabled = fragmentEnabled;
|
this.fragmentPumpEnabled = fragmentEnabled;
|
||||||
// if pump profile was enabled need to switch to another too
|
// if pump profile was enabled need to switch to another too
|
||||||
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
||||||
setFragmentEnabled(PluginBase.PROFILE, false);
|
setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
setFragmentVisible(PluginBase.PROFILE, false);
|
setFragmentVisible(PluginBase.PROFILE, false);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
|
MainApp.getSpecificPlugin(NSProfilePlugin.class).setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
|
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package info.nightscout.androidaps.plugins.PumpDanaRv2.comm;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -45,17 +43,17 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to Korean DanaR");
|
log.debug("Wrong model selected. Switching to Korean DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
||||||
|
|
||||||
DanaRPump.reset(); // mark not initialized
|
DanaRPump.reset(); // mark not initialized
|
||||||
|
|
||||||
//If profile coming from pump, switch it as well
|
//If profile coming from pump, switch it as well
|
||||||
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, true);
|
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
|
@ -70,15 +68,15 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to non APS DanaR");
|
log.debug("Wrong model selected. Switching to non APS DanaR");
|
||||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setFragmentEnabled(PluginBase.PUMP, false);
|
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginBase.PUMP, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setFragmentVisible(PluginBase.PUMP, false);
|
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setFragmentVisible(PluginBase.PUMP, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PUMP, true);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginBase.PUMP, true);
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentVisible(PluginBase.PUMP, true);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentVisible(PluginBase.PUMP, true);
|
||||||
|
|
||||||
//If profile coming from pump, switch it as well
|
//If profile coming from pump, switch it as well
|
||||||
if(MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginBase.PROFILE)){
|
if(MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginBase.PROFILE)){
|
||||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginBase.PROFILE, false);
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, true);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.getConfigBuilder().storeSettings();
|
MainApp.getConfigBuilder().storeSettings();
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class InsightPlugin implements PluginBase, PumpInterface, ConstraintsInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PUMP) {
|
if (type == PUMP) {
|
||||||
if (fragmentEnabled) {
|
if (fragmentEnabled) {
|
||||||
enableConnector();
|
enableConnector();
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
if (type == SENSITIVITY) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
case "STOP":
|
case "STOP":
|
||||||
LoopPlugin loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
LoopPlugin loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||||
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
|
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
|
||||||
loopPlugin.setFragmentEnabled(PluginBase.LOOP, false);
|
loopPlugin.setPluginEnabled(PluginBase.LOOP, false);
|
||||||
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -304,7 +304,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
case "START":
|
case "START":
|
||||||
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||||
if (loopPlugin != null && !loopPlugin.isEnabled(PluginBase.LOOP)) {
|
if (loopPlugin != null && !loopPlugin.isEnabled(PluginBase.LOOP)) {
|
||||||
loopPlugin.setFragmentEnabled(PluginBase.LOOP, true);
|
loopPlugin.setPluginEnabled(PluginBase.LOOP, true);
|
||||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeenenabled);
|
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeenenabled);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||||
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START"));
|
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START"));
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == TREATMENT) this.fragmentEnabled = fragmentEnabled;
|
if (type == TREATMENT) this.fragmentEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class WearPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) {
|
if (type == GENERAL) {
|
||||||
this.fragmentEnabled = fragmentEnabled;
|
this.fragmentEnabled = fragmentEnabled;
|
||||||
if (watchUS != null) {
|
if (watchUS != null) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == GENERAL) {
|
if (type == GENERAL) {
|
||||||
this.fragmentEnabled = fragmentEnabled;
|
this.fragmentEnabled = fragmentEnabled;
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ public class AAPSMocker {
|
||||||
when(MainApp.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s");
|
when(MainApp.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s");
|
||||||
when(MainApp.gs(R.string.limitingiob)).thenReturn("Limiting IOB to %.1f U because of %s");
|
when(MainApp.gs(R.string.limitingiob)).thenReturn("Limiting IOB to %.1f U because of %s");
|
||||||
when(MainApp.gs(R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable");
|
when(MainApp.gs(R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable");
|
||||||
|
when(MainApp.gs(R.string.loop)).thenReturn("Loop");
|
||||||
|
when(MainApp.gs(R.string.loop_shortname)).thenReturn("LOOP");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainApp mockMainApp() {
|
public static MainApp mockMainApp() {
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class DanaRPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void basalRateShouldBeLimited() throws Exception {
|
public void basalRateShouldBeLimited() throws Exception {
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
||||||
|
@ -49,8 +49,8 @@ public class DanaRPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void percentBasalRateShouldBeLimited() throws Exception {
|
public void percentBasalRateShouldBeLimited() throws Exception {
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
Constraint<Integer> c = new Constraint<>(Constants.REALLYHIGHPERCENTBASALRATE);
|
Constraint<Integer> c = new Constraint<>(Constants.REALLYHIGHPERCENTBASALRATE);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ConstraintsCheckerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isLoopInvokationAllowedTest() throws Exception {
|
public void isLoopInvokationAllowedTest() throws Exception {
|
||||||
comboPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
comboPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
comboPlugin.setValidBasalRateProfileSelectedOnPump(false);
|
comboPlugin.setValidBasalRateProfileSelectedOnPump(false);
|
||||||
|
|
||||||
Constraint<Boolean> c = constraintChecker.isLoopInvokationAllowed();
|
Constraint<Boolean> c = constraintChecker.isLoopInvokationAllowed();
|
||||||
|
@ -125,12 +125,12 @@ public class ConstraintsCheckerTest {
|
||||||
@Test
|
@Test
|
||||||
public void basalRateShouldBeLimited() throws Exception {
|
public void basalRateShouldBeLimited() throws Exception {
|
||||||
// DanaR, RS
|
// DanaR, RS
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
// Insight
|
// Insight
|
||||||
insightPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
insightPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
||||||
result.maximumBasalAmount = 1.1d;
|
result.maximumBasalAmount = 1.1d;
|
||||||
insightPlugin.setStatusResult(result);
|
insightPlugin.setStatusResult(result);
|
||||||
|
@ -152,12 +152,12 @@ public class ConstraintsCheckerTest {
|
||||||
@Test
|
@Test
|
||||||
public void percentBasalRateShouldBeLimited() throws Exception {
|
public void percentBasalRateShouldBeLimited() throws Exception {
|
||||||
// DanaR, RS
|
// DanaR, RS
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
// Insight
|
// Insight
|
||||||
insightPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
insightPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
||||||
result.maximumBasalAmount = 1.1d;
|
result.maximumBasalAmount = 1.1d;
|
||||||
insightPlugin.setStatusResult(result);
|
insightPlugin.setStatusResult(result);
|
||||||
|
@ -180,12 +180,12 @@ public class ConstraintsCheckerTest {
|
||||||
@Test
|
@Test
|
||||||
public void bolusAmountShouldBeLimited() throws Exception {
|
public void bolusAmountShouldBeLimited() throws Exception {
|
||||||
// DanaR, RS
|
// DanaR, RS
|
||||||
danaRPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBolus = 6d;
|
DanaRPump.getInstance().maxBolus = 6d;
|
||||||
|
|
||||||
// Insight
|
// Insight
|
||||||
insightPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
insightPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
||||||
result.maximumBolusAmount = 7d;
|
result.maximumBolusAmount = 7d;
|
||||||
insightPlugin.setStatusResult(result);
|
insightPlugin.setStatusResult(result);
|
||||||
|
@ -221,9 +221,9 @@ public class ConstraintsCheckerTest {
|
||||||
// No limit by default
|
// No limit by default
|
||||||
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
|
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
|
||||||
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
||||||
OpenAPSMAPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
OpenAPSAMAPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
OpenAPSSMBPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
|
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
|
||||||
|
|
|
@ -185,9 +185,9 @@ public class SafetyPluginTest {
|
||||||
public void iobShouldBeLimited() throws Exception {
|
public void iobShouldBeLimited() throws Exception {
|
||||||
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
|
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
|
||||||
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
||||||
OpenAPSMAPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
OpenAPSAMAPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
OpenAPSSMBPlugin.getPlugin().setFragmentEnabled(PluginBase.APS, true);
|
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginBase.APS, true);
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
Constraint<Double> d = new Constraint<>(Constants.REALLYHIGHIOB);
|
Constraint<Double> d = new Constraint<>(Constants.REALLYHIGHIOB);
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class InsulinOrefBasePluginTest extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setPluginEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
package info.nightscout.androidaps.plugins.Loop;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.squareup.otto.Bus;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.powermock.api.mockito.PowerMockito.when;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 23.03.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, SP.class, Context.class})
|
||||||
|
public class LoopPluginTest {
|
||||||
|
|
||||||
|
VirtualPumpPlugin virtualPumpPlugin;
|
||||||
|
LoopPlugin loopPlugin;
|
||||||
|
MockedBus bus;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPluginInterface() {
|
||||||
|
Assert.assertEquals(LoopFragment.class.getName(), loopPlugin.getFragmentClass());
|
||||||
|
Assert.assertEquals(PluginBase.LOOP, loopPlugin.getType());
|
||||||
|
Assert.assertEquals("Loop", loopPlugin.getName());
|
||||||
|
Assert.assertEquals("LOOP", loopPlugin.getNameShort());
|
||||||
|
Assert.assertEquals(true, loopPlugin.canBeHidden(PluginBase.LOOP));
|
||||||
|
Assert.assertEquals(true, loopPlugin.hasFragment());
|
||||||
|
Assert.assertEquals(true, loopPlugin.showInList(PluginBase.LOOP));
|
||||||
|
Assert.assertEquals(R.xml.pref_closedmode, loopPlugin.getPreferencesId());
|
||||||
|
|
||||||
|
// Plugin is disabled by default
|
||||||
|
Assert.assertEquals(false, loopPlugin.isEnabled(PluginBase.LOOP));
|
||||||
|
loopPlugin.setPluginEnabled(PluginBase.LOOP, true);
|
||||||
|
Assert.assertEquals(true, loopPlugin.isEnabled(PluginBase.LOOP));
|
||||||
|
|
||||||
|
// No temp basal capable pump should disable plugin
|
||||||
|
virtualPumpPlugin.getPumpDescription().isTempBasalCapable = false;
|
||||||
|
Assert.assertEquals(false, loopPlugin.isEnabled(PluginBase.LOOP));
|
||||||
|
virtualPumpPlugin.getPumpDescription().isTempBasalCapable = true;
|
||||||
|
|
||||||
|
|
||||||
|
// Fragment is hidden by default
|
||||||
|
Assert.assertEquals(false, loopPlugin.isVisibleInTabs(PluginBase.LOOP));
|
||||||
|
loopPlugin.setFragmentVisible(PluginBase.LOOP, true);
|
||||||
|
Assert.assertEquals(true, loopPlugin.isVisibleInTabs(PluginBase.LOOP));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *********** not working
|
||||||
|
@Test
|
||||||
|
public void eventTreatmentChangeShouldTriggerInvoke() {
|
||||||
|
|
||||||
|
// Unregister tested plugin to prevent calling real invoke
|
||||||
|
MainApp.bus().unregister(loopPlugin);
|
||||||
|
|
||||||
|
class MockedLoopPlugin extends LoopPlugin {
|
||||||
|
boolean invokeCalled = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String initiator, boolean allowNotification) {
|
||||||
|
invokeCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MockedLoopPlugin mockedLoopPlugin = new MockedLoopPlugin();
|
||||||
|
Treatment t = new Treatment();
|
||||||
|
bus.post(new EventTreatmentChange(t));
|
||||||
|
Assert.assertEquals(true, mockedLoopPlugin.invokeCalled);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
@Before
|
||||||
|
public void prepareMock() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockConfigBuilder();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockStrings();
|
||||||
|
|
||||||
|
bus = new MockedBus();
|
||||||
|
when(MainApp.bus()).thenReturn(bus);
|
||||||
|
|
||||||
|
loopPlugin = LoopPlugin.getPlugin();
|
||||||
|
virtualPumpPlugin = VirtualPumpPlugin.getPlugin();
|
||||||
|
|
||||||
|
when(ConfigBuilderPlugin.getActivePump()).thenReturn(virtualPumpPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
class MockedBus extends Bus {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -27,14 +27,14 @@ public class ComboPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void invalidBasalRateOnComboPumpShouldLimitLoopInvokation() throws Exception {
|
public void invalidBasalRateOnComboPumpShouldLimitLoopInvokation() throws Exception {
|
||||||
comboPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
comboPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
comboPlugin.setValidBasalRateProfileSelectedOnPump(false);
|
comboPlugin.setValidBasalRateProfileSelectedOnPump(false);
|
||||||
|
|
||||||
Constraint<Boolean> c = new Constraint<>(true);
|
Constraint<Boolean> c = new Constraint<>(true);
|
||||||
c = comboPlugin.isLoopInvokationAllowed(c);
|
c = comboPlugin.isLoopInvokationAllowed(c);
|
||||||
Assert.assertEquals("Combo: No valid basal rate read from pump", c.getReasons());
|
Assert.assertEquals("Combo: No valid basal rate read from pump", c.getReasons());
|
||||||
Assert.assertEquals(Boolean.FALSE, c.value());
|
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||||
comboPlugin.setFragmentEnabled(PluginBase.PUMP, false);
|
comboPlugin.setPluginEnabled(PluginBase.PUMP, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class DanaRSPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void basalRateShouldBeLimited() throws Exception {
|
public void basalRateShouldBeLimited() throws Exception {
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
||||||
|
@ -48,8 +48,8 @@ public class DanaRSPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void percentBasalRateShouldBeLimited() throws Exception {
|
public void percentBasalRateShouldBeLimited() throws Exception {
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
danaRSPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
danaRSPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
DanaRPump.getInstance().maxBasal = 0.8d;
|
DanaRPump.getInstance().maxBasal = 0.8d;
|
||||||
|
|
||||||
Constraint<Integer> c = new Constraint<>(Constants.REALLYHIGHPERCENTBASALRATE);
|
Constraint<Integer> c = new Constraint<>(Constants.REALLYHIGHPERCENTBASALRATE);
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class InsightPluginTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void basalRateShouldBeLimited() throws Exception {
|
public void basalRateShouldBeLimited() throws Exception {
|
||||||
insightPlugin.setFragmentEnabled(PluginBase.PUMP, true);
|
insightPlugin.setPluginEnabled(PluginBase.PUMP, true);
|
||||||
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
||||||
result.maximumBasalAmount = 1.1d;
|
result.maximumBasalAmount = 1.1d;
|
||||||
insightPlugin.setStatusResult(result);
|
insightPlugin.setStatusResult(result);
|
||||||
|
|
Loading…
Reference in a new issue