From 52eb723db2639c0f28570563a76bd132ab1f5578 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Mon, 2 Aug 2021 23:28:54 +0200 Subject: [PATCH] add notification sound when delivery is suspended --- .../pump/omnipod/dash/OmnipodDashPumpPlugin.kt | 15 ++++++++------- .../driver/pod/definition/BeepRepetitionType.kt | 2 +- .../dash/driver/pod/definition/BeepType.kt | 2 +- omnipod-dash/src/main/res/values/strings.xml | 2 ++ .../src/main/res/xml/omnipod_dash_preferences.xml | 5 +++++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index 8778a0151c..bca8146c00 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -147,13 +147,12 @@ class OmnipodDashPumpPlugin @Inject constructor( } else { rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED)) if (podStateManager.isSuspended) { - val notification = - Notification( - Notification.OMNIPOD_POD_SUSPENDED, - "Insulin delivery suspended", - Notification.NORMAL - ) - rxBus.send(EventNewNotification(notification)) + showNotification( + Notification.OMNIPOD_POD_SUSPENDED, + "Insulin delivery suspended", + Notification.NORMAL, + R.raw.boluserror + ) } else { rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED)) if (!podStateManager.sameTimeZone) { @@ -1391,6 +1390,8 @@ class OmnipodDashPumpPlugin @Inject constructor( sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_tbr_sound_enabled, true) Notification.OMNIPOD_UNCERTAIN_SMB -> sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_smb_sound_enabled, true) + Notification.OMNIPOD_POD_SUSPENDED -> + sp.getBoolean(R.string.key_omnipod_common_notification_delivery_suspended_sound_enabled, true) else -> true } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt index d7a1a8f761..cf668aa036 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt @@ -8,6 +8,6 @@ enum class BeepRepetitionType( XXX(0x01.toByte()), // Used in lump of coal alert, LOW_RESERVOIR XXX2(0x03.toByte()), // Used in USER_SET_EXPIRATION XXX3(0x05.toByte()), // published system expiration alert - XXX4(0x06.toByte()), // Used in imminent pod expiration alert + XXX4(0x06.toByte()), // Used in imminent pod expiration alert, suspend in progress XXX5(0x08.toByte()); // Lump of coal alert } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepType.kt index 2ce8428ee8..4fe4991119 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepType.kt @@ -4,6 +4,6 @@ enum class BeepType(val value: Byte) { SILENT(0x00.toByte()), FOUR_TIMES_BIP_BEEP(0x02.toByte()), // Used in low reservoir alert, user expiration alert, expiration alert, imminent expiration alert, lump of coal alert - XXX(0x04.toByte()), // Used during suspend + XXX(0x04.toByte()), // Used during suspend LONG_SINGLE_BEEP(0x06.toByte()); // Used in stop delivery command } diff --git a/omnipod-dash/src/main/res/values/strings.xml b/omnipod-dash/src/main/res/values/strings.xml index b164e7bee4..6535947b56 100644 --- a/omnipod-dash/src/main/res/values/strings.xml +++ b/omnipod-dash/src/main/res/values/strings.xml @@ -21,4 +21,6 @@ omnipod_common_preferences_category_confirmation common_preferences_category_other + AAPS.Omnipod.notification_delivery_suspended_sound_enabled + Sound when delivery suspended notification enabled diff --git a/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml b/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml index 0e1d2dd11a..49aea42d7b 100644 --- a/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml +++ b/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml @@ -93,6 +93,11 @@ android:key="@string/key_omnipod_common_notification_uncertain_bolus_sound_enabled" android:title="@string/omnipod_common_preferences_notification_uncertain_bolus_sound_enabled" /> + +