Replace BgSourceInterface.advancedFilteringSupported.
Replaced by 'filtered' property on BgReading.
This commit is contained in:
parent
98c933af57
commit
6abad56b1f
21 changed files with 124 additions and 200 deletions
|
@ -12,6 +12,8 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -60,56 +62,58 @@ public class DataService extends IntentService {
|
|||
|
||||
public DataService() {
|
||||
super("DataService");
|
||||
registerBus();
|
||||
MainApp.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(final Intent intent) {
|
||||
if (intent == null)
|
||||
return;
|
||||
if (Config.logFunctionCalls)
|
||||
log.debug("onHandleIntent " + BundleLogger.log(intent.getExtras()));
|
||||
if (ConfigBuilderPlugin.getPlugin().getActiveBgSource() == null) {
|
||||
if (ConfigBuilderPlugin.getActiveBgSource() == null) {
|
||||
xDripEnabled = true;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) {
|
||||
xDripEnabled = true;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = true;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = true;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = true;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceDexcomG5Plugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceDexcomG5Plugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = true;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourcePoctechPlugin.class)) {
|
||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourcePoctechPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
|
@ -126,8 +130,6 @@ public class DataService extends IntentService {
|
|||
acceptNSData = acceptNSData || bundles.getBoolean("islocal");
|
||||
}
|
||||
|
||||
|
||||
if (intent != null) {
|
||||
final String action = intent.getAction();
|
||||
if (Intents.ACTION_NEW_BG_ESTIMATE.equals(action)) {
|
||||
if (xDripEnabled) {
|
||||
|
@ -174,7 +176,7 @@ public class DataService extends IntentService {
|
|||
} else if (Telephony.Sms.Intents.SMS_RECEIVED_ACTION.equals(action)) {
|
||||
handleNewSMS(intent);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.logFunctionCalls)
|
||||
log.debug("onHandleIntent exit " + intent);
|
||||
DataReceiver.completeWakefulIntent(intent);
|
||||
|
@ -195,16 +197,7 @@ public class DataService extends IntentService {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
private void registerBus() {
|
||||
try {
|
||||
MainApp.bus().unregister(this);
|
||||
} catch (RuntimeException x) {
|
||||
// Ignore
|
||||
}
|
||||
MainApp.bus().register(this);
|
||||
MainApp.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void handleNewDataFromXDrip(Intent intent) {
|
||||
|
@ -217,8 +210,9 @@ public class DataService extends IntentService {
|
|||
bgReading.direction = bundle.getString(Intents.EXTRA_BG_SLOPE_NAME);
|
||||
bgReading.date = bundle.getLong(Intents.EXTRA_TIMESTAMP);
|
||||
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW);
|
||||
String source = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "no Source specified");
|
||||
SourceXdripPlugin.getPlugin().setSource(source);
|
||||
bgReading.sourcePlugin = SourceXdripPlugin.getPlugin().pluginDescription.getUserfriendlyName();
|
||||
bgReading.filtered = Objects.equals(bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION), "G5 Native");
|
||||
|
||||
MainApp.getDbHelper().createIfNotExists(bgReading, "XDRIP");
|
||||
}
|
||||
|
||||
|
@ -232,6 +226,8 @@ public class DataService extends IntentService {
|
|||
bgReading.direction = bundle.getString("myTrend");
|
||||
bgReading.date = bundle.getLong("myTimestamp");
|
||||
bgReading.raw = 0;
|
||||
bgReading.filtered = false;
|
||||
bgReading.sourcePlugin = SourceGlimpPlugin.getPlugin().pluginDescription.getUserfriendlyName();
|
||||
|
||||
MainApp.getDbHelper().createIfNotExists(bgReading, "GLIMP");
|
||||
}
|
||||
|
@ -256,6 +252,8 @@ public class DataService extends IntentService {
|
|||
bgReading.direction = json.getString("m_trend");
|
||||
bgReading.date = json.getLong("m_time") * 1000L;
|
||||
bgReading.raw = 0;
|
||||
bgReading.filtered = true;
|
||||
bgReading.sourcePlugin = SourceDexcomG5Plugin.getPlugin().pluginDescription.getUserfriendlyName();
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "DexcomG5");
|
||||
if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
|
||||
NSUpload.uploadBg(bgReading);
|
||||
|
@ -264,9 +262,8 @@ public class DataService extends IntentService {
|
|||
NSUpload.sendToXdrip(bgReading);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,6 +326,8 @@ public class DataService extends IntentService {
|
|||
bgReading.direction = json_object.getString("direction");
|
||||
bgReading.date = json_object.getLong("date");
|
||||
bgReading.raw = json_object.getDouble("sgv");
|
||||
bgReading.filtered = true;
|
||||
bgReading.sourcePlugin = SourceMM640gPlugin.getPlugin().pluginDescription.getUserfriendlyName();
|
||||
|
||||
MainApp.getDbHelper().createIfNotExists(bgReading, "MM640g");
|
||||
break;
|
||||
|
@ -545,7 +544,7 @@ public class DataService extends IntentService {
|
|||
MainApp.getDbHelper().deleteProfileSwitchById(_id);
|
||||
}
|
||||
|
||||
private void handleTreatmentFromNS(JSONObject json, Intent intent) throws JSONException {
|
||||
private void handleTreatmentFromNS(JSONObject json, Intent intent) {
|
||||
// new DB model
|
||||
int mode = Intents.ACTION_NEW_TREATMENT.equals(intent.getAction()) ? EventNsTreatment.ADD : EventNsTreatment.UPDATE;
|
||||
double insulin = JsonHelper.safeGetDouble(json, "insulin");
|
||||
|
|
|
@ -42,10 +42,6 @@ public class ConstraintChecker implements ConstraintsInterface {
|
|||
return isSMBModeEnabled(new Constraint<>(true));
|
||||
}
|
||||
|
||||
public Constraint<Boolean> isAdvancedFilteringEnabled() {
|
||||
return isAdvancedFilteringEnabled(new Constraint<>(true));
|
||||
}
|
||||
|
||||
public Constraint<Double> getMaxBasalAllowed(Profile profile) {
|
||||
return applyBasalConstraints(new Constraint<>(Constants.REALLYHIGHBASALRATE), profile);
|
||||
}
|
||||
|
@ -69,7 +65,7 @@ public class ConstraintChecker implements ConstraintsInterface {
|
|||
@Override
|
||||
public Constraint<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
|
||||
|
||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
for (PluginBase p : constraintsPlugins) {
|
||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||
|
@ -81,7 +77,7 @@ public class ConstraintChecker implements ConstraintsInterface {
|
|||
@Override
|
||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
||||
|
||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
for (PluginBase p : constraintsPlugins) {
|
||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||
|
@ -126,17 +122,6 @@ public class ConstraintChecker implements ConstraintsInterface {
|
|||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
for (PluginBase p : constraintsPlugins) {
|
||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||
constraint.isAdvancedFilteringEnabled(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||
|
|
|
@ -3,6 +3,4 @@ package info.nightscout.androidaps.interfaces;
|
|||
/**
|
||||
* Created by mike on 20.06.2016.
|
||||
*/
|
||||
public interface BgSourceInterface {
|
||||
boolean advancedFilteringSupported();
|
||||
}
|
||||
public interface BgSourceInterface {}
|
||||
|
|
|
@ -27,10 +27,6 @@ public interface ConstraintsInterface {
|
|||
return value;
|
||||
}
|
||||
|
||||
default Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
default Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||
return absoluteRate;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.interfaces;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
||||
public class PluginDescription {
|
||||
PluginType mainType = PluginType.GENERAL;
|
||||
String fragmentClass = null;
|
||||
|
@ -87,4 +89,8 @@ public class PluginDescription {
|
|||
public PluginType getType() {
|
||||
return mainType;
|
||||
}
|
||||
|
||||
public String getUserfriendlyName() {
|
||||
return MainApp.gs(pluginName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,12 +65,11 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
return configBuilderPlugin;
|
||||
}
|
||||
|
||||
private BgSourceInterface activeBgSource;
|
||||
private static BgSourceInterface activeBgSource;
|
||||
private static PumpInterface activePump;
|
||||
private static ProfileInterface activeProfile;
|
||||
private static TreatmentsInterface activeTreatments;
|
||||
private static APSInterface activeAPS;
|
||||
private static LoopPlugin activeLoop;
|
||||
private static InsulinInterface activeInsulin;
|
||||
private static SensitivityInterface activeSensitivity;
|
||||
|
||||
|
@ -249,7 +248,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
return commandQueue;
|
||||
}
|
||||
|
||||
public BgSourceInterface getActiveBgSource() {
|
||||
public static BgSourceInterface getActiveBgSource() {
|
||||
return activeBgSource;
|
||||
}
|
||||
|
||||
|
@ -329,9 +328,6 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
}
|
||||
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
|
||||
|
||||
// PluginType.LOOP
|
||||
activeLoop = this.determineActivePlugin(PluginType.LOOP);
|
||||
|
||||
// PluginType.TREATMENT
|
||||
activeTreatments = this.determineActivePlugin(PluginType.TREATMENT);
|
||||
}
|
||||
|
|
|
@ -92,17 +92,6 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
|||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||
BgSourceInterface bgSource = MainApp.getConfigBuilder().getActiveBgSource();
|
||||
|
||||
if (bgSource != null) {
|
||||
if (!bgSource.advancedFilteringSupported())
|
||||
value.set(false, MainApp.gs(R.string.smbalwaysdisabled), this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import info.nightscout.androidaps.data.GlucoseStatus;
|
|||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
|
@ -104,6 +106,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
}
|
||||
|
||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||
BgReading bgReading = DatabaseHelper.actualBg();
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
|
||||
|
@ -121,7 +124,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
if (glucoseStatus == null) {
|
||||
if (glucoseStatus == null || bgReading == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
|
||||
if (Config.logAPSResult)
|
||||
log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
|
||||
|
@ -189,10 +192,6 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
MainApp.getConstraintChecker().isSMBModeEnabled(smbAllowed);
|
||||
inputConstraints.copyReasons(smbAllowed);
|
||||
|
||||
Constraint<Boolean> advancedFiltering = new Constraint<>(!tempBasalFallback);
|
||||
MainApp.getConstraintChecker().isAdvancedFilteringEnabled(advancedFiltering);
|
||||
inputConstraints.copyReasons(advancedFiltering);
|
||||
|
||||
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
Profiler.log(log, "SMB data gathering", start);
|
||||
|
||||
|
@ -202,7 +201,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
lastAutosensResult.ratio, //autosensDataRatio
|
||||
isTempTarget,
|
||||
smbAllowed.value(),
|
||||
advancedFiltering.value()
|
||||
bgReading.filtered
|
||||
);
|
||||
} catch (JSONException e) {
|
||||
log.error(e.getMessage());
|
||||
|
|
|
@ -33,8 +33,4 @@ public class SourceDexcomG5Plugin extends PluginBase implements BgSourceInterfac
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,4 @@ public class SourceGlimpPlugin extends PluginBase implements BgSourceInterface {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,4 @@ public class SourceMM640gPlugin extends PluginBase implements BgSourceInterface
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
|||
return plugin;
|
||||
}
|
||||
|
||||
private long lastBGTimeStamp = 0;
|
||||
private boolean isAdvancedFilteringEnabled = false;
|
||||
|
||||
private SourceNSClientPlugin() {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
|
@ -34,18 +31,4 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return isAdvancedFilteringEnabled;
|
||||
}
|
||||
|
||||
public void detectSource(String source, long timeStamp) {
|
||||
if (timeStamp > lastBGTimeStamp) {
|
||||
if (source.contains("G5 Native") || source.contains("AndroidAPS-DexcomG5"))
|
||||
isAdvancedFilteringEnabled = true;
|
||||
else
|
||||
isAdvancedFilteringEnabled = false;
|
||||
lastBGTimeStamp = timeStamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,4 @@ public class SourcePoctechPlugin extends PluginBase implements BgSourceInterface
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
|
|||
|
||||
private static SourceXdripPlugin plugin = null;
|
||||
|
||||
boolean advancedFiltering;
|
||||
|
||||
public static SourceXdripPlugin getPlugin() {
|
||||
if (plugin == null)
|
||||
plugin = new SourceXdripPlugin();
|
||||
|
@ -29,13 +27,4 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
|
|||
.description(R.string.description_source_xdrip)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return advancedFiltering;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.advancedFiltering = source.contains("G5 Native");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,15 +111,15 @@ public class ConstraintsCheckerTest {
|
|||
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAdvancedFilteringEnabledTest() throws Exception {
|
||||
when(MainApp.getConfigBuilder().getActiveBgSource()).thenReturn(SourceGlimpPlugin.getPlugin());
|
||||
|
||||
Constraint<Boolean> c = constraintChecker.isAdvancedFilteringEnabled();
|
||||
Assert.assertEquals(true, c.getReasonList().size() == 1); // Safety
|
||||
Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 1); // Safety
|
||||
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
}
|
||||
// @Test
|
||||
// public void isAdvancedFilteringEnabledTest() throws Exception {
|
||||
// when(MainApp.getConfigBuilder().getActiveBgSource()).thenReturn(SourceGlimpPlugin.getPlugin());
|
||||
//
|
||||
// Constraint<Boolean> c = constraintChecker.isAdvancedFilteringEnabled();
|
||||
// Assert.assertEquals(true, c.getReasonList().size() == 1); // Safety
|
||||
// Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 1); // Safety
|
||||
// Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void isSMBModeEnabledTest() throws Exception {
|
||||
|
|
|
@ -89,15 +89,16 @@ public class SafetyPluginTest {
|
|||
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bgsourceShouldPreventSMBAlways() throws Exception {
|
||||
when(MainApp.getConfigBuilder().getActiveBgSource()).thenReturn(SourceGlimpPlugin.getPlugin());
|
||||
|
||||
Constraint<Boolean> c = new Constraint<>(true);
|
||||
c = safetyPlugin.isAdvancedFilteringEnabled(c);
|
||||
Assert.assertEquals("Safety: SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering", c.getReasons());
|
||||
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
}
|
||||
// TODO
|
||||
// @Test
|
||||
// public void bgsourceShouldPreventSMBAlways() throws Exception {
|
||||
// when(MainApp.getConfigBuilder().getActiveBgSource()).thenReturn(SourceGlimpPlugin.getPlugin());
|
||||
//
|
||||
// Constraint<Boolean> c = new Constraint<>(true);
|
||||
// c = safetyPlugin.isAdvancedFilteringEnabled(c);
|
||||
// Assert.assertEquals("Safety: SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering", c.getReasons());
|
||||
// Assert.assertEquals(Boolean.FALSE, c.value());
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void basalRateShouldBeLimited() throws Exception {
|
||||
|
|
|
@ -15,8 +15,8 @@ public class SourceDexcomG5PluginTest {
|
|||
Assert.assertNotEquals(null, SourceDexcomG5Plugin.getPlugin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advancedFilteringSupported() {
|
||||
Assert.assertEquals(true, SourceDexcomG5Plugin.getPlugin().advancedFilteringSupported());
|
||||
}
|
||||
// @Test
|
||||
// public void advancedFilteringSupported() {
|
||||
// Assert.assertEquals(true, SourceDexcomG5Plugin.getPlugin().advancedFilteringSupported());
|
||||
// }
|
||||
}
|
|
@ -15,8 +15,8 @@ public class SourceGlimpPluginTest {
|
|||
Assert.assertNotEquals(null, SourceGlimpPlugin.getPlugin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advancedFilteringSupported() {
|
||||
Assert.assertEquals(false, SourceGlimpPlugin.getPlugin().advancedFilteringSupported());
|
||||
}
|
||||
// @Test
|
||||
// public void advancedFilteringSupported() {
|
||||
// Assert.assertEquals(false, SourceGlimpPlugin.getPlugin().advancedFilteringSupported());
|
||||
// }
|
||||
}
|
|
@ -15,8 +15,8 @@ public class SourceMM640gPluginTest {
|
|||
Assert.assertNotEquals(null, SourceMM640gPlugin.getPlugin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advancedFilteringSupported() {
|
||||
Assert.assertEquals(false, SourceMM640gPlugin.getPlugin().advancedFilteringSupported());
|
||||
}
|
||||
// @Test
|
||||
// public void advancedFilteringSupported() {
|
||||
// Assert.assertEquals(false, SourceMM640gPlugin.getPlugin().advancedFilteringSupported());
|
||||
// }
|
||||
}
|
|
@ -13,8 +13,8 @@ public class SourceNSClientPluginTest {
|
|||
Assert.assertNotEquals(null, SourceNSClientPlugin.getPlugin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advancedFilteringSupported() {
|
||||
Assert.assertEquals(false, SourceNSClientPlugin.getPlugin().advancedFilteringSupported());
|
||||
}
|
||||
// @Test
|
||||
// public void advancedFilteringSupported() {
|
||||
// Assert.assertEquals(false, SourceNSClientPlugin.getPlugin().advancedFilteringSupported());
|
||||
// }
|
||||
}
|
|
@ -15,8 +15,8 @@ public class SourceXdripPluginTest {
|
|||
Assert.assertNotEquals(null, SourceXdripPlugin.getPlugin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advancedFilteringSupported() {
|
||||
Assert.assertEquals(false, SourceXdripPlugin.getPlugin().advancedFilteringSupported());
|
||||
}
|
||||
// @Test
|
||||
// public void advancedFilteringSupported() {
|
||||
// Assert.assertEquals(false, SourceXdripPlugin.getPlugin().advancedFilteringSupported());
|
||||
// }
|
||||
}
|
Loading…
Reference in a new issue