dismiss notification if pump is reachable

This commit is contained in:
Milos Kozak 2018-04-19 23:42:37 +02:00
parent 51530fbcf8
commit 645e83b6e6

View file

@ -14,10 +14,9 @@ import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.utils.NSUpload;
/**
* Created by adrian on 17/12/17.
@ -26,12 +25,12 @@ import info.nightscout.utils.NSUpload;
public class LocalAlertUtils {
private static Logger log = LoggerFactory.getLogger(LocalAlertUtils.class);
public static int missedReadingsThreshold() {
return SP.getInt(MainApp.sResources.getString(R.string.key_missed_bg_readings_threshold), 30) * 60 * 1000;
public static long missedReadingsThreshold() {
return T.mins(SP.getInt(MainApp.sResources.getString(R.string.key_missed_bg_readings_threshold), 30)).msecs();
}
private static int pumpUnreachableThreshold() {
return SP.getInt(MainApp.sResources.getString(R.string.key_pump_unreachable_threshold), 30) * 60 * 1000;
private static long pumpUnreachableThreshold() {
return T.mins(SP.getInt(MainApp.sResources.getString(R.string.key_pump_unreachable_threshold), 30)).msecs();
}
public static void checkPumpUnreachableAlarm(Date lastConnection, boolean isStatusOutdated) {
@ -49,6 +48,8 @@ public class LocalAlertUtils {
NSUpload.uploadError(n.text);
}
}
if (!isStatusOutdated && !alarmTimeoutExpired)
MainApp.bus().post(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
}
/*Presnoozes the alarms with 5 minutes if no snooze exists.