detect faking by extended boluses in nsclient mode
This commit is contained in:
parent
77659e20e7
commit
148f4d43f9
3 changed files with 6 additions and 3 deletions
|
@ -44,6 +44,7 @@ import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.History.DanaRNSHistorySync;
|
import info.nightscout.androidaps.plugins.PumpDanaR.History.DanaRNSHistorySync;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||||
|
|
||||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
||||||
|
@ -1068,6 +1069,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
extendedBolus.durationInMinutes = trJson.getInt("duration");
|
extendedBolus.durationInMinutes = trJson.getInt("duration");
|
||||||
extendedBolus.insulin = trJson.getDouble("originalExtendedAmount");
|
extendedBolus.insulin = trJson.getDouble("originalExtendedAmount");
|
||||||
extendedBolus._id = trJson.getString("_id");
|
extendedBolus._id = trJson.getString("_id");
|
||||||
|
VirtualPumpPlugin.fromNSAreCommingFakedExtendedBoluses = true;
|
||||||
createOrUpdate(extendedBolus);
|
createOrUpdate(extendedBolus);
|
||||||
} else if (trJson.has("isFakedTempBasal")) { // extended bolus end uploaded as temp basal end
|
} else if (trJson.has("isFakedTempBasal")) { // extended bolus end uploaded as temp basal end
|
||||||
ExtendedBolus extendedBolus = new ExtendedBolus();
|
ExtendedBolus extendedBolus = new ExtendedBolus();
|
||||||
|
@ -1077,6 +1079,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
extendedBolus.durationInMinutes = 0;
|
extendedBolus.durationInMinutes = 0;
|
||||||
extendedBolus.insulin = 0;
|
extendedBolus.insulin = 0;
|
||||||
extendedBolus._id = trJson.getString("_id");
|
extendedBolus._id = trJson.getString("_id");
|
||||||
|
VirtualPumpPlugin.fromNSAreCommingFakedExtendedBoluses = true;
|
||||||
createOrUpdate(extendedBolus);
|
createOrUpdate(extendedBolus);
|
||||||
} else {
|
} else {
|
||||||
TemporaryBasal tempBasal = new TemporaryBasal();
|
TemporaryBasal tempBasal = new TemporaryBasal();
|
||||||
|
|
|
@ -684,8 +684,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFakingTempsByExtendedBoluses() {
|
public boolean isFakingTempsByExtendedBoluses() {
|
||||||
if (Config.NSCLIENT)
|
|
||||||
return false;
|
|
||||||
return activePump.isFakingTempsByExtendedBoluses();
|
return activePump.isFakingTempsByExtendedBoluses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
boolean fragmentEnabled = true;
|
boolean fragmentEnabled = true;
|
||||||
boolean fragmentVisible = true;
|
boolean fragmentVisible = true;
|
||||||
|
|
||||||
|
public static boolean fromNSAreCommingFakedExtendedBoluses = false;
|
||||||
|
|
||||||
PumpDescription pumpDescription = new PumpDescription();
|
PumpDescription pumpDescription = new PumpDescription();
|
||||||
|
|
||||||
static VirtualPumpPlugin instance = null;
|
static VirtualPumpPlugin instance = null;
|
||||||
|
@ -143,7 +145,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFakingTempsByExtendedBoluses() {
|
public boolean isFakingTempsByExtendedBoluses() {
|
||||||
return false;
|
return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue