detect faking by extended boluses in nsclient mode

This commit is contained in:
Milos Kozak 2017-06-12 09:15:51 +02:00
parent 77659e20e7
commit 148f4d43f9
3 changed files with 6 additions and 3 deletions

View file

@ -44,6 +44,7 @@ import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
import info.nightscout.androidaps.plugins.PumpDanaR.History.DanaRNSHistorySync;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
@ -1068,6 +1069,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
extendedBolus.durationInMinutes = trJson.getInt("duration");
extendedBolus.insulin = trJson.getDouble("originalExtendedAmount");
extendedBolus._id = trJson.getString("_id");
VirtualPumpPlugin.fromNSAreCommingFakedExtendedBoluses = true;
createOrUpdate(extendedBolus);
} else if (trJson.has("isFakedTempBasal")) { // extended bolus end uploaded as temp basal end
ExtendedBolus extendedBolus = new ExtendedBolus();
@ -1077,6 +1079,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
extendedBolus.durationInMinutes = 0;
extendedBolus.insulin = 0;
extendedBolus._id = trJson.getString("_id");
VirtualPumpPlugin.fromNSAreCommingFakedExtendedBoluses = true;
createOrUpdate(extendedBolus);
} else {
TemporaryBasal tempBasal = new TemporaryBasal();

View file

@ -684,8 +684,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
@Override
public boolean isFakingTempsByExtendedBoluses() {
if (Config.NSCLIENT)
return false;
return activePump.isFakingTempsByExtendedBoluses();
}

View file

@ -45,6 +45,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
boolean fragmentEnabled = true;
boolean fragmentVisible = true;
public static boolean fromNSAreCommingFakedExtendedBoluses = false;
PumpDescription pumpDescription = new PumpDescription();
static VirtualPumpPlugin instance = null;
@ -143,7 +145,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override
public boolean isFakingTempsByExtendedBoluses() {
return false;
return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses;
}
@Override