Detect source from NSClient BG.
This commit is contained in:
parent
906cc8a76a
commit
986d9fb01c
2 changed files with 6 additions and 2 deletions
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
|
||||
import info.nightscout.utils.JsonHelper;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
|
@ -65,7 +66,9 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject sgvJson = jsonArray.getJSONObject(i);
|
||||
BgReading bgReading = new BgReading(new NSSgv(sgvJson));
|
||||
bgReading.filtered = false;
|
||||
String sourceDescription = JsonHelper.safeGetString(sgvJson, "device");
|
||||
bgReading.filtered = sourceDescription != null
|
||||
&& (sourceDescription.equals("G5 Native") || sourceDescription.equals("AndroidAPS-DexcomG5"));
|
||||
bgReading.sourcePlugin = getName();
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
||||
if (isNew) {
|
||||
|
|
|
@ -47,7 +47,8 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
|
|||
bgReading.direction = bundle.getString(Intents.EXTRA_BG_SLOPE_NAME);
|
||||
bgReading.date = bundle.getLong(Intents.EXTRA_TIMESTAMP);
|
||||
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW);
|
||||
bgReading.filtered = Objects.equals(bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION), "G5 Native");
|
||||
String sourceDescription = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "");
|
||||
bgReading.filtered = sourceDescription.equals("G5 Native") || sourceDescription.equals("AndroidAPS-DexcomG5");
|
||||
bgReading.sourcePlugin = getName();
|
||||
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
|
|
Loading…
Reference in a new issue