- notification on setting or failing to set new Profile (#22)

- changed also in Medtronic module
- when bolus is correctly set, we will see it displayed in Tab (#27)
This commit is contained in:
Andy Rozman 2019-12-22 14:16:01 +01:00
parent b16e685ecc
commit 91648a935f
3 changed files with 33 additions and 0 deletions

View file

@ -1479,8 +1479,14 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
LOG.info(getLogPrefix() + "Basal Profile was set: " + response); LOG.info(getLogPrefix() + "Basal Profile was set: " + response);
if (response) { if (response) {
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
RxBus.INSTANCE.send(new EventNewNotification(notification));
return new PumpEnactResult().success(true).enacted(true); return new PumpEnactResult().success(true).enacted(true);
} else { } else {
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
RxBus.INSTANCE.send(new EventNewNotification(notification));
return new PumpEnactResult().success(response).enacted(response) // return new PumpEnactResult().success(response).enacted(response) //
.comment(MainApp.gs(R.string.medtronic_cmd_basal_profile_could_not_be_set)); .comment(MainApp.gs(R.string.medtronic_cmd_basal_profile_could_not_be_set));
} }

View file

@ -37,7 +37,9 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
@ -842,6 +844,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (result.success) { if (result.success) {
this.currentProfile = profile; this.currentProfile = profile;
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
RxBus.INSTANCE.send(new EventNewNotification(notification));
} else {
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
RxBus.INSTANCE.send(new EventNewNotification(notification));
} }
return result; return result;

View file

@ -3,6 +3,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
@ -32,6 +35,22 @@ public class OmnipodUIPostprocessor {
switch (uiTask.commandType) { switch (uiTask.commandType) {
case SetBolus: {
if (uiTask.returnData!=null) {
PumpEnactResult result = uiTask.returnData;
if (result.success) {
boolean isSmb = uiTask.getBooleanFromParameters(1);
if (!isSmb) {
pumpStatus.lastBolusAmount = uiTask.getDoubleFromParameters(0);
pumpStatus.lastBolusTime = new Date();
}
}
}
} break;
// case PairAndPrimePod: { // case PairAndPrimePod: {
// if (uiTask.returnData.success) { // if (uiTask.returnData.success) {
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false); // omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);