detect bg source in nsclient
This commit is contained in:
parent
7bed827f4b
commit
8e08a293c1
|
@ -604,6 +604,7 @@ public class DataService extends IntentService {
|
|||
NSSgv nsSgv = new NSSgv(sgvJson);
|
||||
BgReading bgReading = new BgReading(nsSgv);
|
||||
MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
||||
SourceNSClientPlugin.getPlugin().detectSource(JsonHelper.safeGetString(sgvJson, "device"), JsonHelper.safeGetLong(sgvJson, "mills"));
|
||||
}
|
||||
|
||||
private void handleNewSMS(Intent intent) {
|
||||
|
|
|
@ -20,6 +20,9 @@ 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)
|
||||
|
@ -33,6 +36,16 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
|||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue