- notification that pod is not available... Will be refreshed every 15 minutes.

This commit is contained in:
Andy Rozman 2020-01-07 22:37:37 +01:00
parent 9f215e607c
commit 39ce23ec86
4 changed files with 23 additions and 9 deletions

View file

@ -80,7 +80,7 @@ public class Notification {
public static final int INVALID_VERSION = 55; public static final int INVALID_VERSION = 55;
public static final int OMNIPOD_PUMP_ALARM = 56; public static final int OMNIPOD_PUMP_ALARM = 56;
public static final int TIME_OR_TIMEZONE_CHANGE = 57; public static final int TIME_OR_TIMEZONE_CHANGE = 57;
public static final int OMNIPOD_POD_NOT_ATTACHED = 58;
public int id; public int id;
public Date date; public Date date;

View file

@ -39,6 +39,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
@ -103,6 +104,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
private Profile currentProfile; private Profile currentProfile;
private long nextPodCheck = 0L;
private OmnipodPumpPlugin() { private OmnipodPumpPlugin() {
@ -264,11 +267,27 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
} }
} }
doPodCheck();
} while (serviceRunning); } while (serviceRunning);
}).start(); }).start();
} }
private void doPodCheck() {
if (System.currentTimeMillis() > this.nextPodCheck) {
if (!getPodPumpStatusObject().podAvailable) {
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
RxBus.INSTANCE.send(new EventNewNotification(notification));
} else {
RxBus.INSTANCE.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED));
}
this.nextPodCheck = DateTimeUtil.getTimeInFutureFromMinutes(15);
}
}
@Override @Override
public Class getServiceClass() { public Class getServiceClass() {

View file

@ -1677,6 +1677,7 @@
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\n You need to configure Omnipod first, before you can use this operation.</string> <string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\n You need to configure Omnipod first, before you can use this operation.</string>
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string> <string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string> <string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
<string name="omnipod_error_pod_not_attached">No active pod.</string>
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed.</string> <string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed.</string>
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occured. Please report! (type: %1$s).</string> <string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occured. Please report! (type: %1$s).</string>

View file

@ -1,23 +1,17 @@
# Project-wide Gradle settings. # Project-wide Gradle settings.
# IDE (e.g. Android Studio) users: # IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override* # Gradle settings configured through the IDE *will override*
# any settings specified in this file. # any settings specified in this file.
# For more details on how to configure your build environment visit # For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m # Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g org.gradle.jvmargs=-Xmx2g
android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.useAndroidX=true