prepare Profile interface
This commit is contained in:
parent
430a871993
commit
cada2919d1
139 changed files with 3692 additions and 602 deletions
|
@ -14,7 +14,7 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.text.TextWatcher
|
|||
import android.view.Menu
|
||||
import android.widget.PopupMenu
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.defaultProfile.DefaultProfile
|
||||
import info.nightscout.androidaps.data.defaultProfile.DefaultProfileDPV
|
||||
import info.nightscout.androidaps.databinding.ActivityProfilehelperBinding
|
||||
|
@ -212,9 +212,9 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
|||
pvd.arguments = Bundle().also {
|
||||
it.putLong("time", dateUtil.now())
|
||||
it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal)
|
||||
it.putString("customProfile", profile0.data.toString())
|
||||
it.putString("customProfile2", profile1.data.toString())
|
||||
it.putString("customProfileUnits", profileFunction.getUnits())
|
||||
it.putString("customProfile", profile0.toNsJson().toString())
|
||||
it.putString("customProfile2", profile1.toNsJson().toString())
|
||||
it.putString("customProfileUnits", profileFunction.getUnits().asText)
|
||||
it.putString("customProfileName", getProfileName(ageUsed[0], tddUsed[0], weightUsed[0], pctUsed[0] / 100.0, 0) + "\n" + getProfileName(ageUsed[1], tddUsed[1], weightUsed[1], pctUsed[1] / 100.0, 1))
|
||||
}
|
||||
}.show(supportFragmentManager, "ProfileViewDialog")
|
||||
|
|
|
@ -71,9 +71,9 @@ class SurveyActivity : NoSplashAppCompatActivity() {
|
|||
pvd.arguments = Bundle().also {
|
||||
it.putLong("time", dateUtil.now())
|
||||
it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal)
|
||||
it.putString("customProfile", runningProfile.data.toString())
|
||||
it.putString("customProfile2", profile.data.toString())
|
||||
it.putString("customProfileUnits", profile.units)
|
||||
it.putString("customProfile", runningProfile.toNsJson().toString())
|
||||
it.putString("customProfile2", profile.toNsJson().toString())
|
||||
it.putString("customProfileUnits", profile.units.asText)
|
||||
it.putString("customProfileName", "Age: $age TDD: $tdd Weight: $weight")
|
||||
}
|
||||
}.show(supportFragmentManager, "ProfileViewDialog")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package info.nightscout.androidaps.data.defaultProfile
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.data.ProfileImplOld
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
@ -17,7 +19,7 @@ class DefaultProfile @Inject constructor(val injector: HasAndroidInjector) {
|
|||
var twelveToSeventeen: TreeMap<Double, Array<Double>> = TreeMap()
|
||||
var eighteenToTwentyfor: TreeMap<Double, Array<Double>> = TreeMap()
|
||||
|
||||
fun profile(age: Double, tdd: Double, weight: Double, units: String): Profile? {
|
||||
fun profile(age: Double, tdd: Double, weight: Double, units: GlucoseUnit): Profile? {
|
||||
val profile = JSONObject()
|
||||
if (age >= 1 && age < 6) {
|
||||
val _tdd = if (tdd == 0.0) 0.6 * weight else tdd
|
||||
|
@ -50,7 +52,7 @@ class DefaultProfile @Inject constructor(val injector: HasAndroidInjector) {
|
|||
profile.put("target_high", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
|
||||
profile.put("target_low", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
|
||||
profile.put("units", units)
|
||||
return Profile(injector, profile, units)
|
||||
return ProfileImplOld(injector, profile, units)
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -148,7 +150,7 @@ class DefaultProfile @Inject constructor(val injector: HasAndroidInjector) {
|
|||
return array
|
||||
}
|
||||
|
||||
private fun singleValueArrayFromMmolToUnits(value: Double, sample: Array<Double>, units: String): JSONArray {
|
||||
private fun singleValueArrayFromMmolToUnits(value: Double, sample: Array<Double>, units: GlucoseUnit): JSONArray {
|
||||
val array = JSONArray()
|
||||
array.put(JSONObject().put("time", "00:00").put("value", Profile.fromMmolToUnits(value + sample[0],units)).put("timeAsSeconds", 0 * 3600))
|
||||
array.put(JSONObject().put("time", "06:00").put("value", Profile.fromMmolToUnits(value + sample[1],units)).put("timeAsSeconds", 6 * 3600))
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package info.nightscout.androidaps.data.defaultProfile
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.data.ProfileImplOld
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.util.*
|
||||
|
@ -16,7 +17,7 @@ class DefaultProfileDPV @Inject constructor(val injector: HasAndroidInjector) {
|
|||
var sixToEleven = arrayOf(4.20, 4.27, 4.41, 4.62, 4.92, 5.09, 5.01, 4.47, 3.89, 3.33, 3.10, 2.91, 2.97, 3.08, 3.36, 3.93, 4.52, 4.76, 4.69, 4.63, 4.63, 4.47, 4.47, 4.31)
|
||||
var twelveToEighteen = arrayOf(3.47, 3.80, 4.31, 4.95, 5.59, 6.11, 5.89, 5.11, 4.31, 3.78, 3.55, 3.39, 3.35, 3.39, 3.64, 3.97, 4.53, 4.59, 4.50, 4.00, 3.69, 3.39, 3.35, 3.35)
|
||||
|
||||
fun profile(age: Double, tdd: Double, basalSumPct: Double, units: String): Profile? {
|
||||
fun profile(age: Double, tdd: Double, basalSumPct: Double, units: GlucoseUnit): Profile? {
|
||||
val basalSum = tdd * basalSumPct
|
||||
val profile = JSONObject()
|
||||
if (age >= 1 && age < 6) {
|
||||
|
@ -41,7 +42,7 @@ class DefaultProfileDPV @Inject constructor(val injector: HasAndroidInjector) {
|
|||
profile.put("target_high", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
|
||||
profile.put("target_low", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
|
||||
profile.put("units", units)
|
||||
return Profile(injector, profile, units)
|
||||
return ProfileImplOld(injector, profile, units)
|
||||
}
|
||||
|
||||
private fun arrayToJson(b: Array<Double>, basalSum: Double): JSONArray {
|
||||
|
@ -59,7 +60,7 @@ class DefaultProfileDPV @Inject constructor(val injector: HasAndroidInjector) {
|
|||
return array
|
||||
}
|
||||
|
||||
private fun singleValueArrayFromMmolToUnits(value: Double, units: String): JSONArray {
|
||||
private fun singleValueArrayFromMmolToUnits(value: Double, units: GlucoseUnit): JSONArray {
|
||||
val array = JSONArray()
|
||||
array.put(JSONObject().put("time", "00:00").put("value", Profile.fromMmolToUnits(value, units)).put("timeAsSeconds", 0 * 3600))
|
||||
return array
|
||||
|
|
|
@ -21,9 +21,7 @@ import org.json.JSONObject;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
@ -32,13 +30,12 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import info.nightscout.androidaps.dana.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.events.EventReloadProfileSwitchData;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.interfaces.ProfileSource;
|
||||
import info.nightscout.androidaps.interfaces.ProfileStore;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
|
@ -802,7 +799,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
if (store != null) {
|
||||
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
|
||||
if (profile != null) {
|
||||
profileSwitch.profileJson = profile.getData().toString();
|
||||
profileSwitch.profileJson = profile.toNsJson().toString();
|
||||
aapsLogger.debug(LTag.DATABASE, "Profile switch prefilled with JSON from local store");
|
||||
// Update data in NS
|
||||
nsUpload.updateProfileSwitch(profileSwitch, dateUtil);
|
||||
|
|
|
@ -7,7 +7,7 @@ import dagger.android.AndroidInjector
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.automation.di.AutomationModule
|
||||
import info.nightscout.androidaps.combo.di.ComboModule
|
||||
import info.nightscout.androidaps.core.di.CoreModule
|
||||
import info.nightscout.androidaps.di.CoreModule
|
||||
import info.nightscout.androidaps.dana.di.DanaModule
|
||||
import info.nightscout.androidaps.danar.di.DanaRModule
|
||||
import info.nightscout.androidaps.danars.di.DanaRSModule
|
||||
|
|
|
@ -8,11 +8,12 @@ import com.google.common.base.Joiner
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.databinding.DialogCalibrationBinding
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
|
@ -57,13 +58,13 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
|||
val units = profileFunction.getUnits()
|
||||
val bg = Profile.fromMgdlToUnits(glucoseStatusProvider.glucoseStatusData?.glucose
|
||||
?: 0.0, units)
|
||||
if (units == Constants.MMOL)
|
||||
if (units == GlucoseUnit.MMOL)
|
||||
binding.bg.setParams(savedInstanceState?.getDouble("bg")
|
||||
?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, binding.okcancel.ok)
|
||||
else
|
||||
binding.bg.setParams(savedInstanceState?.getDouble("bg")
|
||||
?: bg, 36.0, 500.0, 1.0, DecimalFormat("0"), false, binding.okcancel.ok)
|
||||
binding.units.text = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
binding.units.text = if (units == GlucoseUnit.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -74,14 +75,14 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
|||
override fun submit(): Boolean {
|
||||
if (_binding == null) return false
|
||||
val units = profileFunction.getUnits()
|
||||
val unitLabel = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val unitLabel = if (units == GlucoseUnit.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val actions: LinkedList<String?> = LinkedList()
|
||||
val bg = binding.bg.value ?: return false
|
||||
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, bg) + " " + unitLabel)
|
||||
if (bg > 0) {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
uel.log(Action.CALIBRATION, Sources.CalibrationDialog, ValueWithUnit.fromGlucoseUnit(bg, units))
|
||||
uel.log(Action.CALIBRATION, Sources.CalibrationDialog, ValueWithUnit.fromGlucoseUnit(bg, units.asText))
|
||||
xdripCalibrations.sendIntent(bg)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAnd
|
|||
import info.nightscout.androidaps.databinding.DialogCarbsBinding
|
||||
import info.nightscout.androidaps.extensions.formatColor
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -184,7 +185,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
val hypoTTDuration = defaultValueHelper.determineHypoTTDuration()
|
||||
val hypoTT = defaultValueHelper.determineHypoTT()
|
||||
val actions: LinkedList<String?> = LinkedList()
|
||||
val unitLabel = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val unitLabel = if (units == GlucoseUnit.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val useAlarm = binding.alarmCheckBox.isChecked
|
||||
|
||||
val activitySelected = binding.activityTt.isChecked
|
||||
|
@ -226,7 +227,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
activitySelected -> {
|
||||
uel.log(Action.TT, Sources.CarbDialog,
|
||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY),
|
||||
ValueWithUnit.fromGlucoseUnit(activityTT, units),
|
||||
ValueWithUnit.fromGlucoseUnit(activityTT, units.asText),
|
||||
ValueWithUnit.Minute(activityTTDuration))
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
@ -245,7 +246,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
eatingSoonSelected -> {
|
||||
uel.log(Action.TT, Sources.CarbDialog,
|
||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
|
||||
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units),
|
||||
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units.asText),
|
||||
ValueWithUnit.Minute(eatingSoonTTDuration))
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
@ -264,7 +265,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
hypoSelected -> {
|
||||
uel.log(Action.TT, Sources.CarbDialog,
|
||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA),
|
||||
ValueWithUnit.fromGlucoseUnit(hypoTT, units),
|
||||
ValueWithUnit.fromGlucoseUnit(hypoTT, units.asText),
|
||||
ValueWithUnit.Minute(hypoTTDuration))
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.google.common.base.Joiner
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.utils.T
|
|||
import info.nightscout.androidaps.utils.Translator
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.extensions.fromConstant
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
@ -151,7 +152,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
}
|
||||
|
||||
if (profileFunction.getUnits() == Constants.MMOL) {
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
binding.bgunits.text = resourceHelper.gs(R.string.mmol)
|
||||
binding.bg.setParams(savedInstanceState?.getDouble("bg")
|
||||
?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, binding.okcancel.ok, bgTextWatcher)
|
||||
|
@ -173,7 +174,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
|
||||
override fun submit(): Boolean {
|
||||
val enteredBy = sp.getString("careportal_enteredby", "AndroidAPS")
|
||||
val unitResId = if (profileFunction.getUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
||||
val unitResId = if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol
|
||||
|
||||
eventTime -= eventTime % 1000
|
||||
|
||||
|
@ -203,7 +204,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + resourceHelper.gs(unitResId))
|
||||
therapyEvent.glucoseType = meterType
|
||||
therapyEvent.glucose = binding.bg.value
|
||||
valuesWithUnit.add(ValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
||||
valuesWithUnit.add(ValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits().asText))
|
||||
valuesWithUnit.add(ValueWithUnit.TherapyEventMeterType(meterType))
|
||||
}
|
||||
if (options == EventType.NOTE || options == EventType.EXERCISE) {
|
||||
|
|
|
@ -8,12 +8,10 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
|
@ -21,10 +19,6 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action
|
|||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
|
@ -34,6 +28,7 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|||
import info.nightscout.androidaps.extensions.formatColor
|
||||
import info.nightscout.androidaps.utils.extensions.toSignedString
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
@ -158,7 +153,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(insulin)).value()
|
||||
val actions: LinkedList<String?> = LinkedList()
|
||||
val units = profileFunction.getUnits()
|
||||
val unitLabel = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val unitLabel = if (units == GlucoseUnit.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
val recordOnlyChecked = binding.recordOnly.isChecked
|
||||
val eatingSoonChecked = binding.startEatingSoonTt.isChecked
|
||||
|
||||
|
@ -190,7 +185,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
uel.log(Action.TT, Sources.InsulinDialog,
|
||||
notes,
|
||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
|
||||
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units),
|
||||
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units.asText),
|
||||
ValueWithUnit.Minute(eatingSoonTTDuration))
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
|
|
@ -71,7 +71,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
?: 100.0, 0.0, maxTempPercent, tempPercentStep, DecimalFormat("0"), true, binding.okcancel.ok)
|
||||
|
||||
binding.basalabsoluteinput.setParams(savedInstanceState?.getDouble("basalabsoluteinput")
|
||||
?: profile.basal, 0.0, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, DecimalFormat("0.00"), true, binding.okcancel.ok)
|
||||
?: profile.getBasal(), 0.0, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, DecimalFormat("0.00"), true, binding.okcancel.ok)
|
||||
|
||||
val tempDurationStep = pumpDescription.tempDurationStep.toDouble()
|
||||
val tempMaxDuration = pumpDescription.tempMaxDuration.toDouble()
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.google.common.base.Joiner
|
|||
import com.google.common.collect.Lists
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
|||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -72,7 +73,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
binding.duration.setParams(savedInstanceState?.getDouble("duration")
|
||||
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, binding.okcancel.ok)
|
||||
|
||||
if (profileFunction.getUnits() == Constants.MMOL)
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL)
|
||||
binding.temptarget.setParams(
|
||||
savedInstanceState?.getDouble("tempTarget")
|
||||
?: 8.0,
|
||||
|
@ -84,7 +85,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
Constants.MIN_TT_MGDL, Constants.MAX_TT_MGDL, 1.0, DecimalFormat("0"), false, binding.okcancel.ok)
|
||||
|
||||
val units = profileFunction.getUnits()
|
||||
binding.units.text = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
binding.units.text = if (units == GlucoseUnit.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl)
|
||||
|
||||
// temp target
|
||||
context?.let { context ->
|
||||
|
@ -163,7 +164,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
if (_binding == null) return false
|
||||
val actions: LinkedList<String> = LinkedList()
|
||||
var reason = binding.reason.selectedItem?.toString() ?: return false
|
||||
val unitResId = if (profileFunction.getUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
||||
val unitResId = if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol
|
||||
val target = binding.temptarget.value
|
||||
val duration = binding.duration.value.toInt()
|
||||
if (target != 0.0 && duration != 0) {
|
||||
|
@ -181,10 +182,10 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
val units = profileFunction.getUnits()
|
||||
when(reason) {
|
||||
resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.CUSTOM), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.CUSTOM), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
|
||||
resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
||||
}
|
||||
if (target == 0.0 || duration == 0) {
|
||||
|
|
|
@ -18,15 +18,10 @@ import dagger.android.HasAndroidInjector
|
|||
import dagger.android.support.DaggerDialogFragment
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.databinding.DialogWizardBinding
|
||||
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
@ -38,6 +33,7 @@ import info.nightscout.androidaps.utils.SafeParse
|
|||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.extensions.valueToUnits
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -128,7 +124,7 @@ class WizardDialog : DaggerDialogFragment() {
|
|||
val maxCarbs = constraintChecker.getMaxCarbsAllowed().value()
|
||||
val maxCorrection = constraintChecker.getMaxBolusAllowed().value()
|
||||
|
||||
if (profileFunction.getUnits() == Constants.MGDL)
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MGDL)
|
||||
binding.bgInput.setParams(savedInstanceState?.getDouble("bg_input")
|
||||
?: 0.0, 0.0, 500.0, 1.0, DecimalFormat("0"), false, binding.ok, timeTextWatcher)
|
||||
else
|
||||
|
@ -260,8 +256,8 @@ class WizardDialog : DaggerDialogFragment() {
|
|||
} ?: return
|
||||
|
||||
val units = profileFunction.getUnits()
|
||||
binding.bgunits.text = units
|
||||
if (units == Constants.MGDL)
|
||||
binding.bgunits.text = units.asText
|
||||
if (units == GlucoseUnit.MGDL)
|
||||
binding.bgInput.setStep(1.0)
|
||||
else
|
||||
binding.bgInput.setStep(0.1)
|
||||
|
@ -333,7 +329,7 @@ class WizardDialog : DaggerDialogFragment() {
|
|||
binding.notes.text.toString(), carbTime)
|
||||
|
||||
wizard?.let { wizard ->
|
||||
binding.bg.text = String.format(resourceHelper.gs(R.string.format_bg_isf), valueToUnitsToString(Profile.toMgdl(bg, profileFunction.getUnits()), profileFunction.getUnits()), wizard.sens)
|
||||
binding.bg.text = String.format(resourceHelper.gs(R.string.format_bg_isf), valueToUnitsToString(Profile.toMgdl(bg, profileFunction.getUnits()), profileFunction.getUnits().asText), wizard.sens)
|
||||
binding.bginsulin.text = resourceHelper.gs(R.string.formatinsulinunits, wizard.insulinFromBG)
|
||||
|
||||
binding.carbs.text = String.format(resourceHelper.gs(R.string.format_carbs_ic), carbs.toDouble(), wizard.ic)
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.WindowManager
|
|||
import dagger.android.support.DaggerDialogFragment
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.androidaps.databinding.DialogWizardinfoBinding
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.*
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
|
@ -292,7 +292,7 @@ open class LoopPlugin @Inject constructor(
|
|||
if (pump.pumpDescription.tempBasalStyle == PumpDescription.PERCENT && allowPercentage()) {
|
||||
apsResult.usePercent = true
|
||||
}
|
||||
apsResult.percent = (apsResult.rate / profile.basal * 100).toInt()
|
||||
apsResult.percent = (apsResult.rate / profile.getBasal() * 100).toInt()
|
||||
|
||||
// check rate for constraints
|
||||
val resultAfterConstraints = apsResult.newAndClone(injector)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.aps.openAPSAMA
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.MealData
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.getPassedDurationToTimeInMinutes
|
||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -162,13 +162,13 @@ class DetermineBasalAdapterAMAJS internal constructor(scriptReader: ScriptReader
|
|||
this.profile.put("max_iob", maxIob)
|
||||
this.profile.put("dia", min(profile.dia, 3.0))
|
||||
this.profile.put("type", "current")
|
||||
this.profile.put("max_daily_basal", profile.maxDailyBasal)
|
||||
this.profile.put("max_daily_basal", profile.getMaxDailyBasal())
|
||||
this.profile.put("max_basal", maxBasal)
|
||||
this.profile.put("min_bg", minBg)
|
||||
this.profile.put("max_bg", maxBg)
|
||||
this.profile.put("target_bg", targetBg)
|
||||
this.profile.put("carb_ratio", profile.ic)
|
||||
this.profile.put("sens", profile.isfMgdl)
|
||||
this.profile.put("carb_ratio", profile.getIc())
|
||||
this.profile.put("sens", profile.getIsfMgdl())
|
||||
this.profile.put("max_daily_safety_multiplier", sp.getInt(R.string.key_openapsama_max_daily_safety_multiplier, 3))
|
||||
this.profile.put("current_basal_safety_multiplier", sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0))
|
||||
this.profile.put("skip_neutral_temps", true)
|
||||
|
@ -181,7 +181,7 @@ class DetermineBasalAdapterAMAJS internal constructor(scriptReader: ScriptReader
|
|||
} else {
|
||||
this.profile.put("min_5m_carbimpact", sp.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact))
|
||||
}
|
||||
if (profileFunction.getUnits() == Constants.MMOL) {
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
this.profile.put("out_units", "mmol/L")
|
||||
}
|
||||
val now = System.currentTimeMillis()
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.aps.openAPSAMA
|
|||
import android.content.Context
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
|
@ -112,9 +112,9 @@ open class OpenAPSAMAPlugin @Inject constructor(
|
|||
val maxIob = constraintChecker.getMaxIOBAllowed().also { maxIOBAllowedConstraint ->
|
||||
inputConstraints.copyReasons(maxIOBAllowedConstraint)
|
||||
}.value()
|
||||
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.targetLowMgdl, 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
|
||||
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.targetHighMgdl, 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
|
||||
var targetBg = hardLimits.verifyHardLimits(profile.targetMgdl, R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
|
||||
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
|
||||
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
|
||||
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
|
||||
var isTempTarget = false
|
||||
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
|
||||
if (tempTarget is ValueWrapper.Existing) {
|
||||
|
@ -125,8 +125,8 @@ open class OpenAPSAMAPlugin @Inject constructor(
|
|||
}
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.dia, R.string.profile_dia, hardLimits.minDia(), hardLimits.maxDia())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), R.string.profile_carbs_ratio_value, hardLimits.minIC(), hardLimits.maxIC())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.isfMgdl, R.string.profile_sensitivity_value, HardLimits.MIN_ISF, HardLimits.MAX_ISF)) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.maxDailyBasal, R.string.profile_max_daily_basal_value, 0.02, hardLimits.maxBasal())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), R.string.profile_sensitivity_value, HardLimits.MIN_ISF, HardLimits.MAX_ISF)) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getMaxDailyBasal(), R.string.profile_max_daily_basal_value, 0.02, hardLimits.maxBasal())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(pump.baseBasalRate, R.string.current_basal_value, 0.01, hardLimits.maxBasal())) return
|
||||
startPart = System.currentTimeMillis()
|
||||
if (constraintChecker.isAutosensModeEnabled().value()) {
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.aps.openAPSSMB
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.MealData
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.getPassedDurationToTimeInMinutes
|
||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -17,9 +20,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.utils.SafeParse
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.getPassedDurationToTimeInMinutes
|
||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.json.JSONArray
|
||||
|
@ -180,13 +180,13 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader:
|
|||
this.profile.put("max_iob", maxIob)
|
||||
//mProfile.put("dia", profile.getDia());
|
||||
this.profile.put("type", "current")
|
||||
this.profile.put("max_daily_basal", profile.maxDailyBasal)
|
||||
this.profile.put("max_daily_basal", profile.getMaxDailyBasal())
|
||||
this.profile.put("max_basal", maxBasal)
|
||||
this.profile.put("min_bg", minBg)
|
||||
this.profile.put("max_bg", maxBg)
|
||||
this.profile.put("target_bg", targetBg)
|
||||
this.profile.put("carb_ratio", profile.ic)
|
||||
this.profile.put("sens", profile.isfMgdl)
|
||||
this.profile.put("carb_ratio", profile.getIc())
|
||||
this.profile.put("sens", profile.getIsfMgdl())
|
||||
this.profile.put("max_daily_safety_multiplier", sp.getInt(R.string.key_openapsama_max_daily_safety_multiplier, 3))
|
||||
this.profile.put("current_basal_safety_multiplier", sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0))
|
||||
|
||||
|
@ -225,7 +225,7 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader:
|
|||
this.profile.put("current_basal", basalRate)
|
||||
this.profile.put("temptargetSet", tempTargetSet)
|
||||
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(R.string.key_openapsama_autosens_max, "1.2")))
|
||||
if (profileFunction.getUnits() == Constants.MMOL) {
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
this.profile.put("out_units", "mmol/L")
|
||||
}
|
||||
val now = System.currentTimeMillis()
|
||||
|
|
|
@ -5,9 +5,9 @@ import androidx.preference.PreferenceFragmentCompat
|
|||
import androidx.preference.SwitchPreference
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.extensions.target
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -22,7 +22,6 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.HardLimits
|
||||
import info.nightscout.androidaps.utils.Profiler
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.extensions.target
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import javax.inject.Inject
|
||||
|
@ -118,9 +117,9 @@ open class OpenAPSSMBPlugin @Inject constructor(
|
|||
inputConstraints.copyReasons(maxIOBAllowedConstraint)
|
||||
}.value()
|
||||
|
||||
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.targetLowMgdl, 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
|
||||
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.targetHighMgdl, 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
|
||||
var targetBg = hardLimits.verifyHardLimits(profile.targetMgdl, R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
|
||||
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
|
||||
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
|
||||
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
|
||||
var isTempTarget = false
|
||||
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
|
||||
if (tempTarget is ValueWrapper.Existing) {
|
||||
|
@ -131,8 +130,8 @@ open class OpenAPSSMBPlugin @Inject constructor(
|
|||
}
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.dia, R.string.profile_dia, hardLimits.minDia(), hardLimits.maxDia())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), R.string.profile_carbs_ratio_value, hardLimits.minIC(), hardLimits.maxIC())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.isfMgdl, R.string.profile_sensitivity_value, HardLimits.MIN_ISF, HardLimits.MAX_ISF)) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.maxDailyBasal, R.string.profile_max_daily_basal_value, 0.02, hardLimits.maxBasal())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), R.string.profile_sensitivity_value, HardLimits.MIN_ISF, HardLimits.MAX_ISF)) return
|
||||
if (!hardLimits.checkOnlyHardLimits(profile.getMaxDailyBasal(), R.string.profile_max_daily_basal_value, 0.02, hardLimits.maxBasal())) return
|
||||
if (!hardLimits.checkOnlyHardLimits(pump.baseBasalRate, R.string.current_basal_value, 0.01, hardLimits.maxBasal())) return
|
||||
startPart = System.currentTimeMillis()
|
||||
if (constraintChecker.isAutosensModeEnabled().value()) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.constraints.safety
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||
|
@ -108,18 +108,18 @@ class SafetyPlugin @Inject constructor(
|
|||
absoluteRate.setIfGreater(aapsLogger, 0.0, String.format(resourceHelper.gs(R.string.limitingbasalratio), 0.0, resourceHelper.gs(R.string.itmustbepositivevalue)), this)
|
||||
if (config.APS) {
|
||||
var maxBasal = sp.getDouble(R.string.key_openapsma_max_basal, 1.0)
|
||||
if (maxBasal < profile.maxDailyBasal) {
|
||||
maxBasal = profile.maxDailyBasal
|
||||
if (maxBasal < profile.getMaxDailyBasal()) {
|
||||
maxBasal = profile.getMaxDailyBasal()
|
||||
absoluteRate.addReason(resourceHelper.gs(R.string.increasingmaxbasal), this)
|
||||
}
|
||||
absoluteRate.setIfSmaller(aapsLogger, maxBasal, String.format(resourceHelper.gs(R.string.limitingbasalratio), maxBasal, resourceHelper.gs(R.string.maxvalueinpreferences)), this)
|
||||
|
||||
// Check percentRate but absolute rate too, because we know real current basal in pump
|
||||
val maxBasalMultiplier = sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)
|
||||
val maxFromBasalMultiplier = floor(maxBasalMultiplier * profile.basal * 100) / 100
|
||||
val maxFromBasalMultiplier = floor(maxBasalMultiplier * profile.getBasal() * 100) / 100
|
||||
absoluteRate.setIfSmaller(aapsLogger, maxFromBasalMultiplier, String.format(resourceHelper.gs(R.string.limitingbasalratio), maxFromBasalMultiplier, resourceHelper.gs(R.string.maxbasalmultiplier)), this)
|
||||
val maxBasalFromDaily = sp.getDouble(R.string.key_openapsama_max_daily_safety_multiplier, 3.0)
|
||||
val maxFromDaily = floor(profile.maxDailyBasal * maxBasalFromDaily * 100) / 100
|
||||
val maxFromDaily = floor(profile.getMaxDailyBasal() * maxBasalFromDaily * 100) / 100
|
||||
absoluteRate.setIfSmaller(aapsLogger, maxFromDaily, String.format(resourceHelper.gs(R.string.limitingbasalratio), maxFromDaily, resourceHelper.gs(R.string.maxdailybasalmultiplier)), this)
|
||||
}
|
||||
absoluteRate.setIfSmaller(aapsLogger, hardLimits.maxBasal(), String.format(resourceHelper.gs(R.string.limitingbasalratio), hardLimits.maxBasal(), resourceHelper.gs(R.string.hardlimit)), this)
|
||||
|
@ -138,7 +138,7 @@ class SafetyPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> {
|
||||
val currentBasal = profile.basal
|
||||
val currentBasal = profile.getBasal()
|
||||
val absoluteRate = currentBasal * (percentRate.originalValue().toDouble() / 100)
|
||||
percentRate.addReason("Percent rate " + percentRate.originalValue() + "% recalculated to " + DecimalFormatter.to2Decimal(absoluteRate) + " U/h with current basal " + DecimalFormatter.to2Decimal(currentBasal) + " U/h", this)
|
||||
val absoluteConstraint = Constraint(absoluteRate)
|
||||
|
|
|
@ -124,7 +124,7 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
|
||||
bundle.putDouble("glucoseMgdl", lastBG.value) // last BG in mgdl
|
||||
bundle.putLong("glucoseTimeStamp", lastBG.timestamp) // timestamp
|
||||
bundle.putString("units", profileFunction.getUnits()) // units used in AAPS "mg/dl" or "mmol"
|
||||
bundle.putString("units", profileFunction.getUnits().asText) // units used in AAPS "mg/dl" or "mmol"
|
||||
bundle.putString("slopeArrow", lastBG.trendArrow.text) // direction arrow as string
|
||||
bundle.putDouble("deltaMgdl", glucoseStatus.delta) // bg delta in mgdl
|
||||
bundle.putDouble("avgDeltaMgdl", glucoseStatus.shortAvgDelta) // average bg delta
|
||||
|
@ -175,7 +175,7 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
val now = System.currentTimeMillis()
|
||||
val profile = profileFunction.getProfile() ?: return
|
||||
bundle.putLong("basalTimeStamp", now)
|
||||
bundle.putDouble("baseBasal", profile.basal)
|
||||
bundle.putDouble("baseBasal", profile.getBasal())
|
||||
bundle.putString("profile", profileFunction.getProfileName())
|
||||
iobCobCalculator.getTempBasalIncludingConvertedExtended(now)?.let {
|
||||
bundle.putLong("tempBasalStart", it.timestamp)
|
||||
|
|
|
@ -27,7 +27,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
|
@ -682,29 +682,29 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (tempTarget is ValueWrapper.Existing) {
|
||||
binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning))
|
||||
binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonWarning))
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(tempTarget.value.lowTarget, tempTarget.value.highTarget, Constants.MGDL, units) + " " + dateUtil.untilString(tempTarget.value.end, resourceHelper)
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(tempTarget.value.lowTarget, tempTarget.value.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.value.end, resourceHelper)
|
||||
} else {
|
||||
// If the target is not the same as set in the profile then oref has overridden it
|
||||
val targetUsed = lastRun?.constraintsProcessed?.targetBG ?: 0.0
|
||||
|
||||
if (targetUsed != 0.0 && abs(profile.targetMgdl - targetUsed) > 0.01) {
|
||||
aapsLogger.debug("Adjusted target. Profile: ${profile.targetMgdl} APS: $targetUsed")
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, Constants.MGDL, units)
|
||||
if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) {
|
||||
aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed")
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units)
|
||||
binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning))
|
||||
binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.tempTargetBackground))
|
||||
} else {
|
||||
binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault))
|
||||
binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault))
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(profile.targetLowMgdl, profile.targetHighMgdl, Constants.MGDL, units)
|
||||
binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units)
|
||||
}
|
||||
}
|
||||
|
||||
// Basal, TBR
|
||||
val activeTemp = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())
|
||||
binding.infoLayout.baseBasal.text = activeTemp?.let { "T:" + activeTemp.toStringShort() }
|
||||
?: resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)
|
||||
?: resourceHelper.gs(R.string.pump_basebasalrate, profile.getBasal())
|
||||
binding.infoLayout.basalLayout.setOnClickListener {
|
||||
var fullText = "${resourceHelper.gs(R.string.basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}"
|
||||
var fullText = "${resourceHelper.gs(R.string.basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.getBasal())}"
|
||||
if (activeTemp != null)
|
||||
fullText += "\n" + resourceHelper.gs(R.string.tempbasal_label) + ": " + activeTemp.toStringFull(profile, dateUtil)
|
||||
activity?.let {
|
||||
|
|
|
@ -12,7 +12,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
|
@ -53,7 +53,7 @@ class GraphData(
|
|||
var maxY = Double.MIN_VALUE
|
||||
private var minY = Double.MAX_VALUE
|
||||
private var bgReadingsArray: List<GlucoseValue>? = null
|
||||
private val units: String
|
||||
private val units: GlucoseUnit
|
||||
private val series: MutableList<Series<*>> = ArrayList()
|
||||
|
||||
init {
|
||||
|
@ -80,7 +80,7 @@ class GraphData(
|
|||
bgReadingsArray = repository.compatGetBgReadingsDataFromTime(fromTime, toTime, false).blockingGet()
|
||||
if (bgReadingsArray?.isEmpty() != false) {
|
||||
aapsLogger.debug("No BG data.")
|
||||
maxY = if (units == Constants.MGDL) 180.0 else 10.0
|
||||
maxY = if (units == GlucoseUnit.MGDL) 180.0 else 10.0
|
||||
minY = 0.0
|
||||
return
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ class GraphData(
|
|||
}
|
||||
|
||||
internal fun setNumVerticalLabels() {
|
||||
graph.gridLabelRenderer.numVerticalLabels = if (units == Constants.MGDL) (maxY / 40 + 1).toInt() else (maxY / 2 + 1).toInt()
|
||||
graph.gridLabelRenderer.numVerticalLabels = if (units == GlucoseUnit.MGDL) (maxY / 40 + 1).toInt() else (maxY / 2 + 1).toInt()
|
||||
}
|
||||
|
||||
private fun addUpperChartMargin(maxBgValue: Double) =
|
||||
if (units == Constants.MGDL) Round.roundTo(maxBgValue, 40.0) + 80 else Round.roundTo(maxBgValue, 2.0) + 4
|
||||
if (units == GlucoseUnit.MGDL) Round.roundTo(maxBgValue, 40.0) + 80 else Round.roundTo(maxBgValue, 2.0) + 4
|
||||
|
||||
fun addInRangeArea(fromTime: Long, toTime: Long, lowLine: Double, highLine: Double) {
|
||||
val inRangeAreaSeries: AreaGraphSeries<DoubleDataPoint>
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -15,8 +16,8 @@ class GlucoseValueDataPoint @Inject constructor(
|
|||
private val resourceHelper: ResourceHelper
|
||||
) : DataPointWithLabelInterface {
|
||||
|
||||
fun valueToUnits(units: String): Double =
|
||||
if (units == Constants.MGDL) data.value else data.value * Constants.MGDL_TO_MMOLL
|
||||
fun valueToUnits(units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) data.value else data.value * Constants.MGDL_TO_MMOLL
|
||||
|
||||
override fun getX(): Double {
|
||||
return data.timestamp.toDouble()
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.data.InMemoryGlucoseValue
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
@ -13,8 +14,8 @@ class InMemoryGlucoseValueDataPoint @Inject constructor(
|
|||
private val resourceHelper: ResourceHelper
|
||||
) : DataPointWithLabelInterface {
|
||||
|
||||
fun valueToUnits(units: String): Double =
|
||||
if (units == Constants.MGDL) data.value else data.value * Constants.MGDL_TO_MMOLL
|
||||
fun valueToUnits(units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) data.value else data.value * Constants.MGDL_TO_MMOLL
|
||||
|
||||
override fun getX(): Double = data.timestamp.toDouble()
|
||||
override fun getY(): Double = valueToUnits(profileFunction.getUnits())
|
||||
|
|
|
@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
|
|||
import android.graphics.Color
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Interval
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.Translator
|
||||
|
@ -30,11 +31,11 @@ class TherapyEventDataPoint @Inject constructor(
|
|||
if (data.glucose != null && data.glucose != 0.0) {
|
||||
var mmol = 0.0
|
||||
var mgdl = 0.0
|
||||
if (units == Constants.MGDL) {
|
||||
if (units == GlucoseUnit.MGDL) {
|
||||
mgdl = data.glucose!!
|
||||
mmol = data.glucose!! * Constants.MGDL_TO_MMOLL
|
||||
}
|
||||
if (units == Constants.MMOL) {
|
||||
if (units == GlucoseUnit.MMOL) {
|
||||
mmol = data.glucose!!
|
||||
mgdl = data.glucose!! * Constants.MMOLL_TO_MGDL
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import androidx.core.app.RemoteInput
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.interfaces.Config
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
|
@ -817,11 +817,11 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
eatingSoonTTDuration =
|
||||
if (eatingSoonTTDuration > 0) eatingSoonTTDuration
|
||||
else Constants.defaultEatingSoonTTDuration
|
||||
var eatingSoonTT = sp.getDouble(R.string.key_eatingsoon_target, if (currentProfile.units == Constants.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl)
|
||||
var eatingSoonTT = sp.getDouble(R.string.key_eatingsoon_target, if (currentProfile.units == GlucoseUnit.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl)
|
||||
eatingSoonTT =
|
||||
when {
|
||||
eatingSoonTT > 0 -> eatingSoonTT
|
||||
currentProfile.units == Constants.MMOL -> Constants.defaultEatingSoonTTmmol
|
||||
currentProfile.units == GlucoseUnit.MMOL -> Constants.defaultEatingSoonTTmmol
|
||||
else -> Constants.defaultEatingSoonTTmgdl
|
||||
}
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
|
@ -836,7 +836,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
})
|
||||
val tt = if (currentProfile.units == Constants.MMOL) {
|
||||
val tt = if (currentProfile.units == GlucoseUnit.MMOL) {
|
||||
DecimalFormatter.to1Decimal(eatingSoonTT)
|
||||
} else DecimalFormatter.to0Decimal(eatingSoonTT)
|
||||
replyText += "\n" + String.format(resourceHelper.gs(R.string.smscommunicator_mealbolusdelivered_tt), tt, eatingSoonTTDuration)
|
||||
|
@ -966,9 +966,9 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}
|
||||
var ttDuration = sp.getInt(keyDuration, defaultTargetDuration)
|
||||
ttDuration = if (ttDuration > 0) ttDuration else defaultTargetDuration
|
||||
var tt = sp.getDouble(keyTarget, if (units == Constants.MMOL) defaultTargetMMOL else defaultTargetMGDL)
|
||||
var tt = sp.getDouble(keyTarget, if (units == GlucoseUnit.MMOL) defaultTargetMMOL else defaultTargetMGDL)
|
||||
tt = Profile.toCurrentUnits(profileFunction, tt)
|
||||
tt = if (tt > 0) tt else if (units == Constants.MMOL) defaultTargetMMOL else defaultTargetMGDL
|
||||
tt = if (tt > 0) tt else if (units == GlucoseUnit.MMOL) defaultTargetMMOL else defaultTargetMGDL
|
||||
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
|
||||
timestamp = dateUtil.now(),
|
||||
duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()),
|
||||
|
@ -981,11 +981,11 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
})
|
||||
val ttString = if (units == Constants.MMOL) DecimalFormatter.to1Decimal(tt) else DecimalFormatter.to0Decimal(tt)
|
||||
val ttString = if (units == GlucoseUnit.MMOL) DecimalFormatter.to1Decimal(tt) else DecimalFormatter.to0Decimal(tt)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_set), ttString, ttDuration)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(Action.TT, Sources.SMS,
|
||||
ValueWithUnit.fromGlucoseUnit(tt, units),
|
||||
ValueWithUnit.fromGlucoseUnit(tt, units.asText),
|
||||
ValueWithUnit.Minute(ttDuration))
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.general.tidepool.elements
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.general.tidepool.elements
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.extensions.toConstant
|
||||
import info.nightscout.androidaps.extensions.toMainUnit
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import java.util.*
|
||||
|
||||
|
@ -23,7 +24,7 @@ class BloodGlucoseElement(therapyEvent: TherapyEvent, dateUtil: DateUtil)
|
|||
type = "cbg"
|
||||
subType = "manual" // TODO
|
||||
value = if (therapyEvent.glucose != null)
|
||||
Profile.toMgdl(therapyEvent.glucose!!, therapyEvent.glucoseUnit.toConstant()).toInt()
|
||||
Profile.toMgdl(therapyEvent.glucose!!, therapyEvent.glucoseUnit.toMainUnit()).toInt()
|
||||
else 0
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.general.tidepool.elements
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
@ -36,13 +36,13 @@ class ProfileElement(ps: ProfileSwitch, serialNumber: String, dateUtil: DateUtil
|
|||
type = "pumpSettings"
|
||||
val profile: Profile? = ps.profileObject
|
||||
checkNotNull(profile)
|
||||
for (br in profile.basalValues)
|
||||
for (br in profile.getBasalValues())
|
||||
basalSchedules.Normal.add(BasalRate(br.timeAsSeconds * 1000, br.value))
|
||||
for (target in profile.singleTargetsMgdl)
|
||||
for (target in profile.getSingleTargetsMgdl())
|
||||
bgTargets.Normal.add(Target(target.timeAsSeconds * 1000, target.value))
|
||||
for (ic in profile.ics)
|
||||
for (ic in profile.getIcs())
|
||||
carbRatios.Normal.add(Ratio(ic.timeAsSeconds * 1000, ic.value))
|
||||
for (isf in profile.isfsMgdl)
|
||||
for (isf in profile.getIsfsMgdl())
|
||||
insulinSensitivities.Normal.add(Ratio(isf.timeAsSeconds * 1000, isf.value))
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
|||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
|
@ -146,7 +146,7 @@ class ActionStringHandler @Inject constructor(
|
|||
rAction += "bolus $insulinAfterConstraints $carbsAfterConstraints"
|
||||
} else if ("temptarget" == act[0]) { ///////////////////////////////////////////////////////// TEMPTARGET
|
||||
val isMGDL = java.lang.Boolean.parseBoolean(act[1])
|
||||
if (profileFunction.getUnits() == Constants.MGDL != isMGDL) {
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MGDL != isMGDL) {
|
||||
sendError("Different units used on watch and phone!")
|
||||
return
|
||||
}
|
||||
|
@ -456,13 +456,13 @@ class ActionStringHandler @Inject constructor(
|
|||
//Check for Temp-Target:
|
||||
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
|
||||
if (tempTarget is ValueWrapper.Existing) {
|
||||
ret += "Temp Target: " + Profile.toTargetRangeString(tempTarget.value.lowTarget, tempTarget.value.lowTarget, Constants.MGDL, profileFunction.getUnits())
|
||||
ret += "Temp Target: " + Profile.toTargetRangeString(tempTarget.value.lowTarget, tempTarget.value.lowTarget, GlucoseUnit.MGDL, profileFunction.getUnits())
|
||||
ret += "\nuntil: " + dateUtil.timeString(tempTarget.value.end)
|
||||
ret += "\n\n"
|
||||
}
|
||||
ret += "DEFAULT RANGE: "
|
||||
ret += Profile.fromMgdlToUnits(profile.targetLowMgdl, profileFunction.getUnits()).toString() + " - " + Profile.fromMgdlToUnits(profile.targetHighMgdl, profileFunction.getUnits())
|
||||
ret += " target: " + Profile.fromMgdlToUnits(profile.targetMgdl, profileFunction.getUnits())
|
||||
ret += Profile.fromMgdlToUnits(profile.getTargetLowMgdl(), profileFunction.getUnits()).toString() + " - " + Profile.fromMgdlToUnits(profile.getTargetHighMgdl(), profileFunction.getUnits())
|
||||
ret += " target: " + Profile.fromMgdlToUnits(profile.getTargetMgdl(), profileFunction.getUnits())
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -588,8 +588,8 @@ class ActionStringHandler @Inject constructor(
|
|||
})
|
||||
uel.log(Action.TT, Sources.Wear,
|
||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR),
|
||||
ValueWithUnit.fromGlucoseUnit(low, profileFunction.getUnits()),
|
||||
ValueWithUnit.fromGlucoseUnit(high, profileFunction.getUnits()).takeIf { low != high },
|
||||
ValueWithUnit.fromGlucoseUnit(low, profileFunction.getUnits().asText),
|
||||
ValueWithUnit.fromGlucoseUnit(high, profileFunction.getUnits().asText).takeIf { low != high },
|
||||
ValueWithUnit.Minute(duration))
|
||||
} else {
|
||||
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(System.currentTimeMillis()))
|
||||
|
|
|
@ -33,7 +33,8 @@ import info.nightscout.androidaps.interfaces.Config;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.database.AppRepository;
|
||||
import info.nightscout.androidaps.database.entities.Bolus;
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue;
|
||||
|
@ -298,9 +299,9 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
|
||||
|
||||
private DataMap dataMapSingleBG(GlucoseValue lastBG, GlucoseStatus glucoseStatus) {
|
||||
String units = profileFunction.getUnits();
|
||||
GlucoseUnit units = profileFunction.getUnits();
|
||||
double convert2MGDL = 1.0;
|
||||
if (units.equals(Constants.MMOL))
|
||||
if (units.equals(GlucoseUnit.MMOL))
|
||||
convert2MGDL = Constants.MMOLL_TO_MGDL;
|
||||
double lowLine = defaultValueHelper.determineLowLine() * convert2MGDL;
|
||||
double highLine = defaultValueHelper.determineHighLine() * convert2MGDL;
|
||||
|
@ -314,7 +315,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
|
||||
DataMap dataMap = new DataMap();
|
||||
dataMap.putString("sgvString", GlucoseValueExtensionKt.valueToUnitsString(lastBG, units));
|
||||
dataMap.putString("glucoseUnits", units);
|
||||
dataMap.putString("glucoseUnits", units.getAsText());
|
||||
dataMap.putLong("timestamp", lastBG.getTimestamp());
|
||||
if (glucoseStatus == null) {
|
||||
dataMap.putString("slopeArrow", "");
|
||||
|
@ -332,7 +333,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
return dataMap;
|
||||
}
|
||||
|
||||
private String deltastring(double deltaMGDL, double deltaMMOL, String units) {
|
||||
private String deltastring(double deltaMGDL, double deltaMMOL, GlucoseUnit units) {
|
||||
String deltastring = "";
|
||||
if (deltaMGDL >= 0) {
|
||||
deltastring += "+";
|
||||
|
@ -341,7 +342,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
}
|
||||
|
||||
boolean detailed = sp.getBoolean(R.string.key_wear_detailed_delta, false);
|
||||
if (units.equals(Constants.MGDL)) {
|
||||
if (units.equals(GlucoseUnit.MGDL)) {
|
||||
if (detailed) {
|
||||
deltastring += DecimalFormatter.INSTANCE.to1Decimal(Math.abs(deltaMGDL));
|
||||
} else {
|
||||
|
@ -541,7 +542,6 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
.collect(Collectors.toList());
|
||||
|
||||
if (!predArray.isEmpty()) {
|
||||
final String units = profileFunction.getUnits();
|
||||
for (GlucoseValueDataPoint bg : predArray) {
|
||||
if (bg.getData().getValue() < 40) continue;
|
||||
predictions.add(predictionMap(bg.getData().getTimestamp(), bg.getData().getValue(), bg.getPredictionColor()));
|
||||
|
@ -695,7 +695,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
currentBasal = generateBasalString();
|
||||
|
||||
//bgi
|
||||
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits());
|
||||
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.Companion.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits());
|
||||
bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.INSTANCE.to1Decimal(bgi);
|
||||
|
||||
status = generateStatusString(profile, currentBasal, iobSum, iobDetail, bgiString);
|
||||
|
|
|
@ -5,15 +5,14 @@ import android.content.Intent
|
|||
import android.os.Bundle
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.extensions.toStringShort
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.extensions.toStringShort
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -31,7 +30,6 @@ class StatusLinePlugin @Inject constructor(
|
|||
private val aapsSchedulers: AapsSchedulers,
|
||||
private val context: Context,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val activePlugin: ActivePlugin,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val iobCobCalculator: IobCobCalculator,
|
||||
private val rxBus: RxBusWrapper,
|
||||
|
@ -136,7 +134,7 @@ class StatusLinePlugin @Inject constructor(
|
|||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")")
|
||||
}
|
||||
if (sp.getBoolean(R.string.key_xdripstatus_showbgi, true)) {
|
||||
val bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.fromMgdlToUnits(profile.isfMgdl, profileFunction.getUnits())
|
||||
val bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits())
|
||||
status += " " + (if (bgi >= 0) "+" else "") + DecimalFormatter.to2Decimal(bgi)
|
||||
}
|
||||
// COB
|
||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.MealData
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
|
|
|
@ -11,13 +11,14 @@ import android.widget.ArrayAdapter
|
|||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
@ -127,8 +128,8 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, HardLimits.MIN_ISF, HardLimits.MAX_ISF, 1.0, DecimalFormat("0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
|
||||
} else {
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, Profile.fromMgdlToUnits(HardLimits.MIN_ISF, Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.MAX_ISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, Profile.fromMgdlToUnits(HardLimits.MIN_ISF, GlucoseUnit.MMOL), Profile.fromMgdlToUnits(HardLimits.MAX_ISF, GlucoseUnit.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), GlucoseUnit.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), GlucoseUnit.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
}
|
||||
|
||||
// Spinner
|
||||
|
@ -175,7 +176,8 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(Action.CLONE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
uel.log(Action.CLONE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name
|
||||
?: ""))
|
||||
localProfilePlugin.cloneProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -184,7 +186,8 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.profileRemove.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
|
||||
uel.log(Action.PROFILE_REMOVED, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
uel.log(Action.PROFILE_REMOVED, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name
|
||||
?: ""))
|
||||
localProfilePlugin.removeCurrentProfile()
|
||||
build()
|
||||
}, null)
|
||||
|
@ -212,7 +215,8 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (!localProfilePlugin.isValidEditState()) {
|
||||
return@setOnClickListener //Should not happen as saveButton should not be visible if not valid
|
||||
}
|
||||
uel.log(Action.STORE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
uel.log(Action.STORE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name
|
||||
?: ""))
|
||||
localProfilePlugin.storeSettings(activity)
|
||||
build()
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import androidx.fragment.app.FragmentActivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
@ -207,13 +207,13 @@ class LocalProfilePlugin @Inject constructor(
|
|||
}
|
||||
val sp = SingleProfile()
|
||||
sp.name = verifiedName
|
||||
sp.mgdl = profile.units == Constants.MGDL
|
||||
sp.mgdl = profile.units == GlucoseUnit.MGDL
|
||||
sp.dia = profile.dia
|
||||
sp.ic = JSONArray(profile.data.getJSONArray("carbratio").toString())
|
||||
sp.isf = JSONArray(profile.data.getJSONArray("sens").toString())
|
||||
sp.basal = JSONArray(profile.data.getJSONArray("basal").toString())
|
||||
sp.targetLow = JSONArray(profile.data.getJSONArray("target_low").toString())
|
||||
sp.targetHigh = JSONArray(profile.data.getJSONArray("target_high").toString())
|
||||
sp.ic = JSONArray(profile.toNsJson().getJSONArray("carbratio").toString())
|
||||
sp.isf = JSONArray(profile.toNsJson().getJSONArray("sens").toString())
|
||||
sp.basal = JSONArray(profile.toNsJson().getJSONArray("basal").toString())
|
||||
sp.targetLow = JSONArray(profile.toNsJson().getJSONArray("target_low").toString())
|
||||
sp.targetHigh = JSONArray(profile.toNsJson().getJSONArray("target_high").toString())
|
||||
return sp
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ class LocalProfilePlugin @Inject constructor(
|
|||
}
|
||||
val p = SingleProfile()
|
||||
p.name = Constants.LOCAL_PROFILE + free
|
||||
p.mgdl = profileFunction.getUnits() == Constants.MGDL
|
||||
p.mgdl = profileFunction.getUnits() == GlucoseUnit.MGDL
|
||||
p.dia = Constants.defaultDIA
|
||||
p.ic = JSONArray(defaultArray)
|
||||
p.isf = JSONArray(defaultArray)
|
||||
|
|
|
@ -100,7 +100,7 @@ class NSProfileFragment : DaggerFragment() {
|
|||
nsProfilePlugin.profile?.let { store ->
|
||||
store.getSpecificProfile(name)?.let { profile ->
|
||||
if (_binding == null) return
|
||||
binding.profileviewer.units.text = profile.units
|
||||
binding.profileviewer.units.text = profile.units.asText
|
||||
binding.profileviewer.dia.text = resourceHelper.gs(R.string.format_hours, profile.dia)
|
||||
binding.profileviewer.activeprofile.text = name
|
||||
binding.profileviewer.ic.text = profile.icList
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.mdi
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
|
|
@ -7,7 +7,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
|
@ -169,7 +169,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override val baseBasalRate: Double
|
||||
get() = profileFunction.getProfile()?.basal ?: 0.0
|
||||
get() = profileFunction.getProfile()?.getBasal() ?: 0.0
|
||||
|
||||
override val reservoirLevel: Double
|
||||
get() = reservoirInUnits.toDouble()
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.sensitivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -110,14 +110,14 @@ open class SensitivityAAPSPlugin @Inject constructor(
|
|||
index++
|
||||
}
|
||||
val deviations = Array(deviationsArray.size) { i -> deviationsArray[i] }
|
||||
val sens = profile.isfMgdl
|
||||
val sens = profile.getIsfMgdl()
|
||||
val ratioLimit = ""
|
||||
val sensResult: String
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Records: $index $pastSensitivity")
|
||||
Arrays.sort(deviations)
|
||||
val percentile = IobCobCalculatorPlugin.percentile(deviations, 0.50)
|
||||
val basalOff = percentile * (60.0 / 5.0) / sens
|
||||
val ratio = 1 + basalOff / profile.maxDailyBasal
|
||||
val ratio = 1 + basalOff / profile.getMaxDailyBasal()
|
||||
sensResult = when {
|
||||
percentile < 0 -> "Excess insulin sensitivity detected"
|
||||
percentile > 0 -> "Excess insulin resistance detected"
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.sensitivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -159,7 +159,7 @@ open class SensitivityOref1Plugin @Inject constructor(
|
|||
if (hourUsed == 1) sensResult = "(24 hours) "
|
||||
val ratioLimit = ""
|
||||
val deviations: Array<Double> = Array(deviationsArray.size) { i -> deviationsArray[i] }
|
||||
val sens = profile.isfMgdl
|
||||
val sens = profile.getIsfMgdl()
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Records: $index $pastSensitivity")
|
||||
Arrays.sort(deviations)
|
||||
val pSensitive = IobCobCalculatorPlugin.percentile(deviations, 0.50)
|
||||
|
@ -179,7 +179,7 @@ open class SensitivityOref1Plugin @Inject constructor(
|
|||
else -> sensResult += "Sensitivity normal"
|
||||
}
|
||||
aapsLogger.debug(LTag.AUTOSENS, sensResult)
|
||||
val ratio = 1 + basalOff / profile.maxDailyBasal
|
||||
val ratio = 1 + basalOff / profile.getMaxDailyBasal()
|
||||
|
||||
//Update the data back to the parent
|
||||
sensResultArray[hourUsed] = sensResult
|
||||
|
|
|
@ -4,7 +4,7 @@ import androidx.collection.LongSparseArray
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -133,13 +133,13 @@ open class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
if (weights == 0.0) {
|
||||
return AutosensResult()
|
||||
}
|
||||
val sens = profile.isfMgdl
|
||||
val sens = profile.getIsfMgdl()
|
||||
val ratioLimit = ""
|
||||
val sensResult: String
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Records: $index $pastSensitivity")
|
||||
val average = weightedSum / weights
|
||||
val basalOff = average * (60 / 5.0) / sens
|
||||
val ratio = 1 + basalOff / profile.maxDailyBasal
|
||||
val ratio = 1 + basalOff / profile.getMaxDailyBasal()
|
||||
sensResult = when {
|
||||
average < 0 -> "Excess insulin sensitivity detected"
|
||||
average > 0 -> "Excess insulin resistance detected"
|
||||
|
|
|
@ -48,11 +48,9 @@ import io.reactivex.disposables.CompositeDisposable;
|
|||
@Singleton
|
||||
public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface {
|
||||
|
||||
private final Context context;
|
||||
private final AapsSchedulers aapsSchedulers;
|
||||
private final SP sp;
|
||||
private final RxBusWrapper rxBus;
|
||||
private final ResourceHelper resourceHelper;
|
||||
private final ProfileFunction profileFunction;
|
||||
private final ActivePlugin activePlugin;
|
||||
private final NSUpload nsUpload;
|
||||
|
@ -95,8 +93,6 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
.setDefault(),
|
||||
aapsLogger, resourceHelper, injector
|
||||
);
|
||||
this.resourceHelper = resourceHelper;
|
||||
this.context = context;
|
||||
this.rxBus = rxBus;
|
||||
this.aapsSchedulers = aapsSchedulers;
|
||||
this.sp = sp;
|
||||
|
@ -379,7 +375,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
profileSwitch.date = System.currentTimeMillis();
|
||||
profileSwitch.source = Source.USER;
|
||||
profileSwitch.profileName = profileFunction.getProfileName(System.currentTimeMillis(), false, false);
|
||||
profileSwitch.profileJson = profileFunction.getProfile().getData().toString();
|
||||
profileSwitch.profileJson = profileFunction.getProfile().toNsJson().toString();
|
||||
profileSwitch.profilePlugin = activePlugin.getActiveProfileSource().getClass().getName();
|
||||
profileSwitch.durationInMinutes = duration;
|
||||
profileSwitch.isCPP = percentage != 100 || timeShift != 0;
|
||||
|
|
|
@ -11,7 +11,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.activities.BolusProgressHelperActivity
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||
|
@ -378,7 +378,7 @@ open class CommandQueue @Inject constructor(
|
|||
}
|
||||
*/
|
||||
// Compare with pump limits
|
||||
val basalValues = profile.basalValues
|
||||
val basalValues = profile.getBasalValues()
|
||||
for (basalValue in basalValues) {
|
||||
if (basalValue.value < activePlugin.get().activePump.pumpDescription.basalMinimumRate) {
|
||||
val notification = Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, resourceHelper.gs(R.string.basalvaluebelowminimum), Notification.URGENT)
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.queue.commands
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.queue.commands
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
|
|
@ -120,7 +120,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
val profile = profileFunction.getProfile() ?: return
|
||||
val lastConnection = pump.lastDataTime()
|
||||
val isStatusOutdated = lastConnection + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis()
|
||||
val isBasalOutdated = abs(profile.basal - pump.baseBasalRate) > pump.pumpDescription.basalStep
|
||||
val isBasalOutdated = abs(profile.getBasal() - pump.baseBasalRate) > pump.pumpDescription.basalStep
|
||||
aapsLogger.debug(LTag.CORE, "Last connection: " + dateUtil.dateAndTimeString(lastConnection))
|
||||
// sometimes keep alive broadcast stops
|
||||
// as as workaround test if readStatus was requested before an alarm is generated
|
||||
|
|
|
@ -7,12 +7,12 @@ import android.view.View
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.setupwizard.SWNumberValidator
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
import info.nightscout.androidaps.utils.SafeParse
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
import java.text.DecimalFormat
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -43,7 +43,7 @@ class SWEditNumberWithUnits(injector: HasAndroidInjector, private val init: Doub
|
|||
var initValue = sp.getDouble(preferenceId, init)
|
||||
initValue = Profile.toCurrentUnits(profileFunction.getUnits(), initValue)
|
||||
val numberPicker = NumberPicker(context)
|
||||
if (profileFunction.getUnits() == Constants.MMOL) numberPicker.setParams(initValue, min, max, 0.1, DecimalFormat("0.0"), false, null, watcher) else numberPicker.setParams(initValue, min * 18, max * 18, 1.0, DecimalFormat("0"), false, null, watcher)
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) numberPicker.setParams(initValue, min, max, 0.1, DecimalFormat("0.0"), false, null, watcher) else numberPicker.setParams(initValue, min * 18, max * 18, 1.0, DecimalFormat("0"), false, null, watcher)
|
||||
|
||||
layout.addView(numberPicker)
|
||||
val c = TextView(context)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.utils
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
||||
import info.nightscout.androidaps.plugins.general.automation.actions.ActionAlarm
|
||||
|
@ -37,21 +37,21 @@ class CarbTimer @Inject constructor(
|
|||
|
||||
// Bg under 180 mgdl and dropping by 15 mgdl
|
||||
list.add(TriggerConnector(injector, TriggerConnector.Type.AND).apply {
|
||||
list.add(TriggerBg(injector, 180.0, Constants.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -15.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -8.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerBg(injector, 180.0, GlucoseUnit.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -15.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -8.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
})
|
||||
// Bg under 160 mgdl and dropping by 9 mgdl
|
||||
list.add(TriggerConnector(injector, TriggerConnector.Type.AND).apply {
|
||||
list.add(TriggerBg(injector, 160.0, Constants.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -9.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -5.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerBg(injector, 160.0, GlucoseUnit.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -9.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, -5.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
})
|
||||
// Bg under 145 mgdl and dropping
|
||||
list.add(TriggerConnector(injector, TriggerConnector.Type.AND).apply {
|
||||
list.add(TriggerBg(injector, 145.0, Constants.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, 0.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, 0.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), Constants.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerBg(injector, 145.0, GlucoseUnit.MGDL, Comparator.Compare.IS_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, 0.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.DELTA), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
list.add(TriggerDelta(injector, InputDelta(resourceHelper, 0.0, -360.0, 360.0, 1.0, DecimalFormat("0"), InputDelta.DeltaType.SHORT_AVERAGE), GlucoseUnit.MGDL, Comparator.Compare.IS_EQUAL_OR_LESSER))
|
||||
})
|
||||
}
|
||||
actions.add(ActionAlarm(injector, resourceHelper.gs(R.string.time_to_eat)))
|
||||
|
|
|
@ -3,10 +3,10 @@ package info.nightscout.androidaps.utils
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.services.Intents
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
@ -23,7 +23,7 @@ class XdripCalibrations @Inject constructor(
|
|||
fun sendIntent(bg: Double): Boolean {
|
||||
val bundle = Bundle()
|
||||
bundle.putDouble("glucose_number", bg)
|
||||
bundle.putString("units", if (profileFunction.getUnits() == Constants.MGDL) "mgdl" else "mmol")
|
||||
bundle.putString("units", if (profileFunction.getUnits() == GlucoseUnit.MGDL) "mgdl" else "mmol")
|
||||
bundle.putLong("timestamp", System.currentTimeMillis())
|
||||
val intent = Intent(Intents.ACTION_REMOTE_CALIBRATION)
|
||||
intent.putExtras(bundle)
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.text.Spanned
|
|||
import android.util.LongSparseArray
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
|
|
@ -9,7 +9,7 @@ import info.nightscout.androidaps.interfaces.Config
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
|
@ -175,9 +175,9 @@ class BolusWizard @Inject constructor(
|
|||
this.quickWizard = quickWizard
|
||||
|
||||
// Insulin from BG
|
||||
sens = Profile.fromMgdlToUnits(profile.isfMgdl, profileFunction.getUnits())
|
||||
targetBGLow = Profile.fromMgdlToUnits(profile.targetLowMgdl, profileFunction.getUnits())
|
||||
targetBGHigh = Profile.fromMgdlToUnits(profile.targetHighMgdl, profileFunction.getUnits())
|
||||
sens = Profile.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits())
|
||||
targetBGLow = Profile.fromMgdlToUnits(profile.getTargetLowMgdl(), profileFunction.getUnits())
|
||||
targetBGHigh = Profile.fromMgdlToUnits(profile.getTargetHighMgdl(), profileFunction.getUnits())
|
||||
if (useTT && tempTarget != null) {
|
||||
targetBGLow = Profile.fromMgdlToUnits(tempTarget.lowTarget, profileFunction.getUnits())
|
||||
targetBGHigh = Profile.fromMgdlToUnits(tempTarget.highTarget, profileFunction.getUnits())
|
||||
|
@ -201,7 +201,7 @@ class BolusWizard @Inject constructor(
|
|||
}
|
||||
|
||||
// Insulin from carbs
|
||||
ic = profile.ic
|
||||
ic = profile.getIc()
|
||||
insulinFromCarbs = carbs / ic
|
||||
insulinFromCOB = if (useCob) (cob / ic) else 0.0
|
||||
|
||||
|
@ -218,7 +218,7 @@ class BolusWizard @Inject constructor(
|
|||
|
||||
// Insulin from superbolus for 2h. Get basal rate now and after 1h
|
||||
if (useSuperBolus) {
|
||||
insulinFromSuperBolus = profile.basal
|
||||
insulinFromSuperBolus = profile.getBasal()
|
||||
var timeAfter1h = System.currentTimeMillis()
|
||||
timeAfter1h += T.hours(1).msecs()
|
||||
insulinFromSuperBolus += profile.getBasal(timeAfter1h)
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.utils.wizard
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps
|
|||
import android.content.Context
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||
import info.nightscout.androidaps.interfaces.Pump
|
||||
|
|
|
@ -6,7 +6,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.DrawableRes
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
|
@ -28,6 +28,7 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
||||
import info.nightscout.androidaps.extensions.friendlyDescription
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
@ -75,7 +76,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
}
|
||||
|
||||
override fun generateDialog(root: LinearLayout) {
|
||||
val unitResId = if (value.units == Constants.MGDL) R.string.mgdl else R.string.mmol
|
||||
val unitResId = if (value.units == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol
|
||||
LayoutBuilder()
|
||||
.add(LabelWithElement(resourceHelper, resourceHelper.gs(R.string.careportal_temporarytarget) + "\n[" + resourceHelper.gs(unitResId) + "]", "", value))
|
||||
.add(LabelWithElement(resourceHelper, resourceHelper.gs(R.string.duration_min_label), "", duration))
|
||||
|
@ -89,7 +90,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
override fun toJSON(): String {
|
||||
val data = JSONObject()
|
||||
.put("value", value.value)
|
||||
.put("units", value.units)
|
||||
.put("units", value.units.asText)
|
||||
.put("durationInMinutes", duration.getMinutes())
|
||||
return JSONObject()
|
||||
.put("type", this.javaClass.name)
|
||||
|
@ -99,7 +100,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
|
||||
override fun fromJSON(data: String): Action {
|
||||
val o = JSONObject(data)
|
||||
value.units = JsonHelper.safeGetString(o, "units", Constants.MGDL)
|
||||
value.units = GlucoseUnit.fromText(JsonHelper.safeGetString(o, "units", Constants.MGDL))
|
||||
value.value = safeGetDouble(o, "value")
|
||||
duration.setMinutes(JsonHelper.safeGetInt(o, "durationInMinutes"))
|
||||
return this
|
||||
|
@ -114,7 +115,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
)
|
||||
|
||||
override fun isValid(): Boolean =
|
||||
if (value.units == Constants.MMOL) { // mmol
|
||||
if (value.units == GlucoseUnit.MMOL) { // mmol
|
||||
value.value >= Constants.MIN_TT_MMOL &&
|
||||
value.value <= Constants.MAX_TT_MMOL &&
|
||||
duration.value > 0
|
||||
|
|
|
@ -3,20 +3,21 @@ package info.nightscout.androidaps.plugins.general.automation.elements
|
|||
import android.widget.LinearLayout
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
import java.text.DecimalFormat
|
||||
|
||||
class InputBg(profileFunction: ProfileFunction) : Element() {
|
||||
|
||||
var units = Constants.MGDL
|
||||
var units = GlucoseUnit.MGDL
|
||||
var value = 0.0
|
||||
var minValue = 0.0
|
||||
private var maxValue = 0.0
|
||||
private var step = 0.0
|
||||
private var decimalFormat: DecimalFormat? = null
|
||||
|
||||
constructor(profileFunction: ProfileFunction, value: Double, units: String) : this(profileFunction) {
|
||||
constructor(profileFunction: ProfileFunction, value: Double, units: GlucoseUnit) : this(profileFunction) {
|
||||
setUnits(units)
|
||||
this.value = value
|
||||
}
|
||||
|
@ -37,8 +38,8 @@ class InputBg(profileFunction: ProfileFunction) : Element() {
|
|||
return this
|
||||
}
|
||||
|
||||
fun setUnits(units: String): InputBg {
|
||||
if (units == Constants.MMOL) {
|
||||
fun setUnits(units: GlucoseUnit): InputBg {
|
||||
if (units == GlucoseUnit.MMOL) {
|
||||
minValue = MMOL_MIN
|
||||
maxValue = MMOL_MAX
|
||||
step = 0.1
|
||||
|
|
|
@ -3,17 +3,18 @@ package info.nightscout.androidaps.plugins.general.automation.elements
|
|||
import android.widget.LinearLayout
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
import java.text.DecimalFormat
|
||||
|
||||
class InputTempTarget(profileFunction: ProfileFunction) : Element() {
|
||||
var units: String = Constants.MGDL
|
||||
var units: GlucoseUnit = GlucoseUnit.MGDL
|
||||
var value = 0.0
|
||||
|
||||
init {
|
||||
units = profileFunction.getUnits()
|
||||
value = if (units == Constants.MMOL) 6.0 else 110.0
|
||||
value = if (units == GlucoseUnit.MMOL) 6.0 else 110.0
|
||||
}
|
||||
|
||||
constructor(profileFunction: ProfileFunction, inputTempTarget: InputTempTarget) : this(profileFunction) {
|
||||
|
@ -26,7 +27,7 @@ class InputTempTarget(profileFunction: ProfileFunction) : Element() {
|
|||
val maxValue: Double
|
||||
val step: Double
|
||||
val decimalFormat: DecimalFormat?
|
||||
if (units == Constants.MMOL) { // mmol
|
||||
if (units == GlucoseUnit.MMOL) { // mmol
|
||||
minValue = Constants.MIN_TT_MMOL
|
||||
maxValue = Constants.MAX_TT_MMOL
|
||||
step = 0.1
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.view.ViewGroup
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.MidnightTime
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.view.ViewGroup
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.MidnightTime
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
|
|
@ -5,22 +5,23 @@ import com.google.common.base.Optional
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputBg
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
import org.json.JSONObject
|
||||
|
||||
class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
||||
|
||||
var bg = InputBg(profileFunction)
|
||||
var comparator = Comparator(resourceHelper)
|
||||
|
||||
constructor(injector: HasAndroidInjector, value: Double, units: String, compare: Comparator.Compare) : this(injector) {
|
||||
constructor(injector: HasAndroidInjector, value: Double, units: GlucoseUnit, compare: Comparator.Compare) : this(injector) {
|
||||
bg = InputBg(profileFunction, value, units)
|
||||
comparator = Comparator(resourceHelper, compare)
|
||||
}
|
||||
|
@ -30,7 +31,7 @@ class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
comparator = Comparator(resourceHelper, triggerBg.comparator.value)
|
||||
}
|
||||
|
||||
fun setUnits(units: String): TriggerBg {
|
||||
fun setUnits(units: GlucoseUnit): TriggerBg {
|
||||
bg.units = units
|
||||
return this
|
||||
}
|
||||
|
@ -67,11 +68,11 @@ class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
JSONObject()
|
||||
.put("bg", bg.value)
|
||||
.put("comparator", comparator.value.toString())
|
||||
.put("units", bg.units)
|
||||
.put("units", bg.units.asText)
|
||||
|
||||
override fun fromJSON(data: String): Trigger {
|
||||
val d = JSONObject(data)
|
||||
bg.setUnits(JsonHelper.safeGetString(d, "units")!!)
|
||||
bg.setUnits(GlucoseUnit.fromText(JsonHelper.safeGetString(d, "units", Constants.MGDL)))
|
||||
bg.value = JsonHelper.safeGetDouble(d, "bg")
|
||||
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")!!))
|
||||
return this
|
||||
|
@ -83,7 +84,7 @@ class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
return if (comparator.value == Comparator.Compare.IS_NOT_AVAILABLE)
|
||||
resourceHelper.gs(R.string.glucoseisnotavailable)
|
||||
else
|
||||
resourceHelper.gs(if (bg.units == Constants.MGDL) R.string.glucosecomparedmgdl else R.string.glucosecomparedmmol, resourceHelper.gs(comparator.value.stringRes), bg.value, bg.units)
|
||||
resourceHelper.gs(if (bg.units == GlucoseUnit.MGDL) R.string.glucosecomparedmgdl else R.string.glucosecomparedmmol, resourceHelper.gs(comparator.value.stringRes), bg.value, bg.units)
|
||||
}
|
||||
|
||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_cp_bgcheck)
|
||||
|
|
|
@ -5,7 +5,8 @@ import com.google.common.base.Optional
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDelta
|
||||
|
@ -19,7 +20,7 @@ import java.text.DecimalFormat
|
|||
|
||||
class TriggerDelta(injector: HasAndroidInjector) : Trigger(injector) {
|
||||
|
||||
var units: String = Constants.MGDL
|
||||
var units: GlucoseUnit = GlucoseUnit.MGDL
|
||||
var delta: InputDelta = InputDelta(resourceHelper)
|
||||
var comparator: Comparator = Comparator(resourceHelper)
|
||||
|
||||
|
@ -31,11 +32,11 @@ class TriggerDelta(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
|
||||
init {
|
||||
units = profileFunction.getUnits()
|
||||
delta = if (units == Constants.MMOL) InputDelta(resourceHelper, 0.0, (-MMOL_MAX), MMOL_MAX, 0.1, DecimalFormat("0.1"), DeltaType.DELTA)
|
||||
delta = if (units == GlucoseUnit.MMOL) InputDelta(resourceHelper, 0.0, (-MMOL_MAX), MMOL_MAX, 0.1, DecimalFormat("0.1"), DeltaType.DELTA)
|
||||
else InputDelta(resourceHelper, 0.0, (-MGDL_MAX), MGDL_MAX, 1.0, DecimalFormat("1"), DeltaType.DELTA)
|
||||
}
|
||||
|
||||
constructor(injector: HasAndroidInjector, inputDelta: InputDelta, units: String, comparator: Comparator.Compare) : this(injector) {
|
||||
constructor(injector: HasAndroidInjector, inputDelta: InputDelta, units: GlucoseUnit, comparator: Comparator.Compare) : this(injector) {
|
||||
this.units = units
|
||||
this.delta = inputDelta
|
||||
this.comparator.value = comparator
|
||||
|
@ -47,7 +48,7 @@ class TriggerDelta(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
comparator = Comparator(resourceHelper, triggerDelta.comparator.value)
|
||||
}
|
||||
|
||||
fun units(units: String): TriggerDelta {
|
||||
fun units(units: GlucoseUnit): TriggerDelta {
|
||||
this.units = units
|
||||
return this
|
||||
}
|
||||
|
@ -88,17 +89,17 @@ class TriggerDelta(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
override fun dataJSON(): JSONObject =
|
||||
JSONObject()
|
||||
.put("value", delta.value)
|
||||
.put("units", units)
|
||||
.put("units", units.asText)
|
||||
.put("deltaType", delta.deltaType)
|
||||
.put("comparator", comparator.value.toString())
|
||||
|
||||
override fun fromJSON(data: String): Trigger {
|
||||
val d = JSONObject(data)
|
||||
units = JsonHelper.safeGetString(d, "units")!!
|
||||
units = GlucoseUnit.fromText(JsonHelper.safeGetString(d, "units", Constants.MGDL))
|
||||
val type = DeltaType.valueOf(JsonHelper.safeGetString(d, "deltaType", ""))
|
||||
val value = JsonHelper.safeGetDouble(d, "value")
|
||||
delta =
|
||||
if (units == Constants.MMOL) InputDelta(resourceHelper, value, (-MMOL_MAX), MMOL_MAX, 0.1, DecimalFormat("0.1"), type)
|
||||
if (units == GlucoseUnit.MMOL) InputDelta(resourceHelper, value, (-MMOL_MAX), MMOL_MAX, 0.1, DecimalFormat("0.1"), type)
|
||||
else InputDelta(resourceHelper, value, (-MGDL_MAX), MGDL_MAX, 1.0, DecimalFormat("1"), type)
|
||||
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")!!))
|
||||
return this
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.widget.LinearLayout
|
|||
import com.google.common.base.Optional
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputTime
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputWeekDay
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.widget.LinearLayout
|
|||
import com.google.common.base.Optional
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.automation.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputTimeRange
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps
|
|||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.inject.Singleton;
|
|||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.combo.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package info.nightscout.androidaps.data;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.collection.LongSparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import org.joda.time.DateTime;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
@ -18,20 +17,19 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.interfaces.Config;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Pump;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.Round;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
public class Profile {
|
||||
public class ProfileImplOld implements Profile {
|
||||
@Inject public AAPSLogger aapsLogger;
|
||||
@Inject public ActivePlugin activePlugin;
|
||||
@Inject public ResourceHelper resourceHelper;
|
||||
|
@ -43,7 +41,7 @@ public class Profile {
|
|||
private final HasAndroidInjector injector;
|
||||
|
||||
private JSONObject json;
|
||||
private String units;
|
||||
private String jsonUnits;
|
||||
private double dia; // TODO change to insulinInterface link
|
||||
private TimeZone timeZone;
|
||||
private JSONArray isf;
|
||||
|
@ -63,7 +61,7 @@ public class Profile {
|
|||
protected boolean isValid;
|
||||
protected boolean isValidated;
|
||||
|
||||
protected Profile(HasAndroidInjector injector) {
|
||||
protected ProfileImplOld(HasAndroidInjector injector) {
|
||||
injector.androidInjector().inject(this);
|
||||
this.injector = injector;
|
||||
}
|
||||
|
@ -77,33 +75,33 @@ public class Profile {
|
|||
}
|
||||
|
||||
// Constructor from profileStore JSON
|
||||
public Profile(HasAndroidInjector injector, JSONObject json, String units) {
|
||||
public ProfileImplOld(HasAndroidInjector injector, JSONObject json, GlucoseUnit units) {
|
||||
this(injector);
|
||||
init(json, 100, 0);
|
||||
if (this.units == null) {
|
||||
if (this.jsonUnits == null) {
|
||||
if (units != null)
|
||||
this.units = units;
|
||||
this.jsonUnits = units.getAsText();
|
||||
else {
|
||||
fabricPrivacy.logCustom("Profile failover failed too");
|
||||
this.units = Constants.MGDL;
|
||||
this.jsonUnits = Constants.MGDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor from profileStore JSON
|
||||
public Profile(HasAndroidInjector injector, JSONObject json) {
|
||||
public ProfileImplOld(HasAndroidInjector injector, JSONObject json) {
|
||||
this(injector);
|
||||
init(json, 100, 0);
|
||||
}
|
||||
|
||||
public Profile(HasAndroidInjector injector, JSONObject json, int percentage, int timeshift) {
|
||||
public ProfileImplOld(HasAndroidInjector injector, JSONObject json, int percentage, int timeshift) {
|
||||
this(injector);
|
||||
init(json, percentage, timeshift);
|
||||
}
|
||||
|
||||
protected void init(JSONObject json, int percentage, int timeshift) {
|
||||
if (json == null) return;
|
||||
units = null;
|
||||
jsonUnits = null;
|
||||
dia = Constants.defaultDIA;
|
||||
timeZone = TimeZone.getDefault();
|
||||
isf_v = null;
|
||||
|
@ -120,7 +118,7 @@ public class Profile {
|
|||
this.json = json;
|
||||
try {
|
||||
if (json.has("units"))
|
||||
units = json.getString("units").toLowerCase();
|
||||
jsonUnits = json.getString("units").toLowerCase();
|
||||
if (json.has("dia"))
|
||||
dia = json.getDouble("dia");
|
||||
if (json.has("timezone"))
|
||||
|
@ -150,7 +148,7 @@ public class Profile {
|
|||
public JSONObject getData() {
|
||||
if (!json.has("units"))
|
||||
try {
|
||||
json.put("units", units);
|
||||
json.put("units", jsonUnits);
|
||||
} catch (JSONException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
|
@ -163,11 +161,12 @@ public class Profile {
|
|||
|
||||
// mmol or mg/dl
|
||||
public void setUnits(String units) {
|
||||
this.units = units;
|
||||
this.jsonUnits = units;
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return units;
|
||||
public GlucoseUnit getUnits() {
|
||||
if (jsonUnits.equals(Constants.MMOL)) return GlucoseUnit.MMOL;
|
||||
else return GlucoseUnit.MGDL;
|
||||
}
|
||||
|
||||
TimeZone getTimeZone() {
|
||||
|
@ -372,20 +371,11 @@ public class Profile {
|
|||
return lastValue;
|
||||
}
|
||||
|
||||
public static String format_HH_MM(Integer timeAsSeconds) {
|
||||
String time;
|
||||
int hour = timeAsSeconds / 60 / 60;
|
||||
int minutes = (timeAsSeconds - hour * 60 * 60) / 60;
|
||||
DecimalFormat df = new DecimalFormat("00");
|
||||
time = df.format(hour) + ":" + df.format(minutes);
|
||||
return time;
|
||||
}
|
||||
|
||||
private String getValuesList(LongSparseArray<Double> array, LongSparseArray<Double> array2, DecimalFormat format, String units) {
|
||||
String retValue = "";
|
||||
|
||||
for (Integer index = 0; index < array.size(); index++) {
|
||||
retValue += format_HH_MM((int) array.keyAt(index));
|
||||
retValue += dateUtil.format_HH_MM((int) array.keyAt(index));
|
||||
retValue += " ";
|
||||
retValue += format.format(array.valueAt(index));
|
||||
if (array2 != null) {
|
||||
|
@ -400,15 +390,15 @@ public class Profile {
|
|||
}
|
||||
|
||||
public double getIsfMgdl() {
|
||||
return toMgdl(getIsfTimeFromMidnight(secondsFromMidnight()), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
|
||||
}
|
||||
|
||||
public double getIsfMgdl(long time) {
|
||||
return toMgdl(getIsfTimeFromMidnight(secondsFromMidnight(time)), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
|
||||
}
|
||||
|
||||
public double getIsfMgdlTimeFromMidnight(int timeAsSeconds) {
|
||||
return toMgdl(getIsfTimeFromMidnight(timeAsSeconds), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(timeAsSeconds), getUnits());
|
||||
}
|
||||
|
||||
public double getIsfTimeFromMidnight(int timeAsSeconds) {
|
||||
|
@ -431,17 +421,17 @@ public class Profile {
|
|||
for (int index = 0; index < isf_v.size(); index++) {
|
||||
int tas = (int) isf_v.keyAt(index);
|
||||
double value = isf_v.valueAt(index);
|
||||
ret[index] = new ProfileValue(tas, toMgdl(value, units));
|
||||
ret[index] = new ProfileValue(tas, info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(value, getUnits()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public double getIc() {
|
||||
return getIcTimeFromMidnight(secondsFromMidnight());
|
||||
return getIcTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
|
||||
}
|
||||
|
||||
public double getIc(long time) {
|
||||
return getIcTimeFromMidnight(secondsFromMidnight(time));
|
||||
return getIcTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time));
|
||||
}
|
||||
|
||||
public double getIcTimeFromMidnight(int timeAsSeconds) {
|
||||
|
@ -470,11 +460,11 @@ public class Profile {
|
|||
}
|
||||
|
||||
public double getBasal() {
|
||||
return getBasalTimeFromMidnight(secondsFromMidnight());
|
||||
return getBasalTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
|
||||
}
|
||||
|
||||
public double getBasal(long time) {
|
||||
return getBasalTimeFromMidnight(secondsFromMidnight(time));
|
||||
return getBasalTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time));
|
||||
}
|
||||
|
||||
public synchronized double getBasalTimeFromMidnight(int timeAsSeconds) {
|
||||
|
@ -490,26 +480,8 @@ public class Profile {
|
|||
return getValuesList(basal_v, null, new DecimalFormat("0.00"), resourceHelper.gs(R.string.profile_ins_units_per_hour));
|
||||
}
|
||||
|
||||
public static class ProfileValue {
|
||||
public ProfileValue(int timeAsSeconds, double value) {
|
||||
this.timeAsSeconds = timeAsSeconds;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int timeAsSeconds;
|
||||
public double value;
|
||||
|
||||
|
||||
public boolean equals(Object otherObject) {
|
||||
if (!(otherObject instanceof ProfileValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ProfileValue otherProfileValue = (ProfileValue) otherObject;
|
||||
|
||||
return (timeAsSeconds == otherProfileValue.timeAsSeconds) && Round.isSame(value, otherProfileValue.value);
|
||||
|
||||
}
|
||||
@NonNull @Override public JSONObject toNsJson() {
|
||||
return getData();
|
||||
}
|
||||
|
||||
public synchronized ProfileValue[] getBasalValues() {
|
||||
|
@ -526,18 +498,19 @@ public class Profile {
|
|||
}
|
||||
|
||||
public double getTargetMgdl() {
|
||||
return getTargetMgdl(secondsFromMidnight());
|
||||
return getTargetMgdl(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
|
||||
}
|
||||
|
||||
public double getTargetMgdl(int timeAsSeconds) {
|
||||
return toMgdl((getTargetLowTimeFromMidnight(timeAsSeconds) + getTargetHighTimeFromMidnight(timeAsSeconds)) / 2, units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl((getTargetLowTimeFromMidnight(timeAsSeconds) + getTargetHighTimeFromMidnight(timeAsSeconds)) / 2, getUnits());
|
||||
}
|
||||
|
||||
public double getTargetLowMgdl() {
|
||||
return toMgdl(getTargetLowTimeFromMidnight(secondsFromMidnight()), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
|
||||
}
|
||||
|
||||
public double getTargetLowMgdl(long time) {
|
||||
return toMgdl(getTargetLowTimeFromMidnight(secondsFromMidnight(time)), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
|
||||
}
|
||||
|
||||
double getTargetLowTimeFromMidnight(int timeAsSeconds) {
|
||||
|
@ -547,25 +520,25 @@ public class Profile {
|
|||
}
|
||||
|
||||
public double getTargetLowMgdlTimeFromMidnight(int timeAsSeconds) {
|
||||
return toMgdl(getTargetLowTimeFromMidnight(timeAsSeconds), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(timeAsSeconds), getUnits());
|
||||
}
|
||||
|
||||
public double getTargetHighMgdl() {
|
||||
return toMgdl(getTargetHighTimeFromMidnight(secondsFromMidnight()), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
|
||||
}
|
||||
|
||||
public double getTargetHighMgdl(long time) {
|
||||
return toMgdl(getTargetHighTimeFromMidnight(secondsFromMidnight(time)), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
|
||||
}
|
||||
|
||||
double getTargetHighTimeFromMidnight(int timeAsSeconds) {
|
||||
public double getTargetHighTimeFromMidnight(int timeAsSeconds) {
|
||||
if (targetHigh_v == null)
|
||||
targetHigh_v = convertToSparseArray(targetHigh);
|
||||
return getValueToTime(targetHigh_v, timeAsSeconds);
|
||||
}
|
||||
|
||||
public double getTargetHighMgdlTimeFromMidnight(int timeAsSeconds) {
|
||||
return toMgdl(getTargetHighTimeFromMidnight(timeAsSeconds), units);
|
||||
return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(timeAsSeconds), getUnits());
|
||||
}
|
||||
|
||||
public static class TargetValue {
|
||||
|
@ -606,17 +579,17 @@ public class Profile {
|
|||
for (int index = 0; index < targetLow_v.size(); index++) {
|
||||
int tas = (int) targetLow_v.keyAt(index);
|
||||
double target = (targetLow_v.valueAt(index) + targetHigh_v.valueAt(index)) / 2;
|
||||
ret[index] = new ProfileValue(tas, toMgdl(target, units));
|
||||
ret[index] = new ProfileValue(tas, info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(target, getUnits()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String getTargetList() {
|
||||
@NonNull public String getTargetList() {
|
||||
if (targetLow_v == null)
|
||||
targetLow_v = convertToSparseArray(targetLow);
|
||||
if (targetHigh_v == null)
|
||||
targetHigh_v = convertToSparseArray(targetHigh);
|
||||
return getValuesList(targetLow_v, targetHigh_v, new DecimalFormat("0.0"), getUnits());
|
||||
return getValuesList(targetLow_v, targetHigh_v, new DecimalFormat("0.0"), getUnits().getAsText());
|
||||
}
|
||||
|
||||
public double getMaxDailyBasal() {
|
||||
|
@ -628,85 +601,6 @@ public class Profile {
|
|||
return max;
|
||||
}
|
||||
|
||||
public static int secondsFromMidnight() {
|
||||
// long passed = dateUtil._now() - MidnightTime.calc();
|
||||
long passed = new DateTime().getMillisOfDay();
|
||||
return (int) (passed / 1000);
|
||||
}
|
||||
|
||||
public static int secondsFromMidnight(long date) {
|
||||
//long midnight = MidnightTime.calc(date);
|
||||
//long passed = date - midnight;
|
||||
long passed = new DateTime(date).getMillisOfDay();
|
||||
return (int) (passed / 1000);
|
||||
}
|
||||
|
||||
public static double toMgdl(double value, String units) {
|
||||
if (units.equals(Constants.MGDL)) return value;
|
||||
else return value * Constants.MMOLL_TO_MGDL;
|
||||
}
|
||||
|
||||
public static double toMmol(double value, String units) {
|
||||
if (units.equals(Constants.MGDL)) return value * Constants.MGDL_TO_MMOLL;
|
||||
else return value;
|
||||
}
|
||||
|
||||
public static double fromMgdlToUnits(double value, String units) {
|
||||
if (units.equals(Constants.MGDL)) return value;
|
||||
else return value * Constants.MGDL_TO_MMOLL;
|
||||
}
|
||||
|
||||
public static double fromMmolToUnits(double value, String units) {
|
||||
if (units.equals(Constants.MMOL)) return value;
|
||||
else return value * Constants.MMOLL_TO_MGDL;
|
||||
}
|
||||
|
||||
public static double toUnits(double valueInMgdl, double valueInMmol, String units) {
|
||||
if (units.equals(Constants.MGDL)) return valueInMgdl;
|
||||
else return valueInMmol;
|
||||
}
|
||||
|
||||
public static String toUnitsString(double valueInMgdl, double valueInMmol, String units) {
|
||||
if (units.equals(Constants.MGDL)) return DecimalFormatter.INSTANCE.to0Decimal(valueInMgdl);
|
||||
else return DecimalFormatter.INSTANCE.to1Decimal(valueInMmol);
|
||||
}
|
||||
|
||||
public static String toSignedUnitsString(double valueInMgdl, double valueInMmol, String units) {
|
||||
if (units.equals(Constants.MGDL))
|
||||
return (valueInMgdl > 0 ? "+" : "") + DecimalFormatter.INSTANCE.to0Decimal(valueInMgdl);
|
||||
else return (valueInMmol > 0 ? "+" : "") + DecimalFormatter.INSTANCE.to1Decimal(valueInMmol);
|
||||
}
|
||||
|
||||
public static double toCurrentUnits(ProfileFunction profileFunction, double anyBg) {
|
||||
if (anyBg < 32) return fromMmolToUnits(anyBg, profileFunction.getUnits());
|
||||
else return fromMgdlToUnits(anyBg, profileFunction.getUnits());
|
||||
}
|
||||
|
||||
public static double toCurrentUnits(String units, double anyBg) {
|
||||
if (anyBg < 32) return fromMmolToUnits(anyBg, units);
|
||||
else return fromMgdlToUnits(anyBg, units);
|
||||
}
|
||||
|
||||
public static String toCurrentUnitsString(ProfileFunction profileFunction, double anyBg) {
|
||||
if (anyBg < 32)
|
||||
return toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits());
|
||||
else
|
||||
return toUnitsString(anyBg, anyBg * Constants.MGDL_TO_MMOLL, profileFunction.getUnits());
|
||||
}
|
||||
|
||||
// targets are stored in mg/dl but profile vary
|
||||
public static String toTargetRangeString(double low, double high, String sourceUnits, String units) {
|
||||
double lowMgdl = toMgdl(low, sourceUnits);
|
||||
double highMgdl = toMgdl(high, sourceUnits);
|
||||
double lowMmol = toMmol(low, sourceUnits);
|
||||
double highMmol = toMmol(high, sourceUnits);
|
||||
if (low == high)
|
||||
return toUnitsString(lowMgdl, lowMmol, units);
|
||||
else
|
||||
return toUnitsString(lowMgdl, lowMmol, units) + " - " + toUnitsString(highMgdl, highMmol, units);
|
||||
|
||||
}
|
||||
|
||||
public double percentageBasalSum() {
|
||||
double result = 0d;
|
||||
for (int i = 0; i < 24; i++) {
|
||||
|
@ -735,7 +629,7 @@ public class Profile {
|
|||
public Profile convertToNonCustomizedProfile() {
|
||||
JSONObject o = new JSONObject();
|
||||
try {
|
||||
o.put("units", units);
|
||||
o.put("units", jsonUnits);
|
||||
o.put("dia", dia);
|
||||
o.put("timezone", timeZone.getID());
|
||||
// SENS
|
||||
|
@ -837,28 +731,6 @@ public class Profile {
|
|||
} catch (JSONException e) {
|
||||
aapsLogger.error("Unhandled exception" + e);
|
||||
}
|
||||
return new Profile(injector, o);
|
||||
return new ProfileImplOld(injector, o);
|
||||
}
|
||||
|
||||
|
||||
public boolean areProfileBasalPatternsSame(Profile otherProfile) {
|
||||
|
||||
if (!Round.isSame(this.baseBasalSum(), otherProfile.baseBasalSum()))
|
||||
return false;
|
||||
|
||||
ProfileValue[] basalValues = this.getBasalValues();
|
||||
ProfileValue[] otherBasalValues = otherProfile.getBasalValues();
|
||||
|
||||
if (basalValues.length != otherBasalValues.length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < basalValues.length; i++) {
|
||||
if (!basalValues[i].equals(otherBasalValues[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.data
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -147,7 +148,7 @@ class PumpEnactResult(injector: HasAndroidInjector) {
|
|||
|
||||
isPercent -> {
|
||||
// Nightscout is expecting absolute value
|
||||
val abs = Round.roundTo(profile.basal * percent / 100, 0.01)
|
||||
val abs = Round.roundTo(profile.getBasal() * percent / 100, 0.01)
|
||||
result.put("rate", abs)
|
||||
result.put("duration", duration)
|
||||
}
|
||||
|
|
|
@ -18,8 +18,9 @@ import javax.inject.Inject;
|
|||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.ProfileImplOld;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
|
@ -114,7 +115,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
|||
public Profile getProfileObject() {
|
||||
if (profile == null)
|
||||
try {
|
||||
profile = new Profile(injector, new JSONObject(profileJson), percentage, timeshift);
|
||||
profile = new ProfileImplOld(injector, new JSONObject(profileJson), percentage, timeshift);
|
||||
} catch (Exception e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
aapsLogger.error("Unhandled exception: " + profileJson);
|
||||
|
|
|
@ -8,9 +8,9 @@ import java.util.Objects;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
|
|
|
@ -18,7 +18,7 @@ import javax.inject.Inject;
|
|||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.database.entities.Bolus;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.interfaces.Insulin;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package info.nightscout.androidaps.core.di
|
||||
package info.nightscout.androidaps.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.data.ProfileImplOld
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.db.ExtendedBolus
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -23,7 +24,7 @@ abstract class CoreDataClassesModule {
|
|||
@ContributesAndroidInjector abstract fun apsResultInjector(): APSResult
|
||||
@ContributesAndroidInjector abstract fun autosensDataInjector(): AutosensData
|
||||
|
||||
@ContributesAndroidInjector abstract fun profileInjector(): Profile
|
||||
@ContributesAndroidInjector abstract fun profileInjector(): ProfileImplOld
|
||||
@ContributesAndroidInjector abstract fun profileStoreInjector(): ProfileStore
|
||||
@ContributesAndroidInjector abstract fun treatmentInjector(): Treatment
|
||||
@ContributesAndroidInjector abstract fun profileSwitchInjector(): ProfileSwitch
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.core.di
|
||||
package info.nightscout.androidaps.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.core.di
|
||||
package info.nightscout.androidaps.di
|
||||
|
||||
import android.content.Context
|
||||
import android.preference.PreferenceManager
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.core.di
|
||||
package info.nightscout.androidaps.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
|
@ -12,9 +12,11 @@ import dagger.android.support.DaggerDialogFragment
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.core.databinding.DialogProfileviewerBinding
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.data.ProfileImplOld
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
|
@ -45,7 +47,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
private var customProfileJson: String = ""
|
||||
private var customProfileJson2: String = ""
|
||||
private var customProfileName: String = ""
|
||||
private var customProfileUnits: String = Constants.MGDL
|
||||
private var customProfileUnits: GlucoseUnit = GlucoseUnit.MGDL
|
||||
|
||||
private var _binding: DialogProfileviewerBinding? = null
|
||||
|
||||
|
@ -60,7 +62,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
time = bundle.getLong("time", 0)
|
||||
mode = Mode.values()[bundle.getInt("mode", Mode.RUNNING_PROFILE.ordinal)]
|
||||
customProfileJson = bundle.getString("customProfile", "")
|
||||
customProfileUnits = bundle.getString("customProfileUnits", Constants.MGDL)
|
||||
customProfileUnits = GlucoseUnit.fromText(bundle.getString("customProfileUnits", Constants.MGDL))
|
||||
customProfileName = bundle.getString("customProfileName", "")
|
||||
if (mode == Mode.PROFILE_COMPARE)
|
||||
customProfileJson2 = bundle.getString("customProfile2", "")
|
||||
|
@ -95,7 +97,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
Mode.CUSTOM_PROFILE -> {
|
||||
profile = Profile(injector, JSONObject(customProfileJson), customProfileUnits)
|
||||
profile = ProfileImplOld(injector, JSONObject(customProfileJson), customProfileUnits)
|
||||
profile2 = null
|
||||
profileName = customProfileName
|
||||
date = ""
|
||||
|
@ -103,8 +105,8 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
Mode.PROFILE_COMPARE -> {
|
||||
profile = Profile(injector, JSONObject(customProfileJson), customProfileUnits)
|
||||
profile2 = Profile(injector, JSONObject(customProfileJson2), customProfileUnits)
|
||||
profile = ProfileImplOld(injector, JSONObject(customProfileJson), customProfileUnits)
|
||||
profile2 = ProfileImplOld(injector, JSONObject(customProfileJson2), customProfileUnits)
|
||||
profileName = customProfileName
|
||||
binding.headerIcon.setImageResource(R.drawable.ic_compare_profiles)
|
||||
date = ""
|
||||
|
@ -125,7 +127,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
if (mode == Mode.PROFILE_COMPARE)
|
||||
profile?.let { profile1 ->
|
||||
profile2?.let { profile2 ->
|
||||
binding.units.text = profileFunction.getUnits()
|
||||
binding.units.text = profileFunction.getUnits().asText
|
||||
binding.dia.text = HtmlHelper.fromHtml(formatColors("", profile1.dia, profile2.dia, DecimalFormat("0.00"), resourceHelper.gs(R.string.shorthour)))
|
||||
val profileNames = profileName!!.split("\n").toTypedArray()
|
||||
binding.activeprofile.text = HtmlHelper.fromHtml(formatColors(profileNames[0], profileNames[1]))
|
||||
|
@ -142,7 +144,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
}
|
||||
else
|
||||
profile?.let {
|
||||
binding.units.text = it.units
|
||||
binding.units.text = it.units.asText
|
||||
binding.dia.text = resourceHelper.gs(R.string.format_hours, it.dia)
|
||||
binding.activeprofile.text = profileName
|
||||
binding.date.text = date
|
||||
|
@ -168,7 +170,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
bundle.putInt("mode", mode.ordinal)
|
||||
bundle.putString("customProfile", customProfileJson)
|
||||
bundle.putString("customProfileName", customProfileName)
|
||||
bundle.putString("customProfileUnits", customProfileUnits)
|
||||
bundle.putString("customProfileUnits", customProfileUnits.asText)
|
||||
if (mode == Mode.PROFILE_COMPARE)
|
||||
bundle.putString("customProfile2", customProfileJson2)
|
||||
}
|
||||
|
@ -208,7 +210,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
val val1 = profile1.getBasalTimeFromMidnight(hour * 60 * 60)
|
||||
val val2 = profile2.getBasalTimeFromMidnight(hour * 60 * 60)
|
||||
if (val1 != prev1 || val2 != prev2) {
|
||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.00"), " " + resourceHelper.gs(R.string.profile_ins_units_per_hour)))
|
||||
s.append(formatColors(dateUtil.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.00"), " " + resourceHelper.gs(R.string.profile_ins_units_per_hour)))
|
||||
s.append("<br>")
|
||||
}
|
||||
prev1 = val1
|
||||
|
@ -231,7 +233,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
val val1 = profile1.getIcTimeFromMidnight(hour * 60 * 60)
|
||||
val val2 = profile2.getIcTimeFromMidnight(hour * 60 * 60)
|
||||
if (val1 != prev1 || val2 != prev2) {
|
||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), " " + resourceHelper.gs(R.string.profile_carbs_per_unit)))
|
||||
s.append(formatColors(dateUtil.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), " " + resourceHelper.gs(R.string.profile_carbs_per_unit)))
|
||||
s.append("<br>")
|
||||
}
|
||||
prev1 = val1
|
||||
|
@ -249,7 +251,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
val val1 = Profile.fromMgdlToUnits(profile1.getIsfMgdlTimeFromMidnight(hour * 60 * 60), units)
|
||||
val val2 = Profile.fromMgdlToUnits(profile2.getIsfMgdlTimeFromMidnight(hour * 60 * 60), units)
|
||||
if (val1 != prev1 || val2 != prev2) {
|
||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), units + " " + resourceHelper.gs(R.string.profile_per_unit)))
|
||||
s.append(formatColors(dateUtil.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), units.asText + " " + resourceHelper.gs(R.string.profile_per_unit)))
|
||||
s.append("<br>")
|
||||
}
|
||||
prev1 = val1
|
||||
|
@ -270,8 +272,8 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
val val1h = profile1.getTargetHighMgdlTimeFromMidnight(hour * 60 * 60)
|
||||
val val2l = profile2.getTargetLowMgdlTimeFromMidnight(hour * 60 * 60)
|
||||
val val2h = profile2.getTargetHighMgdlTimeFromMidnight(hour * 60 * 60)
|
||||
val txt1 = Profile.format_HH_MM(hour * 60 * 60) + " " + Profile.toUnitsString(val1l, val1l * Constants.MGDL_TO_MMOLL, units) + " - " + Profile.toUnitsString(val1h, val1h * Constants.MGDL_TO_MMOLL, units) + " " + units
|
||||
val txt2 = Profile.format_HH_MM(hour * 60 * 60) + " " + Profile.toUnitsString(val2l, val2l * Constants.MGDL_TO_MMOLL, units) + " - " + Profile.toUnitsString(val2h, val2h * Constants.MGDL_TO_MMOLL, units) + " " + units
|
||||
val txt1 = dateUtil.format_HH_MM(hour * 60 * 60) + " " + Profile.toUnitsString(val1l, val1l * Constants.MGDL_TO_MMOLL, units) + " - " + Profile.toUnitsString(val1h, val1h * Constants.MGDL_TO_MMOLL, units) + " " + units
|
||||
val txt2 = dateUtil.format_HH_MM(hour * 60 * 60) + " " + Profile.toUnitsString(val2l, val2l * Constants.MGDL_TO_MMOLL, units) + " - " + Profile.toUnitsString(val2h, val2h * Constants.MGDL_TO_MMOLL, units) + " " + units
|
||||
if (val1l != prev1l || val1h != prev1h || val2l != prev2l || val2h != prev2h) {
|
||||
s.append(formatColors(txt1, txt2))
|
||||
s.append("<br>")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.extensions
|
||||
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.embedments.InterfaceIDs
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
import info.nightscout.androidaps.database.entities.ExtendedBolus
|
||||
|
@ -158,11 +158,11 @@ fun ExtendedBolus.iobCalc(time: Long, profile: Profile, lastAutosensResult: Auto
|
|||
val realDuration = getPassedDurationToTimeInMinutes(time)
|
||||
var sensitivityRatio = lastAutosensResult.ratio
|
||||
val normalTarget = 100.0
|
||||
if (exercise_mode && isTempTarget && profile.targetMgdl >= normalTarget + 5) {
|
||||
if (exercise_mode && isTempTarget && profile.getTargetMgdl() >= normalTarget + 5) {
|
||||
// w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44
|
||||
// e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6
|
||||
val c = half_basal_exercise_target - normalTarget
|
||||
sensitivityRatio = c / (c + profile.targetMgdl - normalTarget)
|
||||
sensitivityRatio = c / (c + profile.getTargetMgdl() - normalTarget)
|
||||
}
|
||||
if (realDuration > 0) {
|
||||
var netBasalRate: Double
|
||||
|
|
|
@ -2,16 +2,17 @@ package info.nightscout.androidaps.extensions
|
|||
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import org.json.JSONObject
|
||||
|
||||
fun GlucoseValue.valueToUnits(units: String): Double =
|
||||
if (units == Constants.MGDL) value
|
||||
fun GlucoseValue.valueToUnits(units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) value
|
||||
else value * Constants.MGDL_TO_MMOLL
|
||||
|
||||
fun GlucoseValue.valueToUnitsString(units: String): String =
|
||||
if (units == Constants.MGDL) DecimalFormatter.to0Decimal(value)
|
||||
fun GlucoseValue.valueToUnitsString(units: GlucoseUnit): String =
|
||||
if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(value)
|
||||
else DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL)
|
||||
|
||||
fun GlucoseValue.toJson(dateUtil: DateUtil): JSONObject =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.extensions
|
||||
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.extensions
|
||||
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.embedments.InterfaceIDs
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
||||
|
@ -178,11 +178,11 @@ fun TemporaryBasal.iobCalc(time: Long, profile: Profile, lastAutosensResult: Aut
|
|||
var netBasalAmount = 0.0
|
||||
var sensitivityRatio = lastAutosensResult.ratio
|
||||
val normalTarget = 100.0
|
||||
if (exercise_mode && isTempTarget && profile.targetMgdl >= normalTarget + 5) {
|
||||
if (exercise_mode && isTempTarget && profile.getTargetMgdl() >= normalTarget + 5) {
|
||||
// w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44
|
||||
// e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6
|
||||
val c = half_basal_exercise_target - normalTarget
|
||||
sensitivityRatio = c / (c + profile.targetMgdl - normalTarget)
|
||||
sensitivityRatio = c / (c + profile.getTargetMgdl() - normalTarget)
|
||||
}
|
||||
if (realDuration > 0) {
|
||||
var netBasalRate: Double
|
||||
|
|
|
@ -2,9 +2,10 @@ package info.nightscout.androidaps.extensions
|
|||
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
|
@ -13,19 +14,19 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
|||
import org.json.JSONObject
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
fun TemporaryTarget.lowValueToUnitsToString(units: String): String =
|
||||
if (units == Constants.MGDL) DecimalFormatter.to0Decimal(this.lowTarget)
|
||||
fun TemporaryTarget.lowValueToUnitsToString(units: GlucoseUnit): String =
|
||||
if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(this.lowTarget)
|
||||
else DecimalFormatter.to1Decimal(this.lowTarget * Constants.MGDL_TO_MMOLL)
|
||||
|
||||
fun TemporaryTarget.highValueToUnitsToString(units: String): String =
|
||||
if (units == Constants.MGDL) DecimalFormatter.to0Decimal(this.highTarget)
|
||||
fun TemporaryTarget.highValueToUnitsToString(units: GlucoseUnit): String =
|
||||
if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(this.highTarget)
|
||||
else DecimalFormatter.to1Decimal(this.highTarget * Constants.MGDL_TO_MMOLL)
|
||||
|
||||
fun TemporaryTarget.target(): Double =
|
||||
(this.lowTarget + this.highTarget) / 2
|
||||
|
||||
fun TemporaryTarget.friendlyDescription(units: String, resourceHelper: ResourceHelper): String =
|
||||
Profile.toTargetRangeString(lowTarget, highTarget, Constants.MGDL, units) +
|
||||
fun TemporaryTarget.friendlyDescription(units: GlucoseUnit, resourceHelper: ResourceHelper): String =
|
||||
Profile.toTargetRangeString(lowTarget, highTarget, GlucoseUnit.MGDL, units) +
|
||||
units +
|
||||
"@" + resourceHelper.gs(R.string.format_mins, TimeUnit.MILLISECONDS.toMinutes(duration)) + "(" + reason.text + ")"
|
||||
|
||||
|
@ -43,7 +44,7 @@ fun temporaryTargetFromNsIdForInvalidating(nsId: String): TemporaryTarget =
|
|||
)!!
|
||||
|
||||
fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
|
||||
val units = JsonHelper.safeGetString(jsonObject, "units", Constants.MGDL)
|
||||
val units = GlucoseUnit.fromText(JsonHelper.safeGetString(jsonObject, "units", Constants.MGDL))
|
||||
val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
|
||||
val duration = JsonHelper.safeGetLongAllowNull(jsonObject, "duration", null) ?: return null
|
||||
var low = JsonHelper.safeGetDouble(jsonObject, "targetBottom")
|
||||
|
@ -61,7 +62,7 @@ fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
|
|||
|
||||
if (duration > 0L) {
|
||||
// not ending event
|
||||
if (units == Constants.MMOL) {
|
||||
if (units == GlucoseUnit.MMOL) {
|
||||
if (low < Constants.MIN_TT_MMOL) return null
|
||||
if (low > Constants.MAX_TT_MMOL) return null
|
||||
if (high < Constants.MIN_TT_MMOL) return null
|
||||
|
@ -87,7 +88,7 @@ fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
|
|||
return tt
|
||||
}
|
||||
|
||||
fun TemporaryTarget.toJson(units: String, dateUtil: DateUtil): JSONObject =
|
||||
fun TemporaryTarget.toJson(units: GlucoseUnit, dateUtil: DateUtil): JSONObject =
|
||||
JSONObject()
|
||||
.put("eventType", TherapyEvent.Type.TEMPORARY_TARGET.text)
|
||||
.put("duration", T.msecs(duration).mins())
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.extensions
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSMbg
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
|
@ -34,10 +35,18 @@ fun TherapyEvent.GlucoseUnit.toConstant(): String =
|
|||
if (this == TherapyEvent.GlucoseUnit.MGDL) Constants.MGDL
|
||||
else Constants.MMOL
|
||||
|
||||
fun TherapyEvent.GlucoseUnit.toMainUnit(): GlucoseUnit =
|
||||
if (this == TherapyEvent.GlucoseUnit.MGDL) GlucoseUnit.MGDL
|
||||
else GlucoseUnit.MMOL
|
||||
|
||||
fun TherapyEvent.GlucoseUnit.Companion.fromConstant(units: String): TherapyEvent.GlucoseUnit =
|
||||
if (units == Constants.MGDL) TherapyEvent.GlucoseUnit.MGDL
|
||||
else TherapyEvent.GlucoseUnit.MMOL
|
||||
|
||||
fun TherapyEvent.GlucoseUnit.Companion.fromConstant(units: GlucoseUnit): TherapyEvent.GlucoseUnit =
|
||||
if (units == GlucoseUnit.MGDL) TherapyEvent.GlucoseUnit.MGDL
|
||||
else TherapyEvent.GlucoseUnit.MMOL
|
||||
|
||||
fun therapyEventFromNsMbg(mbg: NSMbg) =
|
||||
TherapyEvent(
|
||||
type = TherapyEvent.Type.NS_MBG,
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.interfaces
|
|||
|
||||
import android.text.Spanned
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.queue.commands.CustomCommand
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.queue.commands.Command
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
|
||||
/**
|
||||
* Constraints interface
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.Constants
|
||||
|
||||
enum class GlucoseUnit(val asText: String) {
|
||||
MGDL(Constants.MGDL),
|
||||
MMOL(Constants.MMOL);
|
||||
|
||||
companion object {
|
||||
|
||||
fun fromText(name: String) = values().firstOrNull { it.asText == name } ?: MGDL
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.interfaces
|
|||
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.data.MealData
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.ExtendedBolus
|
||||
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.interfaces.Profile.ProfileValue
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter.to1Decimal
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import org.joda.time.DateTime
|
||||
import org.json.JSONObject
|
||||
|
||||
interface Profile {
|
||||
|
||||
fun isValid(from: String): Boolean
|
||||
fun isValid(from: String, notify: Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Units used for ISF & target
|
||||
*/
|
||||
val units: GlucoseUnit
|
||||
|
||||
//@Deprecated("Replace in favor of accessing InsulinProfile")
|
||||
val dia: Double
|
||||
|
||||
@Deprecated("????why here")
|
||||
val percentage: Int
|
||||
@Deprecated("????why here")
|
||||
val timeshift: Int
|
||||
|
||||
/**
|
||||
* Basal value according to "now"
|
||||
*/
|
||||
fun getBasal(): Double
|
||||
|
||||
/**
|
||||
* Basal value according to timestamp
|
||||
*/
|
||||
fun getBasal(timestamp: Long): Double
|
||||
|
||||
/**
|
||||
* I:C value according to "now"
|
||||
*/
|
||||
fun getIc(): Double
|
||||
|
||||
/**
|
||||
* I:C value according to timestamp
|
||||
*/
|
||||
fun getIc(timestamp: Long): Double
|
||||
|
||||
/**
|
||||
* ISF value according to "now"" in MGDL
|
||||
*/
|
||||
fun getIsfMgdl(): Double
|
||||
/**
|
||||
* ISF value according to timestamp in MGDL
|
||||
*/
|
||||
fun getIsfMgdl(timestamp: Long): Double
|
||||
|
||||
/**
|
||||
* Average target value according to "now" in MGDL
|
||||
*/
|
||||
fun getTargetMgdl(): Double
|
||||
fun getTargetLowMgdl(): Double
|
||||
fun getTargetLowMgdl(timestamp: Long): Double
|
||||
fun getTargetHighMgdl(): Double
|
||||
fun getTargetHighMgdl(timestamp: Long): Double
|
||||
|
||||
/**
|
||||
* Basal value according to elapsed seconds from midnight
|
||||
*/
|
||||
fun getBasalTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
/**
|
||||
* I:C value according to elapsed seconds from midnight
|
||||
*/
|
||||
fun getIcTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
/**
|
||||
* ISF value according to elapsed seconds from midnight
|
||||
*/
|
||||
fun getIsfMgdlTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
/**
|
||||
* Low target value according to elapsed seconds from midnight
|
||||
*/
|
||||
fun getTargetLowMgdlTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
/**
|
||||
* High target value according to elapsed seconds from midnight
|
||||
*/
|
||||
fun getTargetHighTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
/**
|
||||
* High target value according to elapsed seconds from midnight in MGDL
|
||||
*/
|
||||
fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double
|
||||
|
||||
val icList: String
|
||||
val isfList: String
|
||||
val basalList: String
|
||||
val targetList: String
|
||||
|
||||
fun convertToNonCustomizedProfile(): Profile
|
||||
fun toNsJson(): JSONObject
|
||||
fun getMaxDailyBasal(): Double
|
||||
fun baseBasalSum(): Double
|
||||
fun percentageBasalSum(): Double
|
||||
|
||||
fun getBasalValues(): Array<ProfileValue>
|
||||
fun getIcs(): Array<ProfileValue>
|
||||
fun getIsfsMgdl(): Array<ProfileValue>
|
||||
fun getSingleTargetsMgdl(): Array<ProfileValue>
|
||||
|
||||
class ProfileValue(var timeAsSeconds: Int, var value: Double) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is ProfileValue) {
|
||||
return false
|
||||
}
|
||||
return timeAsSeconds == other.timeAsSeconds && Round.isSame(value, other.value)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = timeAsSeconds
|
||||
result = 31 * result + value.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
/*
|
||||
* Midnight time conversion
|
||||
*/
|
||||
fun secondsFromMidnight(): Int {
|
||||
val passed = DateTime().millisOfDay.toLong()
|
||||
return (passed / 1000).toInt()
|
||||
}
|
||||
|
||||
fun secondsFromMidnight(date: Long): Int {
|
||||
val passed = DateTime(date).millisOfDay.toLong()
|
||||
return (passed / 1000).toInt()
|
||||
}
|
||||
|
||||
/*
|
||||
* Units conversion
|
||||
*/
|
||||
|
||||
fun fromMgdlToUnits(value: Double, units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) value else value * Constants.MGDL_TO_MMOLL
|
||||
|
||||
fun fromMmolToUnits(value: Double, units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MMOL) value else value * Constants.MMOLL_TO_MGDL
|
||||
|
||||
fun toUnits(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) valueInMgdl else valueInMmol
|
||||
|
||||
fun toUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String =
|
||||
if (units == GlucoseUnit.MGDL) to0Decimal(valueInMgdl) else to1Decimal(valueInMmol)
|
||||
|
||||
fun toSignedUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String =
|
||||
if (units == GlucoseUnit.MGDL) (if (valueInMgdl > 0) "+" else "") + to0Decimal(valueInMgdl)
|
||||
else (if (valueInMmol > 0) "+" else "") + to1Decimal(valueInMmol)
|
||||
|
||||
fun toCurrentUnits(profileFunction: ProfileFunction, anyBg: Double): Double =
|
||||
if (anyBg < 32) fromMmolToUnits(anyBg, profileFunction.getUnits())
|
||||
else fromMgdlToUnits(anyBg, profileFunction.getUnits())
|
||||
|
||||
fun toCurrentUnits(units: GlucoseUnit, anyBg: Double): Double =
|
||||
if (anyBg < 32) fromMmolToUnits(anyBg, units)
|
||||
else fromMgdlToUnits(anyBg, units)
|
||||
|
||||
fun toCurrentUnitsString(profileFunction: ProfileFunction, anyBg: Double): String =
|
||||
if (anyBg < 32) toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits())
|
||||
else toUnitsString(anyBg, anyBg * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
|
||||
|
||||
fun toMgdl(value: Double, units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) value else value * Constants.MMOLL_TO_MGDL
|
||||
|
||||
fun toMmol(value: Double, units: GlucoseUnit): Double =
|
||||
if (units == GlucoseUnit.MGDL) value * Constants.MGDL_TO_MMOLL else value
|
||||
|
||||
// targets are stored in mg/dl but profile vary
|
||||
fun toTargetRangeString(low: Double, high: Double, sourceUnits: GlucoseUnit, units: GlucoseUnit): String {
|
||||
val lowMgdl = toMgdl(low, sourceUnits)
|
||||
val highMgdl = toMgdl(high, sourceUnits)
|
||||
val lowMmol = toMmol(low, sourceUnits)
|
||||
val highMmol = toMmol(high, sourceUnits)
|
||||
return if (low == high) toUnitsString(lowMgdl, lowMmol, units) else toUnitsString(lowMgdl, lowMmol, units) + " - " + toUnitsString(highMgdl, highMmol, units)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileStore
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
||||
interface ProfileFunction {
|
||||
|
@ -11,8 +9,7 @@ interface ProfileFunction {
|
|||
fun getProfileName(time: Long, customized: Boolean, showRemainingTime: Boolean): String
|
||||
fun isProfileValid(from: String): Boolean
|
||||
fun getProfile(): Profile?
|
||||
fun getUnits(): String
|
||||
fun getUnits(): GlucoseUnit
|
||||
fun getProfile(time: Long): Profile?
|
||||
fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile?
|
||||
fun prepareProfileSwitch(profileStore: ProfileStore, profileName: String, duration: Int, percentage: Int, timeShift: Int, date: Long): ProfileSwitch
|
||||
}
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.interfaces
|
|||
|
||||
import androidx.collection.ArrayMap
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.data.ProfileImplOld
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
import org.json.JSONException
|
||||
|
@ -11,6 +11,7 @@ import java.util.*
|
|||
import javax.inject.Inject
|
||||
|
||||
class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject) {
|
||||
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
|
||||
init {
|
||||
|
@ -55,7 +56,7 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject) {
|
|||
JsonHelper.safeGetJSONObject(store, profileName, null)?.let { profileObject ->
|
||||
// take units from profile and if N/A from store
|
||||
JsonHelper.safeGetStringAllowNull(profileObject, "units", JsonHelper.safeGetString(data, "units"))?.let { units ->
|
||||
profile = Profile(injector, profileObject, units)
|
||||
profile = ProfileImplOld(injector, profileObject, GlucoseUnit.fromText(units))
|
||||
cachedObjects[profileName] = profile
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.convertedToPercent
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
|
@ -16,8 +18,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.HtmlHelper.fromHtml
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.convertedToPercent
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.json.JSONException
|
||||
|
@ -388,7 +388,7 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
|
|||
percentMinChangeChange /= 100.0
|
||||
val lowThreshold = 1 - percentMinChangeChange
|
||||
val highThreshold = 1 + percentMinChangeChange
|
||||
var change = rate / profile.basal
|
||||
var change = rate / profile.getBasal()
|
||||
if (activeTemp != null) change = rate / activeTemp.convertedToAbsolute(now, profile)
|
||||
if (change < lowThreshold || change > highThreshold) {
|
||||
aapsLogger.debug(LTag.APS, "TRUE: Outside allowed range " + change * 100.0 + "%")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.configBuilder
|
||||
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.Constraints
|
||||
|
|
|
@ -5,13 +5,9 @@ import com.google.firebase.analytics.FirebaseAnalytics
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.interfaces.ProfileStore
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
@ -74,7 +70,7 @@ class ProfileFunctionImplementation @Inject constructor(
|
|||
|
||||
override fun getProfile(time: Long): Profile? = getProfile(time, activePlugin.activeTreatments)
|
||||
|
||||
override fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile? {
|
||||
fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile? {
|
||||
val activeProfile = activePlugin.activeProfileSource
|
||||
|
||||
//log.debug("Profile for: " + new Date(time).toLocaleString() + " : " + getProfileName(time));
|
||||
|
@ -98,8 +94,9 @@ class ProfileFunctionImplementation @Inject constructor(
|
|||
return null
|
||||
}
|
||||
|
||||
override fun getUnits(): String =
|
||||
sp.getString(R.string.key_units, Constants.MGDL)
|
||||
override fun getUnits(): GlucoseUnit =
|
||||
if (sp.getString(R.string.key_units, Constants.MGDL) == Constants.MGDL) GlucoseUnit.MGDL
|
||||
else GlucoseUnit.MMOL
|
||||
|
||||
override fun prepareProfileSwitch(profileStore: ProfileStore, profileName: String, duration: Int, percentage: Int, timeShift: Int, date: Long): ProfileSwitch {
|
||||
val profile = profileStore.getSpecificProfile(profileName)
|
||||
|
@ -108,7 +105,7 @@ class ProfileFunctionImplementation @Inject constructor(
|
|||
profileSwitch.date = date
|
||||
profileSwitch.source = Source.USER
|
||||
profileSwitch.profileName = profileName
|
||||
profileSwitch.profileJson = profile.data.toString()
|
||||
profileSwitch.profileJson = profile.toNsJson().toString()
|
||||
profileSwitch.durationInMinutes = duration
|
||||
profileSwitch.isCPP = percentage != 100 || timeShift != 0
|
||||
profileSwitch.timeshift = timeShift
|
||||
|
|
|
@ -11,7 +11,7 @@ import javax.inject.Inject;
|
|||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.database.entities.Carbs;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue