From ee2d6b71d13f3e3c627e79dd2e1fa0b45e0b90e3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 24 Jun 2018 18:28:38 +0200 Subject: [PATCH] add delay to sms bolus command --- .../plugins/SmsCommunicator/SmsCommunicatorPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 8e1dd06d2f..847ead4482 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.SmsCommunicator; import android.content.Intent; import android.content.pm.ResolveInfo; +import android.os.SystemClock; import android.telephony.SmsManager; import android.telephony.SmsMessage; @@ -47,6 +48,7 @@ import info.nightscout.utils.FabricPrivacy; import info.nightscout.utils.NSUpload; import info.nightscout.utils.SP; import info.nightscout.utils.SafeParse; +import info.nightscout.utils.T; import info.nightscout.utils.XdripCalibrations; /** @@ -450,12 +452,14 @@ public class SmsCommunicatorPlugin extends PluginBase { public void run() { PumpInterface pump = MainApp.getConfigBuilder().getActivePump(); if (result.success) { + SystemClock.sleep(T.secs(15).msecs()); // wait some time to get history String reply = String.format(MainApp.gs(R.string.smscommunicator_bolusdelivered), result.bolusDelivered); if (pump != null) reply += "\n" + pump.shortStatus(true); lastRemoteBolusTime = new Date(); sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date())); } else { + SystemClock.sleep(T.secs(60).msecs()); // wait some time to get history String reply = MainApp.gs(R.string.smscommunicator_bolusfailed); if (pump != null) reply += "\n" + pump.shortStatus(true);