From 487e9deb8806ba054ffc5e32522aa0a3a465f4e8 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Mon, 17 Jul 2017 18:07:20 +0200 Subject: [PATCH] Set an error state when the ruffy service can't be bound. See code comment. --- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 793e06168e..78d312759c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -187,7 +187,14 @@ public class ComboPlugin implements PluginBase, PumpInterface { pumpDescription.basalStep = 0.01d; pumpDescription.basalMinimumRate = 0.0d; - pumpDescription.isRefillingCapable = false; + boolean success = context.bindService(intent, mRuffyServiceConnection, Context.BIND_AUTO_CREATE); + if (!success) { + log.error("Binding to ruffy service failed"); + // AAPS will still crash since it continues trying to access the pump, even when isInitalized + // returns false and isBusy returns true; this will however not crash the alerter + // which will raise an exception. Not really ideal. + pumpState.errorMsg = "Failed to bind to ruffy service"; + } } @Override @@ -363,7 +370,7 @@ public class ComboPlugin implements PluginBase, PumpInterface { lastCmd = command; lastCmdTime = new Date(); if (commandResult.success) { - statusSummary = "Idle"; + statusSummary = commandResult.state.suspended ? "Suspended" : "Idle"; pumpState = commandResult.state; } else { statusSummary = "Error";