Logging cleanup.

This commit is contained in:
Johannes Mockenhaupt 2017-07-14 23:06:34 +02:00
parent 9674db8d85
commit 848a32eade
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -244,13 +244,14 @@ public class ComboPlugin implements PluginBase, PumpInterface {
public double getBaseBasalRate() { public double getBaseBasalRate() {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
Double basal = profile.getBasal(); Double basal = profile.getBasal();
log.debug("getBaseBasalrate returning " + basal); log.trace("getBaseBasalrate returning " + basal);
return basal; return basal;
} }
// TODO rewrite this crap into something comprehensible // TODO rewrite this crap into something comprehensible
@Override @Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
log.debug("deliver treatment called with dbi: " + detailedBolusInfo);
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder(); ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin); detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) { if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
@ -293,18 +294,14 @@ public class ComboPlugin implements PluginBase, PumpInterface {
} }
private CommandResult runCommand(Command command) { private CommandResult runCommand(Command command) {
// TODO call this for all cmnds // TODO use this to dispatch methods to a service thread, like DanaRs executionService
// TODO use this to disptach methods to a service thread, like DanaRs executionService
// TODO add a monitor-something that raises an alarm if the command has finished
// with 90s or so
try { try {
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTED));
return ruffyScripter.runCommand(command); return ruffyScripter.runCommand(command);
} finally { } finally {
// MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
lastCmdTime = new Date(); lastCmdTime = new Date();
ruffyScripter.disconnect(); ruffyScripter.disconnect();
// MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED)); MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED));
// MainApp.bus().post(new EventComboPumpUpdateGUI());
} }
} }
@ -323,6 +320,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) { public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
log.debug("setTempBasalPercent called with " + percent + "% for " + durationInMinutes + "min");
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
CommandResult commandResult = runCommand(new SetTbrCommand(percent, durationInMinutes)); CommandResult commandResult = runCommand(new SetTbrCommand(percent, durationInMinutes));
if (commandResult.enacted) { if (commandResult.enacted) {
@ -354,6 +352,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult cancelTempBasal() { public PumpEnactResult cancelTempBasal() {
log.debug("cancelTempBasal called");
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
CommandResult commandResult = runCommand(new CancelTbrCommand()); CommandResult commandResult = runCommand(new CancelTbrCommand());
if(commandResult.enacted) { if(commandResult.enacted) {