diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java index b014b66969..a303375a49 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java @@ -3,10 +3,13 @@ package info.nightscout.androidaps.queue.commands; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.LocalAlertUtils; +import info.nightscout.utils.T; /** * Created by mike on 09.11.2017. @@ -29,8 +32,15 @@ public class CommandReadStatus extends Command { LocalAlertUtils.notifyPumpStatusRead(); if (L.isEnabled(L.PUMPQUEUE)) log.debug("CommandReadStatus executed. Reason: " + reason); + final PumpInterface pump = ConfigBuilderPlugin.getActivePump(); + PumpEnactResult result = new PumpEnactResult().success(false); + if (pump != null) { + long lastConnection = pump.lastDataTime(); + if (lastConnection > System.currentTimeMillis() - T.mins(1).msecs()) + result.success(true); + } if (callback != null) - callback.result(null).run(); + callback.result(result).run(); } @Override