Log user actions

This commit is contained in:
Milos Kozak 2020-02-04 22:25:07 +01:00
parent 850e79a068
commit a79393c65a
15 changed files with 47 additions and 3 deletions

View file

@ -56,6 +56,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
if (bg > 0) { if (bg > 0) {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
log.debug("USER ENTRY: CALIBRATION $bg")
XdripCalibrations.confirmAndSendCalibration(bg, context) XdripCalibrations.confirmAndSendCalibration(bg, context)
}) })
} }

View file

@ -177,6 +177,7 @@ class CarbsDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
if (activitySelected) { if (activitySelected) {
log.debug("USER ENTRY: TEMPTARGET ACTIVITY $activityTT duration: $activityTTDuration")
val tempTarget = TempTarget() val tempTarget = TempTarget()
.date(eventTime) .date(eventTime)
.duration(activityTTDuration) .duration(activityTTDuration)
@ -186,6 +187,7 @@ class CarbsDialog : DialogFragmentWithDate() {
.high(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits())) .high(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget) TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
} else if (eatingSoonSelected) { } else if (eatingSoonSelected) {
log.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
val tempTarget = TempTarget() val tempTarget = TempTarget()
.date(eventTime) .date(eventTime)
.duration(eatingSoonTTDuration) .duration(eatingSoonTTDuration)
@ -195,6 +197,7 @@ class CarbsDialog : DialogFragmentWithDate() {
.high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits())) .high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget) TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
} else if (hypoSelected) { } else if (hypoSelected) {
log.debug("USER ENTRY: TEMPTARGET HYPO $hypoTT duration: $hypoTTDuration")
val tempTarget = TempTarget() val tempTarget = TempTarget()
.date(eventTime) .date(eventTime)
.duration(hypoTTDuration) .duration(hypoTTDuration)
@ -206,8 +209,10 @@ class CarbsDialog : DialogFragmentWithDate() {
} }
if (carbsAfterConstraints > 0) { if (carbsAfterConstraints > 0) {
if (duration == 0) { if (duration == 0) {
log.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time")
CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes) CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes)
} else { } else {
log.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time duration: $duration")
CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes) CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes)
NSUpload.uploadEvent(CareportalEvent.NOTE, time - 2000, MainApp.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset)) NSUpload.uploadEvent(CareportalEvent.NOTE, time - 2000, MainApp.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset))
} }

View file

@ -180,6 +180,7 @@ class CareDialog : DialogFragmentWithDate() {
EventType.EXERCISE -> CareportalEvent.EXERCISE EventType.EXERCISE -> CareportalEvent.EXERCISE
} }
careportalEvent.json = json.toString() careportalEvent.json = json.toString()
log.debug("USER ENTRY: CAREPORTAL ${careportalEvent.eventType} json: ${careportalEvent.json}")
MainApp.getDbHelper().createOrUpdate(careportalEvent) MainApp.getDbHelper().createOrUpdate(careportalEvent)
NSUpload.uploadCareportalEntryToNS(json) NSUpload.uploadCareportalEntryToNS(json)
}, null) }, null)

View file

@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory
import java.util.* import java.util.*
abstract class DialogFragmentWithDate : DialogFragment() { abstract class DialogFragmentWithDate : DialogFragment() {
private val log = LoggerFactory.getLogger(DialogFragmentWithDate::class.java) val log = LoggerFactory.getLogger(DialogFragmentWithDate::class.java)
var eventTime = DateUtil.now() var eventTime = DateUtil.now()
var eventTimeChanged = false var eventTimeChanged = false

View file

@ -36,6 +36,7 @@ class ErrorDialog : DialogFragment() {
bundle.getString("title")?.let { title = it } bundle.getString("title")?.let { title = it }
sound = bundle.getInt("sound", R.raw.error) sound = bundle.getInt("sound", R.raw.error)
} }
log.debug("Error dialog displayed")
return inflater.inflate(R.layout.dialog_error, container, false) return inflater.inflate(R.layout.dialog_error, container, false)
} }
@ -44,11 +45,11 @@ class ErrorDialog : DialogFragment() {
error_title.text = title error_title.text = title
overview_error_ok.setOnClickListener { overview_error_ok.setOnClickListener {
log.debug("Error dialog ok button pressed") log.debug("USER ENTRY: Error dialog ok button pressed")
dismiss() dismiss()
} }
overview_error_mute.setOnClickListener { overview_error_mute.setOnClickListener {
log.debug("Error dialog mute button pressed") log.debug("USER ENTRY: Error dialog mute button pressed")
stopAlarm() stopAlarm()
} }
startAlarm() startAlarm()

View file

@ -63,6 +63,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
log.debug("USER ENTRY: EXTENDED BOLUS $insulinAfterConstraint duration: $durationInMinutes")
ConfigBuilderPlugin.getPlugin().commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {

View file

@ -102,13 +102,16 @@ class FillDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
if (insulinAfterConstraints > 0) { if (insulinAfterConstraints > 0) {
log.debug("USER ENTRY: PRIME BOLUS $insulinAfterConstraints")
requestPrimeBolus(insulinAfterConstraints, notes) requestPrimeBolus(insulinAfterConstraints, notes)
} }
if (siteChange) { if (siteChange) {
log.debug("USER ENTRY: SITE CHANGE")
generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes) generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes)
} }
if (insulinChange) { if (insulinChange) {
// add a second for case of both checked // add a second for case of both checked
log.debug("USER ENTRY: INSULIN CHANGE")
generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes) generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes)
} }
}, null) }, null)

View file

@ -147,6 +147,7 @@ class InsulinDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
if (eatingSoonChecked) { if (eatingSoonChecked) {
log.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
val tempTarget = TempTarget() val tempTarget = TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.duration(eatingSoonTTDuration) .duration(eatingSoonTTDuration)
@ -164,9 +165,11 @@ class InsulinDialog : DialogFragmentWithDate() {
detailedBolusInfo.source = Source.USER detailedBolusInfo.source = Source.USER
detailedBolusInfo.notes = notes detailedBolusInfo.notes = notes
if (recordOnlyChecked) { if (recordOnlyChecked) {
log.debug("USER ENTRY: BOLUS RECORD ONLY $insulinAfterConstraints")
detailedBolusInfo.date = time detailedBolusInfo.date = time
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false) TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false)
} else { } else {
log.debug("USER ENTRY: BOLUS $insulinAfterConstraints")
detailedBolusInfo.date = DateUtil.now() detailedBolusInfo.date = DateUtil.now()
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() { override fun run() {

View file

@ -97,6 +97,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
log.debug("USER ENTRY: PROFILE SWITCH $profile percent: $percent timeshift: $timeShift duration: $duration")
ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime) ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime)
}) })
} }

View file

@ -104,8 +104,10 @@ class TempBasalDialog : DialogFragmentWithDate() {
} }
} }
if (isPercentPump) { if (isPercentPump) {
log.debug("USER ENTRY: TEMP BASAL $percent% duration: $durationInMinutes")
ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback) ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
} else { } else {
log.debug("USER ENTRY: TEMP BASAL $absolute duration: $durationInMinutes")
ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback) ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
} }
}) })

View file

@ -127,6 +127,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
log.debug("USER ENTRY: TEMP TARGET $target duration: $duration")
if (target == 0.0 || duration == 0.0) { if (target == 0.0 || duration == 0.0) {
val tempTarget = TempTarget() val tempTarget = TempTarget()
.date(eventTime) .date(eventTime)

View file

@ -99,6 +99,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) { if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
log.debug("USER ENTRY: BOLUS insulin $insulin carbs: $carbs")
val detailedBolusInfo = DetailedBolusInfo() val detailedBolusInfo = DetailedBolusInfo()
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment
import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.dialogs.TempTargetDialog import info.nightscout.androidaps.dialogs.TempTargetDialog
import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.*
@ -34,9 +35,11 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.actions_fragment.* import kotlinx.android.synthetic.main.actions_fragment.*
import kotlinx.android.synthetic.main.careportal_stats_fragment.* import kotlinx.android.synthetic.main.careportal_stats_fragment.*
import org.slf4j.LoggerFactory
import java.util.* import java.util.*
class ActionsFragment : Fragment() { class ActionsFragment : Fragment() {
private val log = LoggerFactory.getLogger(L.CORE)
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -67,6 +70,7 @@ class ActionsFragment : Fragment() {
} }
actions_extendedbolus_cancel.setOnClickListener { actions_extendedbolus_cancel.setOnClickListener {
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress) { if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress) {
log.debug("USER ENTRY: CANCEL EXTENDED BOLUS")
ConfigBuilderPlugin.getPlugin().commandQueue.cancelExtended(object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.cancelExtended(object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
@ -86,6 +90,7 @@ class ActionsFragment : Fragment() {
} }
actions_canceltempbasal.setOnClickListener { actions_canceltempbasal.setOnClickListener {
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress) { if (TreatmentsPlugin.getPlugin().isTempBasalInProgress) {
log.debug("USER ENTRY: CANCEL TEMP BASAL")
ConfigBuilderPlugin.getPlugin().commandQueue.cancelTempBasal(true, object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {

View file

@ -667,6 +667,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return true; return true;
final LoopPlugin loopPlugin = LoopPlugin.getPlugin(); final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
if (item.getTitle().equals(MainApp.gs(R.string.disableloop))) { if (item.getTitle().equals(MainApp.gs(R.string.disableloop))) {
log.debug("USER ENTRY: LOOP DISABLED");
loopPlugin.setPluginEnabled(PluginType.LOOP, false); loopPlugin.setPluginEnabled(PluginType.LOOP, false);
loopPlugin.setFragmentVisible(PluginType.LOOP, false); loopPlugin.setFragmentVisible(PluginType.LOOP, false);
ConfigBuilderPlugin.getPlugin().storeSettings("DisablingLoop"); ConfigBuilderPlugin.getPlugin().storeSettings("DisablingLoop");
@ -682,6 +683,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
LoopPlugin.getPlugin().createOfflineEvent(24 * 60); // upload 24h, we don't know real duration LoopPlugin.getPlugin().createOfflineEvent(24 * 60); // upload 24h, we don't know real duration
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.enableloop))) { } else if (item.getTitle().equals(MainApp.gs(R.string.enableloop))) {
log.debug("USER ENTRY: LOOP ENABLED");
loopPlugin.setPluginEnabled(PluginType.LOOP, true); loopPlugin.setPluginEnabled(PluginType.LOOP, true);
loopPlugin.setFragmentVisible(PluginType.LOOP, true); loopPlugin.setFragmentVisible(PluginType.LOOP, true);
ConfigBuilderPlugin.getPlugin().storeSettings("EnablingLoop"); ConfigBuilderPlugin.getPlugin().storeSettings("EnablingLoop");
@ -690,6 +692,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.resume)) || } else if (item.getTitle().equals(MainApp.gs(R.string.resume)) ||
item.getTitle().equals(MainApp.gs(R.string.reconnect))) { item.getTitle().equals(MainApp.gs(R.string.reconnect))) {
log.debug("USER ENTRY: RESUME");
loopPlugin.suspendTo(0L); loopPlugin.suspendTo(0L);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() { ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@ -704,39 +707,48 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
LoopPlugin.getPlugin().createOfflineEvent(0); LoopPlugin.getPlugin().createOfflineEvent(0);
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor1h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor1h))) {
log.debug("USER ENTRY: SUSPEND 1h");
LoopPlugin.getPlugin().suspendLoop(60); LoopPlugin.getPlugin().suspendLoop(60);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor2h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor2h))) {
log.debug("USER ENTRY: SUSPEND 2h");
LoopPlugin.getPlugin().suspendLoop(120); LoopPlugin.getPlugin().suspendLoop(120);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor3h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor3h))) {
log.debug("USER ENTRY: SUSPEND 3h");
LoopPlugin.getPlugin().suspendLoop(180); LoopPlugin.getPlugin().suspendLoop(180);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor10h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.suspendloopfor10h))) {
log.debug("USER ENTRY: SUSPEND 10h");
LoopPlugin.getPlugin().suspendLoop(600); LoopPlugin.getPlugin().suspendLoop(600);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor15m))) { } else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor15m))) {
log.debug("USER ENTRY: DISCONNECT 15m");
LoopPlugin.getPlugin().disconnectPump(15, profile); LoopPlugin.getPlugin().disconnectPump(15, profile);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor30m))) { } else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor30m))) {
log.debug("USER ENTRY: DISCONNECT 30m");
LoopPlugin.getPlugin().disconnectPump(30, profile); LoopPlugin.getPlugin().disconnectPump(30, profile);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor1h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor1h))) {
log.debug("USER ENTRY: DISCONNECT 1h");
LoopPlugin.getPlugin().disconnectPump(60, profile); LoopPlugin.getPlugin().disconnectPump(60, profile);
SP.putBoolean(R.string.key_objectiveusedisconnect, true); SP.putBoolean(R.string.key_objectiveusedisconnect, true);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor2h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor2h))) {
log.debug("USER ENTRY: DISCONNECT 2h");
LoopPlugin.getPlugin().disconnectPump(120, profile); LoopPlugin.getPlugin().disconnectPump(120, profile);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor3h))) { } else if (item.getTitle().equals(MainApp.gs(R.string.disconnectpumpfor3h))) {
log.debug("USER ENTRY: DISCONNECT 3h");
LoopPlugin.getPlugin().disconnectPump(180, profile); LoopPlugin.getPlugin().disconnectPump(180, profile);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
return true; return true;
@ -754,6 +766,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (manager != null) if (manager != null)
pvd.show(manager, "ProfileViewDialog"); pvd.show(manager, "ProfileViewDialog");
} else if (item.getTitle().equals(MainApp.gs(R.string.eatingsoon))) { } else if (item.getTitle().equals(MainApp.gs(R.string.eatingsoon))) {
log.debug("USER ENTRY: TEMP TARGET EATING SOON");
double target = Profile.toMgdl(DefaultValueHelper.determineEatingSoonTT(), ProfileFunctions.getSystemUnits()); double target = Profile.toMgdl(DefaultValueHelper.determineEatingSoonTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
@ -764,6 +777,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
.high(target); .high(target);
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.activity))) { } else if (item.getTitle().equals(MainApp.gs(R.string.activity))) {
log.debug("USER ENTRY: TEMP TARGET ACTIVITY");
double target = Profile.toMgdl(DefaultValueHelper.determineActivityTT(), ProfileFunctions.getSystemUnits()); double target = Profile.toMgdl(DefaultValueHelper.determineActivityTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(now()) .date(now())
@ -774,6 +788,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
.high(target); .high(target);
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) { } else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) {
log.debug("USER ENTRY: TEMP TARGET HYPO");
double target = Profile.toMgdl(DefaultValueHelper.determineHypoTT(), ProfileFunctions.getSystemUnits()); double target = Profile.toMgdl(DefaultValueHelper.determineHypoTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(now()) .date(now())
@ -788,6 +803,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (manager != null) if (manager != null)
new TempTargetDialog().show(manager, "Overview"); new TempTargetDialog().show(manager, "Overview");
} else if (item.getTitle().equals(MainApp.gs(R.string.cancel))) { } else if (item.getTitle().equals(MainApp.gs(R.string.cancel))) {
log.debug("USER ENTRY: TEMP TARGET CANCEL");
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.source(Source.USER) .source(Source.USER)
.date(now()) .date(now())
@ -907,6 +923,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.isChangeRequested()) { if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.isChangeRequested()) {
OKDialog.showConfirmation(context, MainApp.gs(R.string.pump_tempbasal_label), finalLastRun.constraintsProcessed.toSpanned(), () -> { OKDialog.showConfirmation(context, MainApp.gs(R.string.pump_tempbasal_label), finalLastRun.constraintsProcessed.toSpanned(), () -> {
log.debug("USER ENTRY: ACCEPT TEMP BASAL");
hideTempRecommendation(); hideTempRecommendation();
clearNotification(); clearNotification();
LoopPlugin.getPlugin().acceptChangeRequest(); LoopPlugin.getPlugin().acceptChangeRequest();

View file

@ -277,6 +277,7 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
OKDialog.showConfirmation(context, MainApp.gs(R.string.boluswizard), HtmlHelper.fromHtml(confirmMessage), Runnable { OKDialog.showConfirmation(context, MainApp.gs(R.string.boluswizard), HtmlHelper.fromHtml(confirmMessage), Runnable {
if (insulinAfterConstraints > 0 || carbs > 0) { if (insulinAfterConstraints > 0 || carbs > 0) {
if (useSuperBolus) { if (useSuperBolus) {
log.debug("USER ENTRY: SUPERBOLUS TBR")
val loopPlugin = LoopPlugin.getPlugin() val loopPlugin = LoopPlugin.getPlugin()
if (loopPlugin.isEnabled(PluginType.LOOP)) { if (loopPlugin.isEnabled(PluginType.LOOP)) {
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000) loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
@ -325,6 +326,7 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
detailedBolusInfo.boluscalc = nsJSON() detailedBolusInfo.boluscalc = nsJSON()
detailedBolusInfo.source = Source.USER detailedBolusInfo.source = Source.USER
detailedBolusInfo.notes = notes detailedBolusInfo.notes = notes
log.debug("USER ENTRY: BOLUS insulin $insulinAfterConstraints carbs: $carbs")
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) { if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() { override fun run() {