detect bg source in nsclient
This commit is contained in:
parent
7bed827f4b
commit
8e08a293c1
2 changed files with 15 additions and 1 deletions
|
@ -604,6 +604,7 @@ public class DataService extends IntentService {
|
||||||
NSSgv nsSgv = new NSSgv(sgvJson);
|
NSSgv nsSgv = new NSSgv(sgvJson);
|
||||||
BgReading bgReading = new BgReading(nsSgv);
|
BgReading bgReading = new BgReading(nsSgv);
|
||||||
MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
||||||
|
SourceNSClientPlugin.getPlugin().detectSource(JsonHelper.safeGetString(sgvJson, "device"), JsonHelper.safeGetLong(sgvJson, "mills"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNewSMS(Intent intent) {
|
private void handleNewSMS(Intent intent) {
|
||||||
|
|
|
@ -20,6 +20,9 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long lastBGTimeStamp = 0;
|
||||||
|
private boolean isAdvancedFilteringEnabled = false;
|
||||||
|
|
||||||
private SourceNSClientPlugin() {
|
private SourceNSClientPlugin() {
|
||||||
super(new PluginDescription()
|
super(new PluginDescription()
|
||||||
.mainType(PluginType.BGSOURCE)
|
.mainType(PluginType.BGSOURCE)
|
||||||
|
@ -33,6 +36,16 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean advancedFilteringSupported() {
|
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