Correct lastDataTime handling

This commit is contained in:
TebbeUbben 2018-04-08 13:43:37 +02:00
parent 2fee7f3186
commit ba83f7f499

View file

@ -242,7 +242,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
// TODO review // TODO review
if (!Config.NSCLIENT && !Config.G5UPLOADER) if (!Config.NSCLIENT && !Config.G5UPLOADER)
NSUpload.uploadDeviceStatus(); NSUpload.uploadDeviceStatus();
lastDataTime = new Date();
} }
@Override @Override
@ -283,7 +282,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
public void getPumpStatus() { public void getPumpStatus() {
log("getPumpStatus"); log("getPumpStatus");
lastDataTime = new Date();
if (Connector.get().isPumpConnected()) { if (Connector.get().isPumpConnected()) {
log("is connected.. requesting status"); log("is connected.. requesting status");
final UUID uuid = aSyncTaskRunner(new StatusTaskRunner(connector.getServiceConnector()), "Status"); final UUID uuid = aSyncTaskRunner(new StatusTaskRunner(connector.getServiceConnector()), "Status");
@ -439,7 +437,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
updateGui(); updateGui();
connector.tryToGetPumpStatusAgain(); connector.tryToGetPumpStatusAgain();
lastDataTime = new Date();
connector.requestHistorySync(30000); connector.requestHistorySync(30000);
if (result.success) while (true) { if (result.success) while (true) {
@ -538,8 +535,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting temp basal absolute: " + pumpEnactResult.success); log.debug("Setting temp basal absolute: " + pumpEnactResult.success);
lastDataTime = new Date();
updateGui(); updateGui();
connector.requestHistorySync(5000); connector.requestHistorySync(5000);
@ -621,7 +616,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER); TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER);
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStop); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStop);
} }
lastDataTime = new Date();
updateGui(); updateGui();
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Canceling temp basal: "); // TODO get more info log.debug("Canceling temp basal: "); // TODO get more info
@ -950,6 +944,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
singleMessageTaskRunner.fetch(new TaskRunner.ResultCallback() { singleMessageTaskRunner.fetch(new TaskRunner.ResultCallback() {
@Override @Override
public void onResult(Object o) { public void onResult(Object o) {
lastDataTime = new Date();
log(name + " success"); log(name + " success");
event.response_object = o; event.response_object = o;
if (o instanceof BolusMessage) { if (o instanceof BolusMessage) {
@ -988,6 +983,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
task.fetch(new TaskRunner.ResultCallback() { task.fetch(new TaskRunner.ResultCallback() {
@Override @Override
public void onResult(Object o) { public void onResult(Object o) {
lastDataTime = new Date();
log(name + " success"); log(name + " success");
event.response_object = o; event.response_object = o;
event.success = true; event.success = true;