From f65d75e553533fe45a41380f1def4b7cd2705e00 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 10 Jun 2017 13:39:51 +0200 Subject: [PATCH] specify source at detailedbolusinfo --- .../androidaps/plugins/Actions/dialogs/FillDialog.java | 2 ++ .../plugins/Overview/Dialogs/NewTreatmentDialog.java | 2 ++ .../androidaps/plugins/Overview/Dialogs/WizardDialog.java | 2 ++ .../androidaps/plugins/Overview/OverviewFragment.java | 2 ++ .../plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java | 4 +--- .../plugins/SmsCommunicator/SmsCommunicatorPlugin.java | 2 ++ .../androidaps/plugins/Wear/ActionStringHandler.java | 3 +++ 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java index 0e26766a40..834206ca34 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java @@ -28,6 +28,7 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.utils.DecimalFormatter; @@ -164,6 +165,7 @@ public class FillDialog extends DialogFragment implements OnClickListener { detailedBolusInfo.insulin = finalInsulinAfterConstraints; detailedBolusInfo.context = context; detailedBolusInfo.addToTreatments = false; + detailedBolusInfo.source = Source.NONE; PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); if (!result.success) { AlertDialog.Builder builder = new AlertDialog.Builder(context); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index b908507d09..9b6b7a0f45 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -27,6 +27,7 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.CareportalEvent; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.SafeParse; @@ -112,6 +113,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene detailedBolusInfo.insulin = finalInsulinAfterConstraints; detailedBolusInfo.carbs = finalCarbsAfterConstraints; detailedBolusInfo.context = context; + detailedBolusInfo.source = Source.USER; PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); if (!result.success) { AlertDialog.Builder builder = new AlertDialog.Builder(context); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index f3faaafa2f..5ba5f3a6f3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -48,6 +48,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.DatabaseHelper; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; @@ -333,6 +334,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com detailedBolusInfo.glucoseType = "Manual"; detailedBolusInfo.carbTime = carbTime; detailedBolusInfo.boluscalc = boluscalcJSON; + detailedBolusInfo.source = Source.USER; result = pump.deliverTreatment(detailedBolusInfo); if (!result.success) { OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.treatmentdeliveryerror), result.comment, null); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index c2d9dd7766..6c10a1e8d7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -73,6 +73,7 @@ import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ProfileSwitch; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.Treatment; @@ -698,6 +699,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, detailedBolusInfo.carbs = finalCarbsAfterConstraints; detailedBolusInfo.context = context; detailedBolusInfo.boluscalc = boluscalcJSON; + detailedBolusInfo.source = Source.USER; PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo); if (!result.success) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java index 414ccf0a90..626b339d59 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java @@ -76,6 +76,7 @@ public class MsgHistoryEvents_v2 extends MessageBase { DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo.recordFromHistory = true; detailedBolusInfo.pumpId = datetime.getTime(); + detailedBolusInfo.source = Source.PUMP; switch (recordCode) { 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"); detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.insulin = param1 / 100d; - detailedBolusInfo.source = Source.PUMP; MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); break; case DanaRPump.DUALBOLUS: log.debug("EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.insulin = param1 / 100d; - detailedBolusInfo.source = Source.PUMP; MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); break; case DanaRPump.DUALEXTENDEDSTART: @@ -144,7 +143,6 @@ public class MsgHistoryEvents_v2 extends MessageBase { log.debug("EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g"); detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.carbs = param1; - detailedBolusInfo.source = Source.PUMP; MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); break; default: diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index e77e16005f..4e81aa49d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -27,6 +27,7 @@ import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.DatabaseHelper; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.interfaces.PluginBase; @@ -465,6 +466,7 @@ public class SmsCommunicatorPlugin implements PluginBase { danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo.insulin = bolusWaitingForConfirmation.bolusRequested; + detailedBolusInfo.source = Source.USER; PumpEnactResult result = pumpInterface.deliverTreatment(detailedBolusInfo); if (result.success) { reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 9c4fc24f25..fe14560019 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -16,6 +16,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.DatabaseHelper; +import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.PluginBase; @@ -371,6 +372,7 @@ public class ActionStringHandler { DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo.insulin = amount; detailedBolusInfo.addToTreatments = false; + detailedBolusInfo.source = Source.USER; PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo); if (!result.success) { sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) + @@ -390,6 +392,7 @@ public class ActionStringHandler { DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo.insulin = amount; detailedBolusInfo.carbs = carbs; + detailedBolusInfo.source = Source.USER; PumpEnactResult result = MainApp.getConfigBuilder().deliverTreatment(detailedBolusInfo); if (!result.success) { sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) +