CarePortal, ExtendedBolusDialog, FillDialog, InsulinDialog
Some cleaning in Imports
This commit is contained in:
parent
1a1d718fa2
commit
9b9bafb4bc
11 changed files with 48 additions and 64 deletions
|
@ -18,8 +18,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogCareBinding
|
import info.nightscout.androidaps.databinding.DialogCareBinding
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
@ -63,7 +61,7 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
private var options: EventType = EventType.BGCHECK
|
private var options: EventType = EventType.BGCHECK
|
||||||
//private var valuesWithUnit = mutableListOf<XXXValueWithUnit?>()
|
//private var valuesWithUnit = mutableListOf<XXXValueWithUnit?>()
|
||||||
private var valuesWithUnit = mutableListOf<ValueWithUnit>()
|
private var valuesWithUnit = mutableListOf<XXXValueWithUnit?>()
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
private var event: Int = R.string.none
|
private var event: Int = R.string.none
|
||||||
|
@ -205,16 +203,13 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + resourceHelper.gs(unitResId))
|
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + resourceHelper.gs(unitResId))
|
||||||
therapyEvent.glucoseType = meterType
|
therapyEvent.glucoseType = meterType
|
||||||
therapyEvent.glucose = binding.bg.value
|
therapyEvent.glucose = binding.bg.value
|
||||||
//valuesWithUnit.add(XXXValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
valuesWithUnit.add(XXXValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
||||||
//valuesWithUnit.add(XXXValueWithUnit.TherapyEventMeterType(meterType))
|
valuesWithUnit.add(XXXValueWithUnit.TherapyEventMeterType(meterType))
|
||||||
valuesWithUnit.add(ValueWithUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
|
||||||
valuesWithUnit.add(ValueWithUnit(meterType.text, Units.TherapyEvent))
|
|
||||||
}
|
}
|
||||||
if (options == EventType.NOTE || options == EventType.EXERCISE) {
|
if (options == EventType.NOTE || options == EventType.EXERCISE) {
|
||||||
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_duration_label) + ": " + resourceHelper.gs(R.string.format_mins, binding.duration.value.toInt()))
|
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_duration_label) + ": " + resourceHelper.gs(R.string.format_mins, binding.duration.value.toInt()))
|
||||||
therapyEvent.duration = T.mins(binding.duration.value.toLong()).msecs()
|
therapyEvent.duration = T.mins(binding.duration.value.toLong()).msecs()
|
||||||
//valuesWithUnit.add(XXXValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) })
|
valuesWithUnit.add(XXXValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) } )
|
||||||
valuesWithUnit.add(ValueWithUnit(binding.duration.value.toInt(), Units.M, !binding.duration.value.equals(0.0)))
|
|
||||||
}
|
}
|
||||||
val notes = binding.notesLayout.notes.text.toString()
|
val notes = binding.notesLayout.notes.text.toString()
|
||||||
if (notes.isNotEmpty()) {
|
if (notes.isNotEmpty()) {
|
||||||
|
@ -235,7 +230,6 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
EventType.QUESTION -> Sources.Question
|
EventType.QUESTION -> Sources.Question
|
||||||
EventType.ANNOUNCEMENT -> Sources.Announcement
|
EventType.ANNOUNCEMENT -> Sources.Announcement
|
||||||
}
|
}
|
||||||
valuesWithUnit.add(ValueWithUnit(source))
|
|
||||||
|
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(event), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(event), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
|
@ -244,11 +238,9 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
||||||
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
||||||
)
|
)
|
||||||
//valuesWithUnit.add(0, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
valuesWithUnit.add(0, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
||||||
//valuesWithUnit.add(1, XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
valuesWithUnit.add(1, XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||||
valuesWithUnit.add(0, ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged))
|
uel.log(Action.CAREPORTAL, source, notes, valuesWithUnit)
|
||||||
valuesWithUnit.add(1, ValueWithUnit(therapyEvent.type.text, Units.TherapyEvent))
|
|
||||||
uel.log(Action.CAREPORTAL, notes, valuesWithUnit)
|
|
||||||
}, null)
|
}, null)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -11,8 +11,6 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||||
|
@ -92,8 +90,9 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
//uel.log(Action.EXTENDED_BOLUS, XXXValueWithUnit.Insulin(insulinAfterConstraint), XXXValueWithUnit.Minute(durationInMinutes))
|
uel.log(Action.EXTENDED_BOLUS, Sources.ExtendedBolusDialog,
|
||||||
uel.log(Action.EXTENDED_BOLUS, ValueWithUnit(Sources.ExtendedBolusDialog), ValueWithUnit(insulinAfterConstraint, Units.U), ValueWithUnit(durationInMinutes, Units.M))
|
XXXValueWithUnit.Insulin(insulinAfterConstraint),
|
||||||
|
XXXValueWithUnit.Minute(durationInMinutes))
|
||||||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -14,8 +14,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogFillBinding
|
import info.nightscout.androidaps.databinding.DialogFillBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
|
@ -137,13 +135,15 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
//uel.log(Action.PRIME_BOLUS, notes, XXXValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 })
|
uel.log(Action.PRIME_BOLUS, Sources.FillDialog,
|
||||||
uel.log(Action.PRIME_BOLUS, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0))
|
notes,
|
||||||
|
XXXValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 })
|
||||||
requestPrimeBolus(insulinAfterConstraints, notes)
|
requestPrimeBolus(insulinAfterConstraints, notes)
|
||||||
}
|
}
|
||||||
if (siteChange) {
|
if (siteChange) {
|
||||||
//uel.log(Action.CAREPORTAL, notes, XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE))
|
uel.log(Action.CAREPORTAL, Sources.FillDialog,
|
||||||
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(TherapyEvent.Type.CANNULA_CHANGE.text, Units.TherapyEvent))
|
notes,
|
||||||
|
XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE))
|
||||||
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
||||||
timestamp = eventTime,
|
timestamp = eventTime,
|
||||||
type = TherapyEvent.Type.CANNULA_CHANGE,
|
type = TherapyEvent.Type.CANNULA_CHANGE,
|
||||||
|
@ -156,8 +156,9 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
if (insulinChange) {
|
if (insulinChange) {
|
||||||
// add a second for case of both checked
|
// add a second for case of both checked
|
||||||
//uel.log(Action.CAREPORTAL, notes, XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE))
|
uel.log(Action.CAREPORTAL, Sources.FillDialog,
|
||||||
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(TherapyEvent.Type.INSULIN_CHANGE.text, Units.TherapyEvent))
|
notes,
|
||||||
|
XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE))
|
||||||
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
||||||
timestamp = eventTime + 1000,
|
timestamp = eventTime + 1000,
|
||||||
type = TherapyEvent.Type.INSULIN_CHANGE,
|
type = TherapyEvent.Type.INSULIN_CHANGE,
|
||||||
|
|
|
@ -19,8 +19,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
|
@ -191,8 +189,11 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
if (eatingSoonChecked) {
|
if (eatingSoonChecked) {
|
||||||
//uel.log(Action.TT, notes, XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), XXXValueWithUnit.fromGlucoseUnit(eatingSoonTT, units), XXXValueWithUnit.Minute(eatingSoonTTDuration))
|
uel.log(Action.TT, Sources.InsulinDialog,
|
||||||
uel.log(Action.TT, notes, ValueWithUnit(Sources.InsulinDialog), ValueWithUnit(TemporaryTarget.Reason.EATING_SOON.text, Units.TherapyEvent), ValueWithUnit(eatingSoonTT, units), ValueWithUnit(eatingSoonTTDuration, Units.M))
|
notes,
|
||||||
|
XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
|
||||||
|
XXXValueWithUnit.fromGlucoseUnit(eatingSoonTT, units),
|
||||||
|
XXXValueWithUnit.Minute(eatingSoonTTDuration))
|
||||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||||
timestamp = System.currentTimeMillis(),
|
timestamp = System.currentTimeMillis(),
|
||||||
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
|
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
|
||||||
|
@ -214,13 +215,11 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
detailedBolusInfo.notes = notes
|
detailedBolusInfo.notes = notes
|
||||||
detailedBolusInfo.timestamp = time
|
detailedBolusInfo.timestamp = time
|
||||||
if (recordOnlyChecked) {
|
if (recordOnlyChecked) {
|
||||||
//uel.log(Action.BOLUS_RECORD, notes, XXXValueWithUnit.Insulin(insulinAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
|
uel.log(Action.BOLUS, Sources.InsulinDialog,
|
||||||
uel.log(Action.BOLUS, notes,
|
notes,
|
||||||
ValueWithUnit(Sources.InsulinDialog),
|
XXXValueWithUnit.StringResource(R.string.record),
|
||||||
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
|
XXXValueWithUnit.Insulin(insulinAfterConstraints),
|
||||||
ValueWithUnit(R.string.record, Units.R_String),
|
XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
|
||||||
ValueWithUnit(detailedBolusInfo.insulin, Units.U),
|
|
||||||
ValueWithUnit(timeOffset, Units.M, timeOffset != 0))
|
|
||||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
||||||
|
@ -232,9 +231,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||||
} else
|
} else
|
||||||
uel.log(Action.BOLUS, notes,
|
uel.log(Action.BOLUS, Sources.InsulinDialog,
|
||||||
ValueWithUnit(Sources.InsulinDialog),
|
notes,
|
||||||
ValueWithUnit(insulinAfterConstraints, Units.U))
|
XXXValueWithUnit.Insulin(insulinAfterConstraints))
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,8 +15,6 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.databinding.DialogLoopBinding
|
import info.nightscout.androidaps.databinding.DialogLoopBinding
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
|
|
|
@ -11,8 +11,6 @@ import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
|
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
|
|
@ -11,8 +11,6 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
|
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||||
|
@ -130,12 +128,14 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isPercentPump) {
|
if (isPercentPump) {
|
||||||
//uel.log(Action.TEMP_BASAL, XXXValueWithUnit.Percent(percent), XXXValueWithUnit.Minute(durationInMinutes))
|
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
|
||||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(Sources.TempBasalDialog), ValueWithUnit(percent, Units.Percent), ValueWithUnit(durationInMinutes, Units.M))
|
XXXValueWithUnit.Percent(percent),
|
||||||
|
XXXValueWithUnit.Minute(durationInMinutes))
|
||||||
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
|
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
|
||||||
} else {
|
} else {
|
||||||
//uel.log(Action.TEMP_BASAL, XXXValueWithUnit.Insulin(absolute), XXXValueWithUnit.Minute(durationInMinutes))
|
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
|
||||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(Sources.TempBasalDialog), ValueWithUnit(absolute, Units.U), ValueWithUnit(durationInMinutes, Units.M))
|
XXXValueWithUnit.Insulin(absolute),
|
||||||
|
XXXValueWithUnit.Minute(durationInMinutes))
|
||||||
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
|
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,8 +16,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
||||||
|
|
|
@ -16,8 +16,6 @@ import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||||
|
|
|
@ -19,8 +19,7 @@ import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
|
import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
|
||||||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange
|
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange
|
||||||
|
@ -550,7 +549,7 @@ open class LoopPlugin @Inject constructor(
|
||||||
if (request.percent == 100 && request.duration == 0) {
|
if (request.percent == 100 && request.duration == 0) {
|
||||||
if (activeTemp != null) {
|
if (activeTemp != null) {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: cancelTempBasal()")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: cancelTempBasal()")
|
||||||
uel.log(Action.CANCEL_TEMP_BASAL, ValueWithUnit(Sources.Loop))
|
uel.log(Action.CANCEL_TEMP_BASAL, Sources.Loop)
|
||||||
commandQueue.cancelTempBasal(false, callback)
|
commandQueue.cancelTempBasal(false, callback)
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
|
||||||
|
@ -564,14 +563,16 @@ open class LoopPlugin @Inject constructor(
|
||||||
.comment(R.string.let_temp_basal_run))?.run()
|
.comment(R.string.let_temp_basal_run))?.run()
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: tempBasalPercent()")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: tempBasalPercent()")
|
||||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(Sources.Loop), ValueWithUnit(request.percent, Units.Percent), ValueWithUnit(request.duration, Units.M))
|
uel.log(Action.TEMP_BASAL, Sources.Loop,
|
||||||
|
XXXValueWithUnit.Percent(request.percent),
|
||||||
|
XXXValueWithUnit.Minute(request.duration))
|
||||||
commandQueue.tempBasalPercent(request.percent, request.duration, false, profile!!, callback)
|
commandQueue.tempBasalPercent(request.percent, request.duration, false, profile!!, callback)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (request.rate == 0.0 && request.duration == 0 || abs(request.rate - pump.baseBasalRate) < pump.pumpDescription.basalStep) {
|
if (request.rate == 0.0 && request.duration == 0 || abs(request.rate - pump.baseBasalRate) < pump.pumpDescription.basalStep) {
|
||||||
if (activeTemp != null) {
|
if (activeTemp != null) {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: cancelTempBasal()")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: cancelTempBasal()")
|
||||||
uel.log(Action.CANCEL_TEMP_BASAL, ValueWithUnit(Sources.Loop))
|
uel.log(Action.CANCEL_TEMP_BASAL, Sources.Loop)
|
||||||
commandQueue.cancelTempBasal(false, callback)
|
commandQueue.cancelTempBasal(false, callback)
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
|
||||||
|
@ -585,7 +586,9 @@ open class LoopPlugin @Inject constructor(
|
||||||
.comment(R.string.let_temp_basal_run))?.run()
|
.comment(R.string.let_temp_basal_run))?.run()
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: setTempBasalAbsolute()")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: setTempBasalAbsolute()")
|
||||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(Sources.Loop), ValueWithUnit(request.rate, Units.U_H), ValueWithUnit(request.duration, Units.M))
|
uel.log(Action.TEMP_BASAL, Sources.Loop,
|
||||||
|
XXXValueWithUnit.UnitPerHour(request.rate),
|
||||||
|
XXXValueWithUnit.Minute(request.duration))
|
||||||
commandQueue.tempBasalAbsolute(request.rate, request.duration, false, profile!!, callback)
|
commandQueue.tempBasalAbsolute(request.rate, request.duration, false, profile!!, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +628,7 @@ open class LoopPlugin @Inject constructor(
|
||||||
detailedBolusInfo.deliverAtTheLatest = request.deliverAt
|
detailedBolusInfo.deliverAtTheLatest = request.deliverAt
|
||||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: bolus()")
|
aapsLogger.debug(LTag.APS, "applyAPSRequest: bolus()")
|
||||||
if (request.smb > 0.0)
|
if (request.smb > 0.0)
|
||||||
uel.log(Action.SMB, ValueWithUnit(Sources.Loop), ValueWithUnit(detailedBolusInfo.insulin, Units.U))
|
uel.log(Action.SMB, Sources.Loop, XXXValueWithUnit.Insulin(detailedBolusInfo.insulin))
|
||||||
commandQueue.bolus(detailedBolusInfo, callback)
|
commandQueue.bolus(detailedBolusInfo, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.InsertOrUpdateBolusCalculatorResultTransaction
|
import info.nightscout.androidaps.database.transactions.InsertOrUpdateBolusCalculatorResultTransaction
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
|
|
Loading…
Reference in a new issue