move database actions from pump to treatments plugin

This commit is contained in:
Milos Kozak 2017-05-15 18:44:40 +02:00
parent b1d9e647c6
commit 25110cfea4
20 changed files with 245 additions and 272 deletions

View file

@ -421,6 +421,28 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<Treatment>(); return new ArrayList<Treatment>();
} }
public int update(TempBasal tempBasal) {
int updated = 0;
try {
updated = getDaoTempBasals().update(tempBasal);
latestTreatmentChange = tempBasal.getTimeIndex();
} catch (SQLException e) {
e.printStackTrace();
}
scheduleTreatmentChange();
return updated;
}
public void create(TempBasal tempBasal) {
try {
getDaoTempBasals().create(tempBasal);
latestTreatmentChange = tempBasal.getTimeIndex();
} catch (SQLException e) {
e.printStackTrace();
}
scheduleTreatmentChange();
}
public void delete(TempBasal tempBasal) { public void delete(TempBasal tempBasal) {
try { try {
getDaoTempBasals().delete(tempBasal); getDaoTempBasals().delete(tempBasal);

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.events;
/**
* Created by mike on 15.05.2017.
*/
public class EventExtendedBolusChange {
}

View file

@ -30,9 +30,13 @@ public interface TreatmentsInterface {
TempBasal getTempBasal (long time); TempBasal getTempBasal (long time);
double getTempBasalAbsoluteRate(); double getTempBasalAbsoluteRate();
double getTempBasalRemainingMinutes(); double getTempBasalRemainingMinutes();
void tempBasalStart(TempBasal tempBasal);
void tempBasalStop(long time);
boolean isExtendedBoluslInProgress(); boolean isExtendedBoluslInProgress();
TempBasal getExtendedBolus (long time); TempBasal getExtendedBolus (long time);
void extendedBolusStart(TempBasal extendedBolus);
void extendedBolusStop(long time);
long oldestDataAvaialable(); long oldestDataAvaialable();

View file

@ -28,6 +28,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventBolusRequested; import info.nightscout.androidaps.events.EventBolusRequested;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
@ -412,16 +413,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
return 0d; return 0d;
} }
@Override
public double getTempBasalAbsoluteRate() {
return activeTreatments.getTempBasalAbsoluteRate();
}
@Override
public double getTempBasalRemainingMinutes() {
return activeTreatments.getTempBasalRemainingMinutes();
}
public PumpEnactResult deliverTreatmentFromBolusWizard(InsulinInterface insulinType, Context context, Double insulin, Integer carbs, Double glucose, String glucoseType, int carbTime, JSONObject boluscalc) { public PumpEnactResult deliverTreatmentFromBolusWizard(InsulinInterface insulinType, Context context, Double insulin, Integer carbs, Double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
mWakeLock.acquire(); mWakeLock.acquire();
PumpEnactResult result; PumpEnactResult result;
@ -1141,7 +1132,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
} }
// Treatments interface // ****** Treatments interface *****
@Override @Override
public void updateTotalIOBTreatments() { public void updateTotalIOBTreatments() {
activeTreatments.updateTotalIOBTreatments(); activeTreatments.updateTotalIOBTreatments();
@ -1193,13 +1184,35 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
@Override @Override
public boolean isExtendedBoluslInProgress() { public TempBasal getTempBasal(long time) {
return activeTreatments.isExtendedBoluslInProgress(); return activeTreatments.getTempBasal(time);
} }
@Override @Override
public TempBasal getTempBasal(long time) { public double getTempBasalAbsoluteRate() {
return activeTreatments.getTempBasal(time); return activeTreatments.getTempBasalAbsoluteRate();
}
@Override
public double getTempBasalRemainingMinutes() {
return activeTreatments.getTempBasalRemainingMinutes();
}
@Override
public void tempBasalStart(TempBasal tempBasal) {
activeTreatments.tempBasalStart(tempBasal);
MainApp.bus().post(new EventTempBasalChange());
}
@Override
public void tempBasalStop(long time) {
activeTreatments.tempBasalStop(time);
MainApp.bus().post(new EventTempBasalChange());
}
@Override
public boolean isExtendedBoluslInProgress() {
return activeTreatments.isExtendedBoluslInProgress();
} }
@Override @Override
@ -1207,6 +1220,18 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
return activeTreatments.getExtendedBolus(time); return activeTreatments.getExtendedBolus(time);
} }
@Override
public void extendedBolusStart(TempBasal tempBasal) {
activeTreatments.extendedBolusStart(tempBasal);
MainApp.bus().post(new EventExtendedBolusChange());
}
@Override
public void extendedBolusStop(long time) {
activeTreatments.extendedBolusStop(time);
MainApp.bus().post(new EventExtendedBolusChange());
}
@Override @Override
public long oldestDataAvaialable() { public long oldestDataAvaialable() {
return activeTreatments.oldestDataAvaialable(); return activeTreatments.oldestDataAvaialable();

View file

@ -69,6 +69,7 @@ import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventNewBasalProfile; import info.nightscout.androidaps.events.EventNewBasalProfile;
@ -695,9 +696,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
scheduleUpdateGUI("EventTempBasalChange"); scheduleUpdateGUI("EventTempBasalChange");
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) {
scheduleUpdateGUI("EventExtendedBolusChange");
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
scheduleUpdateGUI("EventTempBasalChange"); scheduleUpdateGUI("EventNewBG");
} }
@Subscribe @Subscribe

View file

@ -20,6 +20,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventNewBasalProfile; import info.nightscout.androidaps.events.EventNewBasalProfile;
@ -238,6 +239,11 @@ public class PersistentNotificationPlugin implements PluginBase{
updateNotification(); updateNotification();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) {
updateNotification();
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
updateNotification(); updateNotification();

View file

@ -24,6 +24,7 @@ import java.util.Date;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
@ -193,6 +194,11 @@ public class DanaRFragment extends Fragment {
updateGUI(); updateGUI();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange s) {
updateGUI();
}
// GUI functions // GUI functions
private void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();

View file

@ -5,15 +5,12 @@ import android.support.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
public class MsgStatusBolusExtended extends MessageBase { public class MsgStatusBolusExtended extends MessageBase {
@ -30,6 +27,9 @@ public class MsgStatusBolusExtended extends MessageBase {
double extendedBolusAmount = intFromBuff(bytes, 2, 2) / 100d; double extendedBolusAmount = intFromBuff(bytes, 2, 2) / 100d;
int extendedBolusSoFarInSecs = intFromBuff(bytes, 4, 3); int extendedBolusSoFarInSecs = intFromBuff(bytes, 4, 3);
// This is available only on korean, but not needed now
// int extendedBolusDeliveryPulse = intFromBuff(bytes, 7, 2);
// int isEasyUIUserSleep = intFromBuff(bytes, 9, 1);
int extendedBolusSoFarInMinutes = extendedBolusSoFarInSecs / 60; int extendedBolusSoFarInMinutes = extendedBolusSoFarInSecs / 60;
double extendedBolusAbsoluteRate = isExtendedInProgress ? extendedBolusAmount / extendedBolusMinutes * 60 : 0d; double extendedBolusAbsoluteRate = isExtendedInProgress ? extendedBolusAmount / extendedBolusMinutes * 60 : 0d;
@ -66,48 +66,38 @@ public class MsgStatusBolusExtended extends MessageBase {
public static void updateExtendedBolusInDB() { public static void updateExtendedBolusInDB() {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
DanaRPump pump = DanaRPump.getInstance(); DanaRPump pump = DanaRPump.getInstance();
Date now = new Date(); long now = new Date().getTime();
try { if (treatmentsInterface.isExtendedBoluslInProgress()) {
TempBasal extendedBolus = treatmentsInterface.getExtendedBolus(new Date().getTime());
if (treatmentsInterface.isExtendedBoluslInProgress()) { if (pump.isExtendedInProgress) {
TempBasal extendedBolus = treatmentsInterface.getExtendedBolus(new Date().getTime()); if (extendedBolus.absolute != pump.extendedBolusAbsoluteRate) {
if (pump.isExtendedInProgress) { // Close current extended
if (extendedBolus.absolute != pump.extendedBolusAbsoluteRate) { treatmentsInterface.extendedBolusStop(now);
// Close current extended
extendedBolus.timeEnd = now;
MainApp.getDbHelper().getDaoTempBasals().update(extendedBolus);
// Create new
TempBasal newExtended = new TempBasal();
newExtended.timeStart = now;
newExtended.absolute = pump.extendedBolusAbsoluteRate;
newExtended.isAbsolute = true;
newExtended.duration = pump.extendedBolusMinutes;
newExtended.isExtended = true;
MainApp.getDbHelper().getDaoTempBasals().create(newExtended);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
// Close curent temp basal
extendedBolus.timeEnd = now;
MainApp.getDbHelper().getDaoTempBasals().update(extendedBolus);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
if (pump.isExtendedInProgress) {
// Create new // Create new
TempBasal newExtended = new TempBasal(); TempBasal newExtended = new TempBasal();
newExtended.timeStart = now; newExtended.timeStart = new Date(now);
newExtended.absolute = pump.extendedBolusAbsoluteRate; newExtended.absolute = pump.extendedBolusAbsoluteRate;
newExtended.isAbsolute = true; newExtended.isAbsolute = true;
newExtended.duration = pump.extendedBolusMinutes; newExtended.duration = pump.extendedBolusMinutes;
newExtended.isExtended = true; newExtended.isExtended = true;
MainApp.getDbHelper().getDaoTempBasals().create(newExtended); treatmentsInterface.extendedBolusStart(newExtended);
MainApp.bus().post(new EventTempBasalChange());
} }
} else {
// Close curent temp basal
treatmentsInterface.extendedBolusStop(now);
}
} else {
if (pump.isExtendedInProgress) {
// Create new
TempBasal newExtended = new TempBasal();
newExtended.timeStart = new Date(now);
newExtended.absolute = pump.extendedBolusAbsoluteRate;
newExtended.isAbsolute = true;
newExtended.duration = pump.extendedBolusMinutes;
newExtended.isExtended = true;
treatmentsInterface.extendedBolusStart(newExtended);
} }
} catch (SQLException e) {
e.printStackTrace();
} }
} }
} }

View file

@ -5,13 +5,11 @@ import android.support.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
@ -62,48 +60,38 @@ public class MsgStatusTempBasal extends MessageBase {
public static void updateTempBasalInDB() { public static void updateTempBasalInDB() {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
DanaRPump danaRPump = DanaRPump.getInstance(); DanaRPump danaRPump = DanaRPump.getInstance();
Date now = new Date(); long now = new Date().getTime();
try { if (treatmentsInterface.isTempBasalInProgress()) {
TempBasal tempBasal = treatmentsInterface.getTempBasal(new Date().getTime());
if (treatmentsInterface.isTempBasalInProgress()) { if (danaRPump.isTempBasalInProgress) {
TempBasal tempBasal = treatmentsInterface.getTempBasal(new Date().getTime()); if (tempBasal.percent != danaRPump.tempBasalPercent) {
if (danaRPump.isTempBasalInProgress) {
if (tempBasal.percent != danaRPump.tempBasalPercent) {
// Close current temp basal
tempBasal.timeEnd = now;
MainApp.getDbHelper().getDaoTempBasals().update(tempBasal);
// Create new
TempBasal newTempBasal = new TempBasal();
newTempBasal.timeStart = now;
newTempBasal.percent = danaRPump.tempBasalPercent;
newTempBasal.isAbsolute = false;
newTempBasal.duration = danaRPump.tempBasalTotalSec / 60;
newTempBasal.isExtended = false;
MainApp.getDbHelper().getDaoTempBasals().create(newTempBasal);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
// Close current temp basal // Close current temp basal
tempBasal.timeEnd = now; treatmentsInterface.tempBasalStop(now);
MainApp.getDbHelper().getDaoTempBasals().update(tempBasal);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
if (danaRPump.isTempBasalInProgress) {
// Create new // Create new
TempBasal newTempBasal = new TempBasal(); TempBasal newTempBasal = new TempBasal();
newTempBasal.timeStart = now; newTempBasal.timeStart = new Date(now);
newTempBasal.percent = danaRPump.tempBasalPercent; newTempBasal.percent = danaRPump.tempBasalPercent;
newTempBasal.isAbsolute = false; newTempBasal.isAbsolute = false;
newTempBasal.duration = danaRPump.tempBasalTotalSec / 60; newTempBasal.duration = danaRPump.tempBasalTotalSec / 60;
newTempBasal.isExtended = false; newTempBasal.isExtended = false;
MainApp.getDbHelper().getDaoTempBasals().create(newTempBasal); treatmentsInterface.tempBasalStart(newTempBasal);
MainApp.bus().post(new EventTempBasalChange());
} }
} else {
// Close current temp basal
treatmentsInterface.tempBasalStop(now);
}
} else {
if (danaRPump.isTempBasalInProgress) {
// Create new
TempBasal newTempBasal = new TempBasal();
newTempBasal.timeStart = new Date(now);
newTempBasal.percent = danaRPump.tempBasalPercent;
newTempBasal.isAbsolute = false;
newTempBasal.duration = danaRPump.tempBasalTotalSec / 60;
newTempBasal.isExtended = false;
treatmentsInterface.tempBasalStart(newTempBasal);
} }
} catch (SQLException e) {
e.printStackTrace();
} }
} }
} }

View file

@ -24,6 +24,7 @@ import java.util.Date;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
@ -191,6 +192,11 @@ public class DanaRKoreanFragment extends Fragment {
updateGUI(); updateGUI();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange s) {
updateGUI();
}
// GUI functions // GUI functions
private void updateGUI() { private void updateGUI() {

View file

@ -24,7 +24,7 @@ public class MessageHashTable_k {
put(new MsgBolusProgress()); // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS put(new MsgBolusProgress()); // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
put(new MsgStatusProfile()); // 0x0204 CMD_PUMP_CALCULATION_SETTING put(new MsgStatusProfile()); // 0x0204 CMD_PUMP_CALCULATION_SETTING
put(new MsgStatusTempBasal()); // 0x0205 CMD_PUMP_EXERCISE_MODE put(new MsgStatusTempBasal()); // 0x0205 CMD_PUMP_EXERCISE_MODE
put(new MsgStatusBolusExtended_k()); // 0x0207 CMD_PUMP_EXPANS_INS_I put(new MsgStatusBolusExtended()); // 0x0207 CMD_PUMP_EXPANS_INS_I
put(new MsgStatusBasic_k()); // 0x020A CMD_PUMP_INITVIEW_I put(new MsgStatusBasic_k()); // 0x020A CMD_PUMP_INITVIEW_I
put(new MsgStatus_k()); // 0x020B CMD_PUMP_STATUS put(new MsgStatus_k()); // 0x020B CMD_PUMP_STATUS
put(new MsgInitConnStatusTime_k()); // 0x0301 CMD_PUMPINIT_TIME_INFO put(new MsgInitConnStatusTime_k()); // 0x0301 CMD_PUMPINIT_TIME_INFO

View file

@ -1,115 +0,0 @@
package info.nightscout.androidaps.plugins.PumpDanaRKorean.comm;
import android.support.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.util.Date;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
public class MsgStatusBolusExtended_k extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgStatusBolusExtended_k.class);
public MsgStatusBolusExtended_k() {
SetCommand(0x0207);
}
public void handleMessage(byte[] bytes) {
DanaRPump pump = DanaRPump.getInstance();
boolean isExtendedInProgress = intFromBuff(bytes, 0, 1) == 1;
int extendedBolusHalfHours = intFromBuff(bytes, 1, 1);
int extendedBolusMinutes = extendedBolusHalfHours * 30;
double extendedBolusAmount = intFromBuff(bytes, 2, 2) / 100d;
int extendedBolusSoFarInSecs = intFromBuff(bytes, 4, 3);
int extendedBolusDeliveryPulse = intFromBuff(bytes, 7, 2);
int isEasyUIUserSleep = intFromBuff(bytes, 9, 1);
int extendedBolusSoFarInMinutes = extendedBolusSoFarInSecs / 60;
double extendedBolusAbsoluteRate = isExtendedInProgress ? extendedBolusAmount / extendedBolusMinutes * 60 : 0d;
Date extendedBolusStart = isExtendedInProgress ? getDateFromSecAgo(extendedBolusSoFarInSecs) : new Date(0);
int extendedBolusRemainingMinutes = extendedBolusMinutes - extendedBolusSoFarInMinutes;
pump.isExtendedInProgress = isExtendedInProgress;
pump.extendedBolusMinutes = extendedBolusMinutes;
pump.extendedBolusAmount = extendedBolusAmount;
pump.extendedBolusSoFarInMinutes = extendedBolusSoFarInMinutes;
pump.extendedBolusAbsoluteRate = extendedBolusAbsoluteRate;
pump.extendedBolusStart = extendedBolusStart;
pump.extendedBolusRemainingMinutes = extendedBolusRemainingMinutes;
updateExtendedBolusInDB();
if (Config.logDanaMessageDetail) {
log.debug("Is extended bolus running: " + isExtendedInProgress);
log.debug("Extended bolus min: " + extendedBolusMinutes);
log.debug("Extended bolus amount: " + extendedBolusAmount);
log.debug("Extended bolus so far in minutes: " + extendedBolusSoFarInMinutes);
log.debug("Extended bolus absolute rate: " + extendedBolusAbsoluteRate);
log.debug("Extended bolus start: " + extendedBolusStart);
log.debug("Extended bolus remaining minutes: " + extendedBolusRemainingMinutes);
}
}
@NonNull
private Date getDateFromSecAgo(int tempBasalAgoSecs) {
return new Date((long) (Math.ceil(new Date().getTime() / 1000d) - tempBasalAgoSecs) * 1000);
}
public static void updateExtendedBolusInDB() {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
DanaRPump pump = DanaRPump.getInstance();
Date now = new Date();
try {
if (treatmentsInterface.isExtendedBoluslInProgress()) {
TempBasal extendedBolus = treatmentsInterface.getExtendedBolus(new Date().getTime());
if (pump.isExtendedInProgress) {
if (extendedBolus.absolute != pump.extendedBolusAbsoluteRate) {
// Close current extended
extendedBolus.timeEnd = now;
MainApp.getDbHelper().getDaoTempBasals().update(extendedBolus);
// Create new
TempBasal newExtended = new TempBasal();
newExtended.timeStart = now;
newExtended.absolute = pump.extendedBolusAbsoluteRate;
newExtended.isAbsolute = true;
newExtended.duration = pump.extendedBolusMinutes;
newExtended.isExtended = true;
MainApp.getDbHelper().getDaoTempBasals().create(newExtended);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
// Close curent temp basal
extendedBolus.timeEnd = now;
MainApp.getDbHelper().getDaoTempBasals().update(extendedBolus);
MainApp.bus().post(new EventTempBasalChange());
}
} else {
if (pump.isExtendedInProgress) {
// Create new
TempBasal newExtended = new TempBasal();
newExtended.timeStart = now;
newExtended.absolute = pump.extendedBolusAbsoluteRate;
newExtended.isAbsolute = true;
newExtended.duration = pump.extendedBolusMinutes;
newExtended.isExtended = true;
MainApp.getDbHelper().getDaoTempBasals().create(newExtended);
MainApp.bus().post(new EventTempBasalChange());
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}

View file

@ -63,6 +63,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingMeal;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatios; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatios;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes; import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart; import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart;
@ -75,7 +76,6 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k; import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k; import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgStatusBasic_k; import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgStatusBasic_k;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgStatusBolusExtended_k;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
@ -276,7 +276,7 @@ public class DanaRKoreanExecutionService extends Service {
//MsgStatus_k statusMsg = new MsgStatus_k(); //MsgStatus_k statusMsg = new MsgStatus_k();
MsgStatusBasic_k statusBasicMsg = new MsgStatusBasic_k(); MsgStatusBasic_k statusBasicMsg = new MsgStatusBasic_k();
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal(); MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
MsgStatusBolusExtended_k exStatusMsg = new MsgStatusBolusExtended_k(); MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
MsgCheckValue_k checkValue = new MsgCheckValue_k(); MsgCheckValue_k checkValue = new MsgCheckValue_k();
if (danaRPump.isNewPump) { if (danaRPump.isNewPump) {
@ -369,7 +369,7 @@ public class DanaRKoreanExecutionService extends Service {
if (!isConnected()) return false; if (!isConnected()) return false;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF))); mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_k()); mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING)); MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
return true; return true;
} }
@ -379,7 +379,7 @@ public class DanaRKoreanExecutionService extends Service {
if (!isConnected()) return false; if (!isConnected()) return false;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingextendedbolus))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop()); mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_k()); mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING)); MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
return true; return true;
} }

View file

@ -24,6 +24,7 @@ import java.util.Date;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
@ -194,6 +195,11 @@ public class DanaRv2Fragment extends Fragment {
updateGUI(); updateGUI();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange s) {
updateGUI();
}
// GUI functions // GUI functions
private void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.interfaces.InsulinInterface;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
@ -235,6 +236,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) { public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = cancelTempBasal(); PumpEnactResult result = cancelTempBasal();
if (!result.success) if (!result.success)
return result; return result;
@ -249,13 +251,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
result.absolute = absoluteRate; result.absolute = absoluteRate;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
try { treatmentsInterface.tempBasalStart(tempBasal);
MainApp.instance().getDbHelper().getDaoTempBasals().create(tempBasal);
} catch (SQLException e) {
e.printStackTrace();
result.success = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting temp basal absolute: " + result); log.debug("Setting temp basal absolute: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());
@ -265,6 +261,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) { public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
if (MainApp.getConfigBuilder().isTempBasalInProgress()) { if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
result = cancelTempBasal(); result = cancelTempBasal();
@ -283,13 +280,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
result.isTempCancel = false; result.isTempCancel = false;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
try { treatmentsInterface.tempBasalStart(tempBasal);
MainApp.instance().getDbHelper().getDaoTempBasals().create(tempBasal);
} catch (SQLException e) {
e.printStackTrace();
result.success = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Settings temp basal percent: " + result); log.debug("Settings temp basal percent: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());
@ -299,6 +290,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = cancelExtendedBolus(); PumpEnactResult result = cancelExtendedBolus();
if (!result.success) if (!result.success)
return result; return result;
@ -314,14 +306,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
result.isTempCancel = false; result.isTempCancel = false;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
try { treatmentsInterface.extendedBolusStart(extendedBolus);
MainApp.instance().getDbHelper().getDaoTempBasals().create(extendedBolus);
} catch (SQLException e) {
e.printStackTrace();
result.success = false;
result.enacted = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting extended bolus: " + result); log.debug("Setting extended bolus: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());
@ -331,26 +316,18 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult cancelTempBasal() { public PumpEnactResult cancelTempBasal() {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
result.isTempCancel = true; result.isTempCancel = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
if (MainApp.getConfigBuilder().isTempBasalInProgress()) { if (treatmentsInterface.isTempBasalInProgress()) {
result.enacted = true; result.enacted = true;
TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); treatmentsInterface.tempBasalStop(new Date().getTime());
tb.timeEnd = new Date(); //tempBasal = null;
try { if (Config.logPumpComm)
MainApp.instance().getDbHelper().getDaoTempBasals().update(tb); log.debug("Canceling temp basal: " + result);
//tempBasal = null; MainApp.bus().post(new EventVirtualPumpUpdateGui());
if (Config.logPumpComm)
log.debug("Canceling temp basal: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
} catch (SQLException e) {
e.printStackTrace();
result.success = false;
result.enacted = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
} }
lastDataTime = new Date(); lastDataTime = new Date();
return result; return result;
@ -358,17 +335,10 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public PumpEnactResult cancelExtendedBolus() { public PumpEnactResult cancelExtendedBolus() {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { if (treatmentsInterface.isExtendedBoluslInProgress()) {
TempBasal extendedBolus = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); treatmentsInterface.extendedBolusStop(new Date().getTime());
extendedBolus.timeEnd = new Date();
try {
MainApp.instance().getDbHelper().getDaoTempBasals().update(extendedBolus);
} catch (SQLException e) {
e.printStackTrace();
result.success = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
} }
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;

View file

@ -24,6 +24,7 @@ import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData; import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.events.EventTreatmentChange;
@ -179,12 +180,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
} }
} }
if (update) { if (update) {
try { MainApp.getDbHelper().update(t);
Dao<TempBasal, Long> dao = MainApp.getDbHelper().getDaoTempBasals();
dao.update(t);
} catch (SQLException e) {
e.printStackTrace();
}
if (Config.logTempBasalsCut) { if (Config.logTempBasalsCut) {
log.debug("Fixing unfinished temp end: " + t.log()); log.debug("Fixing unfinished temp end: " + t.log());
if (position > 0) if (position > 0)
@ -346,6 +342,20 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
return null; return null;
} }
@Override
public void extendedBolusStart(TempBasal extendedBolus) {
}
@Override
public void extendedBolusStop(long time) {
TempBasal extendedBolus = getExtendedBolus(time);
if (extendedBolus != null) {
extendedBolus.timeEnd = new Date(time);
MainApp.getDbHelper().update(extendedBolus);
}
}
@Override @Override
public double getTempBasalAbsoluteRate() { public double getTempBasalAbsoluteRate() {
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
@ -376,6 +386,21 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
return 0; return 0;
} }
@Override
public void tempBasalStart(TempBasal tempBasal) {
MainApp.getDbHelper().create(tempBasal);
}
@Override
public void tempBasalStop(long time) {
TempBasal tempBasal = getTempBasal(time);
if (tempBasal != null) {
tempBasal.timeEnd = new Date(time);
MainApp.getDbHelper().update(tempBasal);
}
}
@Override @Override
public long oldestDataAvaialable() { public long oldestDataAvaialable() {
long oldestTemp = new Date().getTime(); long oldestTemp = new Date().getTime();
@ -410,6 +435,11 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
initializeData(); initializeData();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) {
initializeData();
}
public void onStatusEvent(final EventPreferenceChange s) { public void onStatusEvent(final EventPreferenceChange s) {
if (s.isChanged("danar_useextended")) { if (s.isChanged("danar_useextended")) {
useExtendedBoluses = SP.getBoolean("danar_useextended", false); useExtendedBoluses = SP.getBoolean("danar_useextended", false);

View file

@ -177,12 +177,7 @@ public class TreatmentsFromHistoryPlugin implements PluginBase, TreatmentsInterf
} }
} }
if (update) { if (update) {
try { MainApp.getDbHelper().update(t);
Dao<TempBasal, Long> dao = MainApp.getDbHelper().getDaoTempBasals();
dao.update(t);
} catch (SQLException e) {
e.printStackTrace();
}
if (Config.logTempBasalsCut) { if (Config.logTempBasalsCut) {
log.debug("Fixing unfinished temp end: " + t.log()); log.debug("Fixing unfinished temp end: " + t.log());
if (position > 0) if (position > 0)
@ -342,6 +337,16 @@ public class TreatmentsFromHistoryPlugin implements PluginBase, TreatmentsInterf
return null; return null;
} }
@Override
public void extendedBolusStart(TempBasal extendedBolus) {
}
@Override
public void extendedBolusStop(long time) {
}
@Override @Override
public double getTempBasalAbsoluteRate() { public double getTempBasalAbsoluteRate() {
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
@ -366,6 +371,16 @@ public class TreatmentsFromHistoryPlugin implements PluginBase, TreatmentsInterf
return 0; return 0;
} }
@Override
public void tempBasalStart(TempBasal tempBasal) {
}
@Override
public void tempBasalStop(long time) {
}
@Override @Override
public long oldestDataAvaialable() { public long oldestDataAvaialable() {
long oldestTemp = new Date().getTime(); long oldestTemp = new Date().getTime();
@ -377,10 +392,4 @@ public class TreatmentsFromHistoryPlugin implements PluginBase, TreatmentsInterf
return oldestTemp; return oldestTemp;
} }
@Subscribe
public void onStatusEvent(final EventTempBasalChange ev) {
initializeData();
updateTotalIOBTempBasals();
}
} }

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventBolusRequested; import info.nightscout.androidaps.events.EventBolusRequested;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventNewBasalProfile; import info.nightscout.androidaps.events.EventNewBasalProfile;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
@ -149,6 +150,11 @@ public class WearPlugin implements PluginBase {
sendDataToWatch(true, true, false); sendDataToWatch(true, true, false);
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) {
sendDataToWatch(true, true, false);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
sendDataToWatch(true, true, true); sendDataToWatch(true, true, true);

View file

@ -15,6 +15,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
@ -214,6 +215,11 @@ public class StatuslinePlugin implements PluginBase {
sendStatus(); sendStatus();
} }
@Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) {
sendStatus();
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
sendStatus(); sendStatus();

View file

@ -4,7 +4,7 @@
android:key="danar" android:key="danar"
android:title="@string/danar_pump_settings"> android:title="@string/danar_pump_settings">
<info.nightscout.androidaps.plugins.DanaR.BluetoothDevicePreference <info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference
android:dialogTitle="@string/danar_bt_name_title" android:dialogTitle="@string/danar_bt_name_title"
android:key="@string/key_danar_bt_name" android:key="@string/key_danar_bt_name"
android:title="@string/danar_bt_name_title" /> android:title="@string/danar_bt_name_title" />