Combo: show notification on broken setup.
This commit is contained in:
parent
f14ba554f0
commit
ef650b80a1
4 changed files with 12 additions and 4 deletions
|
@ -354,6 +354,11 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
|
||||
// trigger a connect, which will update state and check history
|
||||
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState);
|
||||
if (stateResult.invalidSetup) {
|
||||
MainApp.bus().post(new EventNewNotification(
|
||||
new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_invalid_setup), Notification.URGENT)));
|
||||
return;
|
||||
}
|
||||
if (!stateResult.success) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import android.support.annotation.Nullable;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.Bolus;
|
||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistory;
|
||||
|
||||
public class CommandResult {
|
||||
/** True if a condition indicating a broken pump setup/configuration is detected */
|
||||
public boolean invalidSetup;
|
||||
/** Whether the command was executed successfully. */
|
||||
public boolean success;
|
||||
/** State of the pump *after* command execution. */
|
||||
|
|
|
@ -281,10 +281,10 @@ public class RuffyScripter implements RuffyCommands {
|
|||
log.debug("Executing " + cmd + " took " + (cmdEndTime - cmdStartTime) + "ms");
|
||||
} catch (CommandException e) {
|
||||
log.error("CommandException running command", e);
|
||||
activeCmd.getResult().success = false;
|
||||
cmd.getResult().success = false;
|
||||
} catch (Exception e) {
|
||||
log.error("Unexpected exception running cmd", e);
|
||||
activeCmd.getResult().success = false;
|
||||
cmd.getResult().success = false;
|
||||
}
|
||||
}, cmd.getClass().getSimpleName());
|
||||
long executionStart = System.currentTimeMillis();
|
||||
|
@ -328,6 +328,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
if (unparsableMenuEncountered) {
|
||||
log.error("UnparsableMenuEncountered flagged, aborting command");
|
||||
cmdThread.interrupt();
|
||||
activeCmd.getResult().invalidSetup = true;
|
||||
activeCmd.getResult().success = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1162,7 +1162,8 @@
|
|||
<string name="nth_objective">%1$d. Objective</string>
|
||||
<string name="poctech">Poctech</string>
|
||||
<string name="description_source_poctech">Receive BG values from Poctech app</string>
|
||||
|
||||
<string name="combo_invalid_setup">Invalid pump setup, check the docs and verify that the Quick Info menu is named "QUICK INFO" using the 360 configuration software.</string>
|
||||
|
||||
<plurals name="objective_days">
|
||||
<item quantity="one">%d day</item>
|
||||
<item quantity="other">%d days</item>
|
||||
|
|
Loading…
Reference in a new issue