specify source at detailedbolusinfo

This commit is contained in:
Milos Kozak 2017-06-10 13:39:51 +02:00
parent 472e7075c3
commit f65d75e553
7 changed files with 14 additions and 3 deletions

View file

@ -28,6 +28,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -164,6 +165,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
detailedBolusInfo.insulin = finalInsulinAfterConstraints; detailedBolusInfo.insulin = finalInsulinAfterConstraints;
detailedBolusInfo.context = context; detailedBolusInfo.context = context;
detailedBolusInfo.addToTreatments = false; detailedBolusInfo.addToTreatments = false;
detailedBolusInfo.source = Source.NONE;
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -112,6 +113,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
detailedBolusInfo.insulin = finalInsulinAfterConstraints; detailedBolusInfo.insulin = finalInsulinAfterConstraints;
detailedBolusInfo.carbs = finalCarbsAfterConstraints; detailedBolusInfo.carbs = finalCarbsAfterConstraints;
detailedBolusInfo.context = context; detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER;
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);

View file

@ -48,6 +48,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
@ -333,6 +334,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
detailedBolusInfo.glucoseType = "Manual"; detailedBolusInfo.glucoseType = "Manual";
detailedBolusInfo.carbTime = carbTime; detailedBolusInfo.carbTime = carbTime;
detailedBolusInfo.boluscalc = boluscalcJSON; detailedBolusInfo.boluscalc = boluscalcJSON;
detailedBolusInfo.source = Source.USER;
result = pump.deliverTreatment(detailedBolusInfo); result = pump.deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.treatmentdeliveryerror), result.comment, null); OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.treatmentdeliveryerror), result.comment, null);

View file

@ -73,6 +73,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.ProfileSwitch; import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
@ -698,6 +699,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
detailedBolusInfo.carbs = finalCarbsAfterConstraints; detailedBolusInfo.carbs = finalCarbsAfterConstraints;
detailedBolusInfo.context = context; detailedBolusInfo.context = context;
detailedBolusInfo.boluscalc = boluscalcJSON; detailedBolusInfo.boluscalc = boluscalcJSON;
detailedBolusInfo.source = Source.USER;
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); AlertDialog.Builder builder = new AlertDialog.Builder(getContext());

View file

@ -76,6 +76,7 @@ public class MsgHistoryEvents_v2 extends MessageBase {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.recordFromHistory = true; detailedBolusInfo.recordFromHistory = true;
detailedBolusInfo.pumpId = datetime.getTime(); detailedBolusInfo.pumpId = datetime.getTime();
detailedBolusInfo.source = Source.PUMP;
switch (recordCode) { switch (recordCode) {
case DanaRPump.TEMPSTART: case DanaRPump.TEMPSTART:
@ -104,14 +105,12 @@ public class MsgHistoryEvents_v2 extends MessageBase {
log.debug("EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
detailedBolusInfo.source = Source.PUMP;
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
break; break;
case DanaRPump.DUALBOLUS: case DanaRPump.DUALBOLUS:
log.debug("EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
detailedBolusInfo.source = Source.PUMP;
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
break; break;
case DanaRPump.DUALEXTENDEDSTART: case DanaRPump.DUALEXTENDEDSTART:
@ -144,7 +143,6 @@ public class MsgHistoryEvents_v2 extends MessageBase {
log.debug("EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g"); log.debug("EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.carbs = param1; detailedBolusInfo.carbs = param1;
detailedBolusInfo.source = Source.PUMP;
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
break; break;
default: default:

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
@ -465,6 +466,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class); danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.insulin = bolusWaitingForConfirmation.bolusRequested; detailedBolusInfo.insulin = bolusWaitingForConfirmation.bolusRequested;
detailedBolusInfo.source = Source.USER;
PumpEnactResult result = pumpInterface.deliverTreatment(detailedBolusInfo); PumpEnactResult result = pumpInterface.deliverTreatment(detailedBolusInfo);
if (result.success) { if (result.success) {
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered); reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
@ -371,6 +372,7 @@ public class ActionStringHandler {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.insulin = amount; detailedBolusInfo.insulin = amount;
detailedBolusInfo.addToTreatments = false; detailedBolusInfo.addToTreatments = false;
detailedBolusInfo.source = Source.USER;
PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo); PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) + sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) +
@ -390,6 +392,7 @@ public class ActionStringHandler {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.insulin = amount; detailedBolusInfo.insulin = amount;
detailedBolusInfo.carbs = carbs; detailedBolusInfo.carbs = carbs;
detailedBolusInfo.source = Source.USER;
PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo); PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo);
if (!result.success) { if (!result.success) {
sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) + sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) +