On connect, take over TBR CANCELLED warning and raise message. Fixes #9.
This commit is contained in:
parent
8bba8c4d5a
commit
b409b737e5
|
@ -711,7 +711,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
if (activeAlert != null) {
|
||||
if (activeAlert.warningCode != null
|
||||
&& (activeAlert.warningCode == PumpWarningCodes.CARTRIDGE_LOW ||
|
||||
activeAlert.warningCode == PumpWarningCodes.BATTERY_LOW)) {
|
||||
activeAlert.warningCode == PumpWarningCodes.BATTERY_LOW ||
|
||||
activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED)) {
|
||||
// turn benign warnings into notifications
|
||||
notifyAboutPumpWarning(activeAlert);
|
||||
ruffyScripter.confirmAlert(activeAlert.warningCode);
|
||||
|
@ -732,16 +733,23 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
}
|
||||
|
||||
private void notifyAboutPumpWarning(WarningOrErrorCode activeAlert) {
|
||||
if (activeAlert.warningCode == null || (activeAlert.warningCode.equals(PumpWarningCodes.CARTRIDGE_LOW) && activeAlert.warningCode.equals(PumpWarningCodes.BATTERY_LOW))) {
|
||||
if (activeAlert.warningCode == null ||
|
||||
(!activeAlert.warningCode.equals(PumpWarningCodes.CARTRIDGE_LOW)
|
||||
&& !activeAlert.warningCode.equals(PumpWarningCodes.BATTERY_LOW)
|
||||
&& !activeAlert.warningCode.equals(PumpWarningCodes.TBR_CANCELLED))) {
|
||||
throw new IllegalArgumentException(activeAlert.toString());
|
||||
}
|
||||
Notification notification = new Notification();
|
||||
notification.date = new Date();
|
||||
notification.id = Notification.COMBO_PUMP_ALARM;
|
||||
notification.level = Notification.NORMAL;
|
||||
notification.text = activeAlert.warningCode == PumpWarningCodes.CARTRIDGE_LOW
|
||||
? MainApp.sResources.getString(R.string.combo_pump_cartridge_low_warrning)
|
||||
: MainApp.sResources.getString(R.string.combo_pump_battery_low_warrning);
|
||||
if (activeAlert.warningCode == PumpWarningCodes.CARTRIDGE_LOW) {
|
||||
notification.text = MainApp.sResources.getString(R.string.combo_pump_cartridge_low_warrning);
|
||||
} else if (activeAlert.warningCode == PumpWarningCodes.BATTERY_LOW) {
|
||||
notification.text = MainApp.sResources.getString(R.string.combo_pump_battery_low_warrning);
|
||||
} else if (activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED) {
|
||||
notification.text = MainApp.sResources.getString(R.string.combo_pump_tbr_cancelled_warrning);
|
||||
}
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
}
|
||||
|
||||
|
|
|
@ -830,5 +830,11 @@
|
|||
<string name="combo_reservoir_low">Low</string>
|
||||
<string name="combo_reservoir_empty">Empty</string>
|
||||
<string name="combo_reservoir_normal">Normal</string>
|
||||
<string name="combo_notification_check_time_date">Pump clock update needed</string>
|
||||
<string name="combo_history">History</string>
|
||||
<string name="combo_warning">Warning</string>
|
||||
<string name="combo_read_full_history_warning">This will read the full history and state of the pump. Everything in \"My Data\" and the basal rate. Boluses and TBRs will be added to Treatments if they don\'t already exist. This can cause entries to be duplicated because the pump\'s time is imprecise. Using this when normally looping with the pump is highly discouraged and reserved for special circumstances. If you still want to do this, long press this button again.\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
|
||||
<string name="combo_read_full_history_confirmation">Are you really sure you want to read all pump data and take the consequences of this action?</string>
|
||||
<string name="combo_pump_tbr_cancelled_warrning">TBR CANCELLED warning was confirmed</string>
|
||||
</resources>
|
||||
|
||||
|
|
Loading…
Reference in a new issue