move to plugins module

This commit is contained in:
Milos Kozak 2022-11-11 17:46:09 +01:00
parent 417305d1f6
commit d108755814
138 changed files with 1246 additions and 1034 deletions

View file

@ -8,6 +8,7 @@
<w>actionstring</w> <w>actionstring</w>
<w>aidex</w> <w>aidex</w>
<w>alarmack</w> <w>alarmack</w>
<w>alexpr</w>
<w>allowednumbers</w> <w>allowednumbers</w>
<w>androidaps</w> <w>androidaps</w>
<w>autosens</w> <w>autosens</w>
@ -43,9 +44,14 @@
<w>dexcom</w> <w>dexcom</w>
<w>dexdrip</w> <w>dexdrip</w>
<w>diaconn</w> <w>diaconn</w>
<w>dlvoy</w>
<w>dttm</w>
<w>ecarbs</w>
<w>enteredby</w> <w>enteredby</w>
<w>enteredinsulin</w> <w>enteredinsulin</w>
<w>eoflow</w>
<w>eopatch</w> <w>eopatch</w>
<w>epss</w>
<w>eveningoutpost</w> <w>eveningoutpost</w>
<w>eversense</w> <w>eversense</w>
<w>extendedbolus</w> <w>extendedbolus</w>
@ -56,12 +62,15 @@
<w>gson</w> <w>gson</w>
<w>hmac</w> <w>hmac</w>
<w>iage</w> <w>iage</w>
<w>infinivocgm</w>
<w>insulet</w> <w>insulet</w>
<w>intelligo</w>
<w>iobtotal</w> <w>iobtotal</w>
<w>joda</w> <w>joda</w>
<w>libre</w> <w>libre</w>
<w>listdelimiter</w> <w>listdelimiter</w>
<w>localprofile</w> <w>localprofile</w>
<w>lyumjev</w>
<w>mdtp</w> <w>mdtp</w>
<w>medtronic</w> <w>medtronic</w>
<w>mgdl</w> <w>mgdl</w>
@ -74,6 +83,7 @@
<w>nightscout</w> <w>nightscout</w>
<w>notif</w> <w>notif</w>
<w>nsclient</w> <w>nsclient</w>
<w>oaps</w>
<w>okcancel</w> <w>okcancel</w>
<w>omnipod</w> <w>omnipod</w>
<w>openaps</w> <w>openaps</w>
@ -88,10 +98,12 @@
<w>profileswitch</w> <w>profileswitch</w>
<w>pumpbtcomm</w> <w>pumpbtcomm</w>
<w>pumpcontrol</w> <w>pumpcontrol</w>
<w>pumpdrivers</w>
<w>quickwizard</w> <w>quickwizard</w>
<w>readstatus</w> <w>readstatus</w>
<w>realduration</w> <w>realduration</w>
<w>refresheventsfromnightscout</w> <w>refresheventsfromnightscout</w>
<w>rfspy</w>
<w>rileylink</w> <w>rileylink</w>
<w>roboelectric</w> <w>roboelectric</w>
<w>rozman</w> <w>rozman</w>
@ -104,6 +116,8 @@
<w>soundid</w> <w>soundid</w>
<w>splitted</w> <w>splitted</w>
<w>ssid</w> <w>ssid</w>
<w>statuslight</w>
<w>statuslights</w>
<w>superbolus</w> <w>superbolus</w>
<w>targethigh</w> <w>targethigh</w>
<w>targetlow</w> <w>targetlow</w>
@ -119,6 +133,7 @@
<w>totp</w> <w>totp</w>
<w>tunedays</w> <w>tunedays</w>
<w>uart</w> <w>uart</w>
<w>unfinshed</w>
<w>urgentalarm</w> <w>urgentalarm</w>
<w>wizzardpage</w> <w>wizzardpage</w>
<w>xdrip</w> <w>xdrip</w>

View file

@ -0,0 +1,3 @@
package info.nightscout.rx.events
class EventSWUpdate(var redraw: Boolean) : Event()

View file

@ -222,9 +222,6 @@ dependencies {
// MainApp // MainApp
api "com.uber.rxdogtag2:rxdogtag:2.0.1" api "com.uber.rxdogtag2:rxdogtag:2.0.1"
// Overview
api 'com.google.android.flexbox:flexbox:3.0.0'
// APS // APS
api 'org.mozilla:rhino:1.7.14' api 'org.mozilla:rhino:1.7.14'

View file

@ -30,7 +30,7 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.wear.WearPlugin import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin

View file

@ -25,6 +25,7 @@ import info.nightscout.automation.di.AutomationModule
import info.nightscout.database.impl.DatabaseModule import info.nightscout.database.impl.DatabaseModule
import info.nightscout.implementation.di.ImplementationModule import info.nightscout.implementation.di.ImplementationModule
import info.nightscout.plugins.di.PluginsModule import info.nightscout.plugins.di.PluginsModule
import info.nightscout.plugins.di.SkinsModule
import info.nightscout.rx.di.RxModule import info.nightscout.rx.di.RxModule
import info.nightscout.shared.di.SharedModule import info.nightscout.shared.di.SharedModule
import info.nightscout.ui.di.UiModule import info.nightscout.ui.di.UiModule
@ -36,12 +37,10 @@ import javax.inject.Singleton
AndroidInjectionModule::class, AndroidInjectionModule::class,
AppModule::class, AppModule::class,
PluginsListModule::class, PluginsListModule::class,
SkinsModule::class,
ActivitiesModule::class, ActivitiesModule::class,
FragmentsModule::class, FragmentsModule::class,
ReceiversModule::class, ReceiversModule::class,
ServicesModule::class, ServicesModule::class,
ObjectivesModule::class,
WizardModule::class, WizardModule::class,
APSModule::class, APSModule::class,
WorkflowModule::class, WorkflowModule::class,

View file

@ -3,13 +3,13 @@ package info.nightscout.androidaps.di
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.activities.MyPreferenceFragment import info.nightscout.androidaps.activities.MyPreferenceFragment
import info.nightscout.androidaps.plugins.constraints.objectives.dialogs.NtpProgressDialog import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
import info.nightscout.androidaps.plugins.aps.OpenAPSFragment import info.nightscout.androidaps.plugins.aps.OpenAPSFragment
import info.nightscout.androidaps.plugins.aps.loop.LoopFragment import info.nightscout.androidaps.plugins.aps.loop.LoopFragment
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment import info.nightscout.plugins.constraints.objectives.ObjectivesFragment
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment import info.nightscout.plugins.general.actions.ActionsFragment
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
import info.nightscout.androidaps.plugins.general.overview.OverviewFragment import info.nightscout.androidaps.plugins.general.overview.OverviewFragment
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog

View file

@ -1,23 +1,2 @@
package info.nightscout.androidaps.di package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.*
@Module
@Suppress("unused")
abstract class ObjectivesModule {
@ContributesAndroidInjector abstract fun objectiveInjector(): Objective
@ContributesAndroidInjector abstract fun objective0Injector(): Objective0
@ContributesAndroidInjector abstract fun objective1Injector(): Objective1
@ContributesAndroidInjector abstract fun objective2Injector(): Objective2
@ContributesAndroidInjector abstract fun objective3Injector(): Objective3
@ContributesAndroidInjector abstract fun objective4Injector(): Objective4
@ContributesAndroidInjector abstract fun objective5Injector(): Objective5
@ContributesAndroidInjector abstract fun objective6Injector(): Objective6
@ContributesAndroidInjector abstract fun objective7Injector(): Objective7
@ContributesAndroidInjector abstract fun objective9Injector(): Objective9
@ContributesAndroidInjector abstract fun objective10Injector(): Objective10
}

View file

@ -15,9 +15,9 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin import info.nightscout.plugins.general.actions.ActionsPlugin
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.di
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.ui.widget.WidgetConfigureActivity import info.nightscout.ui.widget.WidgetConfigureActivity
import info.nightscout.androidaps.skins.SkinListPreference import info.nightscout.plugins.skins.SkinListPreference
import info.nightscout.ui.widget.Widget import info.nightscout.ui.widget.Widget
@Module @Module

View file

@ -6,14 +6,20 @@ import android.os.Bundle
import androidx.annotation.RawRes import androidx.annotation.RawRes
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.BolusProgressHelperActivity
import info.nightscout.ui.activities.ErrorHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.TDDStatsActivity import info.nightscout.ui.activities.TDDStatsActivity
import info.nightscout.ui.dialogs.CareDialog
import info.nightscout.ui.dialogs.ExtendedBolusDialog
import info.nightscout.ui.dialogs.FillDialog
import info.nightscout.ui.dialogs.ProfileSwitchDialog import info.nightscout.ui.dialogs.ProfileSwitchDialog
import info.nightscout.ui.dialogs.ProfileViewerDialog import info.nightscout.ui.dialogs.ProfileViewerDialog
import info.nightscout.ui.dialogs.TempBasalDialog
import info.nightscout.ui.dialogs.TempTargetDialog
import info.nightscout.ui.dialogs.WizardDialog import info.nightscout.ui.dialogs.WizardDialog
import javax.inject.Inject import javax.inject.Inject
@ -21,6 +27,7 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
override val mainActivityClass: Class<*> = MainActivity::class.java override val mainActivityClass: Class<*> = MainActivity::class.java
override val tddStatsActivity: Class<*> = TDDStatsActivity::class.java override val tddStatsActivity: Class<*> = TDDStatsActivity::class.java
override val historyBrowseActivity: Class<*> = HistoryBrowseActivity::class.java
override val errorHelperActivity: Class<*> = ErrorHelperActivity::class.java override val errorHelperActivity: Class<*> = ErrorHelperActivity::class.java
override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java
override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java
@ -50,6 +57,26 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
.show(fragmentManager, "ProfileSwitchDialog") .show(fragmentManager, "ProfileSwitchDialog")
} }
override fun runTempBasalDialog(fragmentManager: FragmentManager) {
TempBasalDialog()
.show(fragmentManager, "TempBasalDialog")
}
override fun runTempTargetDialog(fragmentManager: FragmentManager) {
TempTargetDialog()
.show(fragmentManager, "TempTargetDialog")
}
override fun runExtendedBolusDialog(fragmentManager: FragmentManager) {
ExtendedBolusDialog()
.show(fragmentManager, "ExtendedBolusDialog")
}
override fun runFillDialog(fragmentManager: FragmentManager) {
FillDialog()
.show(fragmentManager, "FillDialog")
}
override fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: ActivityNames.Mode, customProfile: String?, customProfileName: String?, customProfile2: String?) { override fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: ActivityNames.Mode, customProfile: String?, customProfileName: String?, customProfile2: String?) {
ProfileViewerDialog() ProfileViewerDialog()
.also { .also {
@ -61,6 +88,17 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
bundle.putString("customProfile2", customProfile2) bundle.putString("customProfile2", customProfile2)
} }
} }
.show(fragmentManager, "ProfileSwitchDialog") .show(fragmentManager, "ProfileViewer")
}
override fun runCareDialog(fragmentManager: FragmentManager, options: ActivityNames.EventType, event: Int) {
CareDialog()
.also {
it.arguments = Bundle().also { bundle ->
bundle.putInt("event", event)
bundle.putInt("options", options.ordinal)
}
}
.show(fragmentManager, "CareDialog")
} }
} }

View file

@ -33,6 +33,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import org.json.JSONException import org.json.JSONException
import javax.inject.Inject import javax.inject.Inject
@ -55,7 +56,8 @@ class OpenAPSAMAPlugin @Inject constructor(
private val fabricPrivacy: FabricPrivacy, private val fabricPrivacy: FabricPrivacy,
private val dateUtil: DateUtil, private val dateUtil: DateUtil,
private val repository: AppRepository, private val repository: AppRepository,
private val glucoseStatusProvider: GlucoseStatusProvider private val glucoseStatusProvider: GlucoseStatusProvider,
private val sp: SP
) : PluginBase( ) : PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.APS) .mainType(PluginType.APS)
@ -66,7 +68,7 @@ class OpenAPSAMAPlugin @Inject constructor(
.preferencesId(R.xml.pref_openapsama) .preferencesId(R.xml.pref_openapsama)
.description(R.string.description_ama), .description(R.string.description_ama),
aapsLogger, rh, injector aapsLogger, rh, injector
), APS { ), APS, Constraints {
// last values // last values
override var lastAPSRun: Long = 0 override var lastAPSRun: Long = 0
@ -207,4 +209,13 @@ class OpenAPSAMAPlugin @Inject constructor(
//deviceStatus.suggested = determineBasalResultAMA.json; //deviceStatus.suggested = determineBasalResultAMA.json;
} }
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
if (isEnabled()) {
val maxIobPref: Double = sp.getDouble(R.string.key_openapsma_max_iob, 1.5)
maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limitingiob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this)
maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), rh.gs(R.string.limitingiob, hardLimits.maxIobAMA(), rh.gs(R.string.hardlimit)), this)
}
return maxIob
}
} }

View file

@ -240,5 +240,14 @@ class OpenAPSSMBPlugin @Inject constructor(
return value return value
} }
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
if (isEnabled()) {
val maxIobPref: Double = sp.getDouble(R.string.key_openapssmb_max_iob, 3.0)
maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limitingiob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this)
maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), rh.gs(R.string.limitingiob, hardLimits.maxIobSMB(), rh.gs(R.string.hardlimit)), this)
}
return maxIob
}
fun provideDetermineBasalAdapter(): DetermineBasalAdapterInterface = DetermineBasalAdapterSMBJS(ScriptReader(context), injector) fun provideDetermineBasalAdapter(): DetermineBasalAdapterInterface = DetermineBasalAdapterSMBJS(ScriptReader(context), injector)
} }

View file

@ -29,7 +29,7 @@ import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.databinding.OverviewFragmentBinding import info.nightscout.plugins.databinding.OverviewFragmentBinding
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewBG import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPreferenceChange
@ -54,7 +54,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOve
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.skins.SkinProvider import info.nightscout.plugins.skins.SkinProvider
import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@ -88,6 +88,7 @@ import info.nightscout.plugins.source.DexcomPlugin
import info.nightscout.plugins.source.XdripPlugin import info.nightscout.plugins.source.XdripPlugin
import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData
import info.nightscout.plugins.ui.StatusLightHandler
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAcceptOpenLoopChange import info.nightscout.rx.events.EventAcceptOpenLoopChange

View file

@ -995,7 +995,7 @@ class DataHandlerMobile @Inject constructor(
ret += if (!result.isChangeRequested) { ret += if (!result.isChangeRequested) {
rh.gs(R.string.nochangerequested) + "\n" rh.gs(R.string.nochangerequested) + "\n"
} else if (result.rate == 0.0 && result.duration == 0) { } else if (result.rate == 0.0 && result.duration == 0) {
rh.gs(R.string.canceltemp) + "\n" rh.gs(R.string.cancel_temp) + "\n"
} else { } else {
rh.gs(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " + rh.gs(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " +
"(" + DecimalFormatter.to2Decimal(result.rate / activePlugin.activePump.baseBasalRate * 100) + "%)\n" + "(" + DecimalFormatter.to2Decimal(result.rate / activePlugin.activePump.baseBasalRate * 100) + "%)\n" +

View file

@ -4,6 +4,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.extensions.isPSEvent5minBack import info.nightscout.androidaps.extensions.isPSEvent5minBack
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
@ -13,6 +14,7 @@ import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.aps.SMBDefaults import info.nightscout.interfaces.aps.SMBDefaults
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.Profile
@ -51,7 +53,7 @@ class SensitivityOref1Plugin @Inject constructor(
.description(R.string.description_sensitivity_oref1) .description(R.string.description_sensitivity_oref1)
.setDefault(), .setDefault(),
injector, aapsLogger, rh, sp injector, aapsLogger, rh, sp
) { ), Constraints {
override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult { override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult {
val profile = profileFunction.getProfile() val profile = profileFunction.getProfile()
@ -235,4 +237,9 @@ class SensitivityOref1Plugin @Inject constructor(
override val id: SensitivityType override val id: SensitivityType
get() = SensitivityType.SENSITIVITY_OREF1 get() = SensitivityType.SENSITIVITY_OREF1
override fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
if (!isEnabled()) value.set(aapsLogger, false, rh.gs(info.nightscout.plugins.R.string.uamdisabledoref1notselected), this)
return value
}
} }

View file

@ -14,8 +14,8 @@ import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment import info.nightscout.plugins.constraints.objectives.ObjectivesFragment
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
@ -32,7 +32,7 @@ import info.nightscout.androidaps.setupwizard.elements.SWInfoText
import info.nightscout.androidaps.setupwizard.elements.SWPlugin import info.nightscout.androidaps.setupwizard.elements.SWPlugin
import info.nightscout.androidaps.setupwizard.elements.SWPreference import info.nightscout.androidaps.setupwizard.elements.SWPreference
import info.nightscout.androidaps.setupwizard.elements.SWRadioButton import info.nightscout.androidaps.setupwizard.elements.SWRadioButton
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.androidaps.utils.CryptoUtil
import info.nightscout.androidaps.utils.extensions.isRunningTest import info.nightscout.androidaps.utils.extensions.isRunningTest
import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.AndroidPermission

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.setupwizard.elements.SWItem import info.nightscout.androidaps.setupwizard.elements.SWItem
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.interfaces.locale.LocaleHelper.update import info.nightscout.interfaces.locale.LocaleHelper.update

View file

@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.androidaps.utils.protection.PasswordCheck import info.nightscout.androidaps.utils.protection.PasswordCheck
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger

View file

@ -12,7 +12,7 @@ import info.nightscout.androidaps.activities.MyPreferenceFragment
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.setupwizard.SWDefinition import info.nightscout.androidaps.setupwizard.SWDefinition
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.rx.events.EventConfigBuilderChange import info.nightscout.rx.events.EventConfigBuilderChange

View file

@ -1,5 +0,0 @@
package info.nightscout.androidaps.setupwizard.events
import info.nightscout.rx.events.Event
class EventSWUpdate(var redraw: Boolean) : Event()

View file

@ -1,14 +1,5 @@
package info.nightscout.androidaps.utils package info.nightscout.androidaps.utils
import android.os.SystemClock
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.utils.DateUtil
import java.net.DatagramPacket
import java.net.DatagramSocket
import java.net.InetAddress
import javax.inject.Inject
import javax.inject.Singleton
/* /*
* Copyright (C) 2008 The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
* *
@ -23,192 +14,4 @@ import javax.inject.Singleton
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ /** */
* {@hide}
*
*
* Simple SNTP client class for retrieving network time.
*
*
* Sample usage:
* <pre>SntpClient client = new SntpClient();
* if (client.requestTime("time.foo.com")) {
* long now = client.getNtpTime() + SystemClock.elapsedRealtime() - client.getNtpTimeReference();
* }
</pre> *
*/
@Singleton
class SntpClient @Inject constructor(
private val aapsLogger: AAPSLogger,
private val dateUtil: DateUtil
) {
companion object {
//private final int REFERENCE_TIME_OFFSET = 16;
private const val ORIGINATE_TIME_OFFSET = 24
private const val RECEIVE_TIME_OFFSET = 32
private const val TRANSMIT_TIME_OFFSET = 40
private const val NTP_PACKET_SIZE = 48
private const val NTP_PORT = 123
private const val NTP_MODE_CLIENT = 3
private const val NTP_VERSION = 3
// Number of seconds between Jan 1, 1900 and Jan 1, 1970
// 70 years plus 17 leap days
private const val OFFSET_1900_TO_1970 = (365L * 70L + 17L) * 24L * 60L * 60L
}
/**
* Returns the time computed from the NTP transaction.
*
* @return time value computed from NTP server response.
*/
// system time computed from NTP server response
private var ntpTime: Long = 0
/**
* Returns the reference clock value (value of SystemClock.elapsedRealtime())
* corresponding to the NTP time.
*
* @return reference clock corresponding to the NTP time.
*/
// value of SystemClock.elapsedRealtime() corresponding to mNtpTime
private var ntpTimeReference: Long = 0
/**
* Returns the round trip time of the NTP transaction
*
* @return round trip time in milliseconds.
*/
// round trip time in milliseconds
private var roundTripTime: Long = 0
abstract class Callback : Runnable {
var networkConnected = false
var success = false
var time: Long = 0
}
@Synchronized fun ntpTime(callback: Callback, isConnected: Boolean) {
callback.networkConnected = isConnected
if (callback.networkConnected) {
Thread { doNtpTime(callback) }.start()
} else {
callback.run()
}
}
fun doNtpTime(callback: Callback) {
aapsLogger.debug("Time detection started")
callback.success = requestTime("time.google.com", 5000)
callback.time = ntpTime + SystemClock.elapsedRealtime() - ntpTimeReference
aapsLogger.debug("Time detection ended: " + callback.success + " " + dateUtil.dateAndTimeString(ntpTime))
callback.run()
}
/**
* Sends an SNTP request to the given host and processes the response.
*
* @param host host name of the server.
* @param timeout network timeout in milliseconds.
* @return true if the transaction was successful.
*/
@Suppress("SameParameterValue")
@Synchronized private fun requestTime(host: String, timeout: Int): Boolean {
try {
val socket = DatagramSocket()
socket.soTimeout = timeout
val address = InetAddress.getByName(host)
val buffer = ByteArray(NTP_PACKET_SIZE)
val request = DatagramPacket(buffer, buffer.size, address, NTP_PORT)
// set mode = 3 (client) and version = 3
// mode is in low 3 bits of first byte
// version is in bits 3-5 of first byte
buffer[0] = (NTP_MODE_CLIENT or (NTP_VERSION shl 3)).toByte()
// get current time and write it to the request packet
val requestTime = System.currentTimeMillis()
val requestTicks = SystemClock.elapsedRealtime()
writeTimeStamp(buffer, TRANSMIT_TIME_OFFSET, requestTime)
socket.send(request)
// read the response
val response = DatagramPacket(buffer, buffer.size)
socket.receive(response)
val responseTicks = SystemClock.elapsedRealtime()
val responseTime = requestTime + (responseTicks - requestTicks)
socket.close()
// extract the results
val originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET)
val receiveTime = readTimeStamp(buffer, RECEIVE_TIME_OFFSET)
val transmitTime = readTimeStamp(buffer, TRANSMIT_TIME_OFFSET)
val roundTripTime = responseTicks - requestTicks - (transmitTime - receiveTime)
val clockOffset = (receiveTime - originateTime + (transmitTime - responseTime)) / 2
// save our results - use the times on this side of the network latency
// (response rather than request time)
ntpTime = responseTime + clockOffset
ntpTimeReference = responseTicks
this.roundTripTime = roundTripTime
} catch (e: Exception) {
aapsLogger.debug("request time failed: $e")
return false
}
return true
}
/**
* Reads an unsigned 32 bit big endian number from the given offset in the buffer.
*/
private fun read32(buffer: ByteArray, offset: Int): Long {
val b0 = buffer[offset]
val b1 = buffer[offset + 1]
val b2 = buffer[offset + 2]
val b3 = buffer[offset + 3]
// convert signed bytes to unsigned values
val i0 = if (b0.toInt() and 0x80 == 0x80) (b0.toInt() and 0x7F) + 0x80 else b0.toInt()
val i1 = if (b1.toInt() and 0x80 == 0x80) (b1.toInt() and 0x7F) + 0x80 else b1.toInt()
val i2 = if (b2.toInt() and 0x80 == 0x80) (b2.toInt() and 0x7F) + 0x80 else b2.toInt()
val i3 = if (b3.toInt() and 0x80 == 0x80) (b3.toInt() and 0x7F) + 0x80 else b3.toInt()
return (i0.toLong() shl 24) + (i1.toLong() shl 16) + (i2.toLong() shl 8) + i3.toLong()
}
/**
* Reads the NTP time stamp at the given offset in the buffer and returns
* it as a system time (milliseconds since January 1, 1970).
*/
private fun readTimeStamp(buffer: ByteArray, offset: Int): Long {
val seconds = read32(buffer, offset)
val fraction = read32(buffer, offset + 4)
return (seconds - OFFSET_1900_TO_1970) * 1000 + fraction * 1000L / 0x100000000L
}
/**
* Writes system time (milliseconds since January 1, 1970) as an NTP time stamp
* at the given offset in the buffer.
*/
@Suppress("SameParameterValue")
private fun writeTimeStamp(buffer: ByteArray, offsetParam: Int, time: Long) {
var offset = offsetParam
var seconds = time / 1000L
val milliseconds = time - seconds * 1000L
seconds += OFFSET_1900_TO_1970
// write seconds in big endian format
buffer[offset++] = (seconds shr 24).toByte()
buffer[offset++] = (seconds shr 16).toByte()
buffer[offset++] = (seconds shr 8).toByte()
buffer[offset++] = (seconds shr 0).toByte()
val fraction = milliseconds * 0x100000000L / 1000L
// write fraction in big endian format
buffer[offset++] = (fraction shr 24).toByte()
buffer[offset++] = (fraction shr 16).toByte()
buffer[offset++] = (fraction shr 8).toByte()
// low order bits should be random data
buffer[offset] = (Math.random() * 255.0).toInt().toByte()
}
}

View file

@ -22,7 +22,7 @@
android:id="@+id/nav_historybrowser" android:id="@+id/nav_historybrowser"
android:orderInCategory="1" android:orderInCategory="1"
app:showAsAction="never" app:showAsAction="never"
android:title="@string/nav_historybrowser" /> android:title="@string/nav_history_browser" />
<item <item
android:id="@+id/nav_setupwizard" android:id="@+id/nav_setupwizard"
android:orderInCategory="1" android:orderInCategory="1"

View file

@ -77,21 +77,6 @@
<item>zh</item> <item>zh</item>
</string-array> </string-array>
<string-array name="ageArray">
<item>@string/child</item>
<item>@string/teenage</item>
<item>@string/adult</item>
<item>@string/resistantadult</item>
<item>@string/pregnant</item>
</string-array>
<string-array name="ageValues" translatable="false">
<item>@string/key_child</item>
<item>@string/key_teenage</item>
<item>@string/key_adult</item>
<item>@string/key_resistantadult</item>
<item>@string/key_pregnant</item>
</string-array>
<string-array name="smbMaxMinutes"> <string-array name="smbMaxMinutes">
<item>15</item> <item>15</item>
<item>30</item> <item>30</item>

View file

@ -1,230 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="dia_whatmeansdia">What is true about DIA?</string>
<string name="dia_label_exam">Duration of Insulin Action (DIA)</string>
<string name="dia_profile">You should set the value for DIA in your profile.</string>
<string name="dia_minimumis5h">The minimum allowed value is 5 hours.</string>
<string name="dia_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html?#insulin</string>
<string name="dia_meaningisequaltodiapump">If you are satisfied that the value for DIA that you used in your pump prior to AAPS worked well, there is no need to change this when you start looping.</string>
<string name="dia_valuemustbedetermined">You should determine for yourself the appropriate value for DIA.</string>
<string name="hypott_label">Hypo Temp-Target</string>
<string name="hypott_whenhypott">What is primary reason to set a hypo temp target?</string>
<string name="hypott_wrongbasal">To correct for hypos caused by incorrect basal rate settings.</string>
<string name="hypott_preventoversmb">To prevent AAPS from overcorrecting for a blood glucose rise caused by the fast acting carbs used to treat a hypo.</string>
<string name="hypott_exercise">To correct for a hypo induced as a result of exercise.</string>
<string name="hypott_0basal">To prevent blood glucose from going low if there is already a 0% temporary basal rate running.</string>
<string name="hypott_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html</string>
<string name="offlineprofile_whatprofile">Which profile can be used and configured offline?</string>
<string name="offlineprofile_label">Topic: Offline Profile</string>
<string name="offlineprofile_nsprofile">NS Profile can be used, but not configured.</string>
<string name="offlineprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#profile</string>
<string name="pumpdisconnect_label">Reasons for applying "Disconnect pump" in AAPS</string>
<string name="pumpdisconnect_whattodo">What should be done when disconnecting the pump?</string>
<string name="pumpdisconnect_unnecessary">This is unnecessary as insulin will not be delivered if the pump is physically disconnected.</string>
<string name="pumpdisconnect_missinginsulin">It prevents AAPS from accounting for insulin that was not delivered whilst the pump is physically disconnected. </string>
<string name="pumpdisconnect_notstop">It will not stop insulin delivery if the pump remains connected.</string>
<string name="pumpdisconnect_openloop">It will send AAPS into open loop mode.</string>
<string name="pumpdisconnect_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#other-settings</string>
<string name="objectives_label">AAPS Settings</string>
<string name="objectives2_label">AAPS Settings</string>
<string name="objectives_howtosave">What are the best practices for backing up your settings?</string>
<string name="objectives_notesettings">You do not need to export your settings provided that you make a note of them.</string>
<string name="objectives_afterobjective">Export your settings after you finish completing an objective.</string>
<string name="objectives_afterchange">Export your settings after changing any of your settings.</string>
<string name="objectives_afterinitialsetup">Export your settings after you finish your initial set-up and have set your Preferences.</string>
<string name="objectives2_maintenance">Export your settings locally using the maintenance menu.</string>
<string name="objectives2_internalstorage">Your settings file is found in the folder Internal Storage/AAPS/preferences on your phone.</string>
<string name="objectives2_cloud">Copy your preferences file to a safe location outside of your phone (e.g. by using a cloud drive, connecting a cable to a computer, email, etc.)</string>
<string name="objectives2_easyrestore">If your phone is damaged or lost, there are easy ways to remotely recover your settings without a backup.</string>
<string name="objectives_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/ExportImportSettings.html</string>
<string name="objectives_hint2">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
<string name="noisycgm_label">Noisy CGM Readings</string>
<string name="noisycgm_whattodo">What should be done if CGM data is noisy?</string>
<string name="noisycgm_nothing">Do nothing - AAPS will deal with it.</string>
<string name="noisycgm_pause">Disable the closed loop to avoid possible over or underdosing.</string>
<string name="noisycgm_replacesensor">Replace consistently noisy or inaccurate sensors.</string>
<string name="noisycgm_checksmoothing">Verify that your CGM app provides smoothed data.</string>
<string name="noisycgm_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
<string name="exerciseprofile_label">Exercise and Profiles</string>
<string name="exerciseprofile_whattodo">How can you use profiles to best help the system deal with aerobic exercise?</string>
<string name="exerciseprofile_switchprofilebelow100">Do a profile switch to less than 100%.</string>
<string name="exerciseprofile_switchprofileabove100">Do a profile switch to more than 100%.</string>
<string name="exerciseprofile_leaveat100">Leave the profile set to 100%.</string>
<string name="exerciseprofile_suspendloop">Suspend the loop.</string>
<string name="exerciseprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="exercise_label">Exercise and Temporary Targets</string>
<string name="exercise_whattodo">How can you use temporary targets to best help the system deal with aerobic exercise?</string>
<string name="exercise_settt">Set an activity blood glucose target starting a suitable time before beginning exercise.</string>
<string name="exercise_setfinished">Set an activity blood glucose target after finishing exercise.</string>
<string name="exercise_setunchanged">Leave your blood glucose target unchanged.</string>
<string name="exercise_15g">Wait until blood glucose drops below your hypo temp target and then eat 15 g of fast acting carbohydrates.</string>
<string name="exercise_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="suspendloop_label">Disabled/Suspended loop</string>
<string name="suspendloop_doigetinsulin">Do I receive insulin when the loop is disabled/suspended?</string>
<string name="suspendloop_yes">Yes, basal insulin continues to be delivered.</string>
<string name="suspendloop_no">No, delivery of insulin is stopped.</string>
<string name="basaltest_label">Basal, ISF, and I:C Testing</string>
<string name="basaltest_when">When should these values be validated?</string>
<string name="basaltest_beforeloop">Before starting looping.</string>
<string name="basaltest_havingregularhighlow">When experiencing frequent high or low blood glucose.</string>
<string name="basaltest_weekly">At least once per week.</string>
<string name="basaltest_fixed">Once set and validated, these values should not change over time.</string>
<string name="basaltest_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#androidaps-settings</string>
<string name="prerequisites_label">Prerequisites</string>
<string name="prerequisites_what">What is essential to set up and use AAPS?</string>
<string name="prerequisites_determinedcorrectprofile">Validated profile information (Basal, IC, ISF, DIA).</string>
<string name="prerequisites_computer">A computer with Android Studio installed and configured.</string>
<string name="prerequisites_phone">A supported phone.</string>
<string name="prerequisites_pump">A compatible insulin pump if you are planning to run a closed loop.</string>
<string name="prerequisites_nightscout">Nightscout, to keep a log of all data and review settings.</string>
<string name="prerequisites_tidepoolaccount">A Tidepool account.</string>
<string name="prerequisites_googleaccount">A Google account.</string>
<string name="prerequisites_githubaccount">A Github account.</string>
<string name="prerequisites_beanandroiddeveloper">Experience in programming or editing code.</string>
<string name="prerequisites_own670g">A MiniMed 670G pump.</string>
<string name="prerequisites_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="prerequisites_smartwatch">A Smartwatch.</string>
<string name="prerequisites_supportedcgm">A Supported CGM.</string>
<string name="prerequisites2_label">Prerequisites</string>
<string name="prerequisites2_what">What is essential to set up and use AAPS?</string>
<string name="prerequisites2_profile">Validated information to set up a profile (ISF, I:C ratio, basal rates, DIA etc.).</string>
<string name="prerequisites2_device">A compatible Android device (e.g. mobile/cell phone, full Android watch, or tablet).</string>
<string name="prerequisites2_internet">AAPS requires an internet connection in order to run in closed loop.</string>
<string name="prerequisites2_supportedcgm">A supported CGM and appropriate app to receive blood glucose values on the phone/device.</string>
<string name="prerequisites2_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="update_label">Updating AAPS</string>
<string name="whatistrue">Check all correct answers.</string>
<string name="update_git">You need to have Git installed and configured on your computer.</string>
<string name="update_asap">When updated versions of AAPS are released, the earlier versions may be remotely limited after a specified time.</string>
<string name="update_keys">You should save and note the location of your keystore and use the same signing key for updates as for your previous installation.</string>
<string name="update_neverupdate">Never update if the system is working well.</string>
<string name="update_askfriend">If you have difficulty building the apk, you can install an apk that has been built by a friend.</string>
<string name="update_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
<string name="troubleshooting_label">Troubleshooting</string>
<string name="troubleshooting_wheretoask">Where can you look for help with AAPS?</string>
<string name="troubleshooting_fb">You can ask for advice in the AAPS Users Facebook group.</string>
<string name="troubleshooting_wiki">You should read (and re-read) the AAPS documentation.</string>
<string name="troubleshooting_gitter">You can ask for advice and log technical problems or issues in the AAPS Discord.</string>
<string name="troubleshooting_yourendo">You should ask your diabetes clinic/endocrinologist.</string>
<string name="troubleshooting_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#troubleshooting</string>
<string name="troubleshooting_hint2">https://www.facebook.com/groups/AndroidAPSUsers/</string>
<string name="troubleshooting_hint3">https://discord.gg/4fQUWHZ4Mw</string>
<string name="insulin_label">Insulin Plugins</string>
<string name="insulin_ultrarapid">Which insulin should you use with the Ultra-Rapid Oref plugin?</string>
<string name="insulin_fiasp">Fiasp®</string>
<string name="insulin_novorapid">NovoRapid®/Novolog®</string>
<string name="insulin_humalog">Humalog®</string>
<string name="insulin_actrapid">Actrapid®/Humalin R®/"regular" human insulin.</string>
<string name="insulin_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#insulin</string>
<string name="sensitivity_label">Sensitivity Plugins</string>
<string name="sensitivity_which">Check all correct answers.</string>
<string name="sensitivity_adjust">Sensitivity plugins allow AAPS to adjust for temporary or short-lived changes in insulin sensitivity (for example hormonal changes or issues with absorption at the infusion site).</string>
<string name="sensitivity_edit">Sensitivity plugins provide the user with suggested changes to basal rates, I:C ratios and ISF that can be used to edit profile.</string>
<string name="sensitivity_cannula">Logging a cannula change will reset Autosens ratio back to 100%.</string>
<string name="sensitivity_time">Some of the plugin options have configurable time ranges that can be set by the user.</string>
<string name="sensitivity_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="sensitivity_hint2">https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens</string>
<string name="wrongcarbs_label">Carb Entry Errors</string>
<string name="wrongcarbs_whattodo">What should you do if youve made an incorrect carb entry?</string>
<string name="wrongcarbs_treatmentstab">Delete the incorrect entry in Treatments and enter the correct new carb value.</string>
<string name="wrongcarbs_addinsulin">Bolus with insulin using the infusion set prime menu.</string>
<string name="wrongcarbs_donothing">Do nothing AAPS will make the appropriate adjustments.</string>
<string name="wrongcarbs_bolus">Bolus with insulin using the Insulin (bolus) button in Overview.</string>
<string name="wronginsulin_label">Insulin delivery/entry errors</string>
<string name="wronginsulin_whattodo">What should you do if you received less insulin than the pump history suggests e.g. due to an occlusion, a failed cannula or forgetting to reattach the pump after a shower? </string>
<string name="wronginsulin_careportal">Delete insulin data from Nightscout Careportal to remove it from the pump history.</string>
<string name="wronginsulin_compare">Compare values in AAPS and pump history (if pump supports this).</string>
<string name="wronginsulin_prime">Bolus a proportion of your calculated missed insulin by either syringe/pen or using a prime.</string>
<string name="wronginsulin_donothing">Do nothing and allow AAPS to correct any resulting high blood glucose level.</string>
<string name="cob_label">Carbs on Board (COB)</string>
<string name="cob_question">How changing ISF value affects COB calculation?</string>
<string name="cob_longer">Increasing ISF will take absorbing carbs a longer time</string>
<string name="cob_shorter">Increasing ISF will take absorbing carbs a shorter time</string>
<string name="cob_no_effect">Increasing ISF will not affect calculated carbs absorption</string>
<string name="cob2_question">How changing IC value affects COB calculation?</string>
<string name="cob2_longer">Increasing IC will take absorbing carbs a longer time</string>
<string name="cob2_shorter">Increasing IC will take absorbing carbs a shorter time</string>
<string name="cob2_no_effect">Increasing IC will not affect calculated carbs absorption</string>
<string name="cob3_question">How changing profile percentage affects COB calculation?</string>
<string name="cob3_longer">Setting profile to 150% will take absorbing carbs a longer time</string>
<string name="cob3_shorter">Setting profile to 150% will take absorbing carbs a shorter time</string>
<string name="cob3_no_effect">Setting profile to 150% will not affect calculated carbs absorption</string>
<string name="iob_label">Insulin on Board (IOB)</string>
<string name="iob_value">IOB value is affected by issued temporary basals.</string>
<string name="iob_hightemp">High temp basal will not be given when your blood sugar is below target.</string>
<string name="iob_negiob">Negative IOB for a substantial period in the absence of exercise suggests your profile is too strong and less insulin is needed in your settings.</string>
<string name="iob_posiob">Positive IOB for a substantial period suggests insulin resistance or unannounced meals.</string>
<string name="breadgrams_label">Carb entry and boluses</string>
<string name="breadgrams_grams">Only grams should be used for estimating and recording carbohydrates consumed.</string>
<string name="breadgrams_exchange">Carbohydrates consumed can be recorded using an appropriate exchange system (e.g. DAFNE "CHO" exchanges or European "Bread Units").</string>
<string name="breadgrams_decay">AAPS uses a dynamic model to estimate carb “decay” and calculate COB.</string>
<string name="breadgrams_calc">If blood glucose levels are outside acceptable values (too low or too high) the bolus calculator can be used to provide suggestions for carb or insulin corrections.</string>
<string name="breadgrams_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
<string name="extendedcarbs_label">e-carbs</string>
<string name="extendedcarbs_handling">What could you use e-carbs (extended carbs) for?</string>
<string name="extendedcarbs_future">To schedule carbs in the future, possibly distributed over an interval (similar to an extended bolus distributing insulin over an interval).</string>
<string name="extendedcarbs_free">For logging \'free\' exercise carbs you want to hide from AAPS.</string>
<string name="extendedcarbs_fat">e-carbs (distributed in the future) can assist AAPS in dealing with high fat/protein meals.</string>
<string name="extendedcarbs_rescue">For logging rescue carbs you use to treat low blood glucose. </string>
<string name="extendedcarbs_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Extended-Carbs.html</string>
<string name="nsclient_label">Remote Monitoring</string>
<string name="nsclient_howcanyou">How can you monitor AAPS (for example for your child) remotely?</string>
<string name="nsclient_nightscout">AAPSClient app, Nightscout app and Nightscout webpage all allow you to follow AAPS remotely.</string>
<string name="nsclient_dexcomfollow">Other apps (e.g. Dexcom follow, xDrip running in follow mode) allow you to follow some parameters (e.g. blood glucose/sensor values) remotely, but use different algorithms so may have inaccurate IOB or COB values.</string>
<string name="nsclient_data">To follow AAPS remotely, both devices must have internet access (e.g. via Wi-Fi or mobile/cellular network data).</string>
<string name="nsclient_fullcontrol">AAPSClient used as a remote follower will both monitor and provide full control of AAPS.</string>
<string name="nsclient_hint1">https://androidaps.readthedocs.io/en/latest/EN/Children/Children.html</string>
<string name="isf_label_exam">Insulin Sensitivity Factor (ISF)</string>
<string name="isf_increasingvalue">Raising ISF values will lead to more insulin delivery to cover a specific amount of carbs.</string>
<string name="isf_decreasingvalue">Reducing ISF values lead to more insulin delivery to correct for an above target blood glucose.</string>
<string name="isf_noeffect">Raising or lowering ISF has no effect on insulin delivery when blood glucose levels are below target.</string>
<string name="isf_preferences">ISF should be entered in your AAPS Preferences.</string>
<string name="isf_profile">Changing the ISF value in your profile is enough to apply the change.</string>
<string name="isf_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-sensitivity-factor-isf-mmol-l-u-or-mg-dl-u</string>
<string name="isf_hint2">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html</string>
<string name="ic_multiple">You can use more than one value for I:C ratio in your profile.</string>
<string name="ic_isf">If you change your ISF in your profile you should always change your I:C ratio too.</string>
<string name="ic_label_exam">Insulin to Carbohydrate Ratio (I:C ratio)</string>
<string name="ic_increasingvalue">Higher I:C ratios lead to less insulin delivered for a given amount of carbs.</string>
<string name="ic_decreasingvalue">Lower I:C ratios lead to less insulin delivered for a given amount of carbs.</string>
<string name="ic_noeffect">If you have 0 COB, changing the IC ratio will lead to a different amount of insulin to correct a given BG value.</string>
<string name="ic_different">IC will be different if you count bread (exchange) unit as 10g or 12g.</string>
<string name="ic_meaning">IC meaning is: How many bread (exchange) units are covered by 1U of insulin.</string>
<string name="ic_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#carbohydrate-to-insulin-ratio-cr-g-u</string>
<string name="profileswitch_label">Profile Switching</string>
<string name="profileswitch_pctwillchange"> When specifying a 90% profile switch, which answers are true?</string>
<string name="profileswitch_basallower">Basal rates will be 10% lower.</string>
<string name="profileswitch_isfhigher">ISF will be 10% higher.</string>
<string name="profileswitch_iclower">The value of the I:C ratio will be a 10% lower number.</string>
<string name="profileswitch_unchanged">ISF and I:C ratios will be unchanged.</string>
<string name="profileswitch_hint1" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#profile-switch</string>
<string name="profileswitch2_label">Profile Switching</string>
<string name="profileswitch2_pctwillchange"> When specifying a 120% profile switch, which answers are true?</string>
<string name="profileswitch2_bghigher">Target blood glucose will be 20% higher.</string>
<string name="profileswitch2_basalhigher">Basal rates will be 20% higher.</string>
<string name="profileswitch2_bgunchanged">Target blood glucose will be unchanged.</string>
<string name="profileswitch2_isfhigher">ISF will be 20% higher.</string>
<string name="profileswitchtime_label">Profile Switching</string>
<string name="profileswitchtime_iwant">If you get up 2 hours earlier than usual, how should you notify AAPS of the change in your schedule?</string>
<string name="profileswitchtime_2">Initiate a profile switch with a timeshift of 2</string>
<string name="profileswitchtime__2">Initiate a profile switch with a timeshift of -2</string>
<string name="profileswitchtime_tt">Set an eating soon temporary target.</string>
<string name="profileswitchtime_100">Do a profile switch to more than 100%. </string>
<string name="profileswitchtime_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#timeshift</string>
<string name="profileswitch4_label">Changes to profiles</string>
<string name="profileswitch4_rates">Basal rates, ISF, I:C ratios, etc., should be set in profiles.</string>
<string name="profileswitch4_internet">Activating changes to your Nightscout Profile requires your AAPS phone to have an internet connection.</string>
<string name="profileswitch4_sufficient">Editing profiles to change values is sufficient to enact any changes made.</string>
<string name="profileswitch4_multi">Multiple profiles can be set up and selected to accommodate changing circumstances (e.g. hormonal changes, shift working, weekdays/weekend lifestyle).</string>
<string name="basalhelp_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html#good-individual-dosage-algorithm-for-your-diabetes-therapy</string>
<string name="basalhelp_label">Help with basal rates</string>
<string name="basalhelp_where">Where to go for help with basalrate etc.</string>
<string name="basalhelp_diabetesteam">Your diabetes team</string>
<string name="basalhelp_google">Google</string>
<string name="basalhelp_facebook">Facebook</string>
<string name="blank"></string>
<string name="other_medication_label">Other Medication. Please read the statement below and then check the box to accept the declaration.</string>
<string name="other_medication_text">AAPS reduces basal rates or suspends insulin delivery to raise blood sugar. Drugs in the class SGLT2 inhibitors (gliflozins) can prevent increases in blood glucose and therefore can produce a dangerous insulin deficiency leading to DKA.
\nCommon brand names are: Invokana®, Forxiga®, Jardiance®, Steglatro®, Suglat®, Apleway®, Deberza®, Synjardy®, Vokanamet®, Xigduo®.\n\nI hereby promise that I will not take such drugs when using AAPS or will deactivate the loop before using such drugs.</string>
</resources> </resources>

View file

@ -1,62 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="key_objectiveuseactions" translatable="false">ObjectivesActionsUsed</string>
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
<string name="key_objectiveusescale" translatable="false">ObjectivesScaleUsed</string>
<string name="key_objectives_request_code" translatable="false">objectives_request_code</string>
<string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string>
<string name="objectives_button_start">Start</string>
<string name="objectives_button_verify">Verify</string>
<string name="nth_objective">%1$d. Objective</string>
<string name="objectivenotstarted">Objective %1$d not started</string>
<string name="objectivenotfinished">Objective %1$d not finished</string>
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
<string name="objectives_openloop_objective">Starting on an open loop</string>
<string name="objectives_openloop_gate">Run in Open Loop mode for a few days and manually enact lots of temp basals. Set up and use temporary and default temporary targets (e.g. for activity or hypo treatment carbs)</string>
<string name="objectives_maxbasal_objective">Understanding your open loop, including its temp basal recommendations</string>
<string name="objectives_maxbasal_gate">Based on that experience, decide what max basal should be, and set it on the pump and preferences</string>
<string name="objectives_maxiobzero_objective">Starting to close the loop with Low Glucose Suspend</string>
<string name="objectives_maxiobzero_gate">Run in closed loop with max IOB = 0 for a few days without too many LGS events</string>
<string name="objectives_maxiob_objective">Tuning the closed loop, raising max IOB above 0 and gradually lowering BG targets</string>
<string name="objectives_maxiob_gate">Run for a few days, and at least one night with no low BG alarms, before dropping BG</string>
<string name="objectives_autosens_objective">Adjust basals and ratios if needed, and then enable auto-sens</string>
<string name="objectives_autosens_gate">1 week successful daytime looping with regular carb entry</string>
<string name="objectives_smb_objective">Enabling additional features for daytime use, such as SMB</string>
<string name="objectives_auto_objective">Enabling automation</string>
<string name="objectives_smb_gate">You must read the wiki and rise maxIOB to get SMBs working fine! A good start is maxIOB=average mealbolus + 3 x max daily basal</string>
<string name="objectives_auto_gate">Read the docs on how automation works. Set up your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. (https://androidaps.readthedocs.io/en/latest/EN/Usage/Automation.html)</string>
<string name="objectives_bgavailableinns">BG available in NS</string>
<string name="objectives_pumpstatusavailableinns">Pump status available in NS</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="accomplished">Accomplished: %1$s</string>
<string name="objectives_usage_objective">Learn how to control AAPS</string>
<string name="objectives_usage_gate">Perform different actions in AAPS</string>
<string name="objectives_useprofileswitch">Set profile 90% for 10 min (Long-press profile name on Overview)</string>
<string name="objectives_usedisconnectpump">Simulate shower. Disconnect pump for 1h (Long-press on Open Loop)</string>
<string name="objectives_usereconnectpump">... and reconnect back the same way</string>
<string name="objectives_usetemptarget">Create custom temporary target with 10 min duration (Long-press on your current target)</string>
<string name="objectives_useactions">In Config Builder enable Actions plugin, make it visible and display its content from top menu</string>
<string name="objectives_useloop">Display content of Loop plugin</string>
<string name="objectives_usescale">Use scale function by long-pressing BG chart</string>
<string name="objectives_button_enter">Enter</string>
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">If you have at least 3 months of closed loop experience with other systems you might qualify for a code to skip objectives. See https://androidaps.readthedocs.io/en/latest/EN/Usage/Objectives.html#skip-objectives for details.</string>
<string name="codeaccepted">Code accepted</string>
<string name="codeinvalid">Code invalid</string>
<string name="objectives_exam_objective">Prove your knowledge</string>
<string name="objectives_exam_gate">Study the questions.  You are given four possible answers for each question. There may be more than one correct answer. Please check all those that are correct and select VERIFY.</string>
<string name="answerdisabledto">Answering disabled until: %1$s</string>
<string name="wronganswer">Wrong answer!</string>
<string name="unfinshed_button">Next unfinished</string>
<string name="requestcode">Request code: %1$s</string>
<string name="objectives_hint">(check all correct answers)</string>
<string name="disconnectpump_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath</string>
<string name="usetemptarget_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="useaction_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder</string>
<string name="usescale_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="notconnected">Not connected to the internet</string>
<string name="failedretrievetime">Failed retrieve time</string>
<string name="requirementnotmet">Objective requirements not met</string>
</resources> </resources>

View file

@ -35,9 +35,6 @@
<string name="key_openapsama_bolussnooze_dia_divisor" translatable="false">bolussnooze_dia_divisor</string> <string name="key_openapsama_bolussnooze_dia_divisor" translatable="false">bolussnooze_dia_divisor</string>
<string name="key_openapsama_autosens_adjusttargets" translatable="false">autosens_adjust_targets</string> <string name="key_openapsama_autosens_adjusttargets" translatable="false">autosens_adjust_targets</string>
<string name="key_last_cleanup_run" translatable="false">last_cleanup_run</string> <string name="key_last_cleanup_run" translatable="false">last_cleanup_run</string>
<string name="treatmentssafety_title">Treatments safety</string>
<string name="treatmentssafety_maxbolus_title">Max allowed bolus [U]</string>
<string name="treatmentssafety_maxcarbs_title">Max allowed carbs [g]</string>
<string name="treatmentssafety_lgsThreshold_title">BG level below which low glucose suspend occurs</string> <string name="treatmentssafety_lgsThreshold_title">BG level below which low glucose suspend occurs</string>
<string name="nav_preferences_plugin">%1$s Preferences</string> <string name="nav_preferences_plugin">%1$s Preferences</string>
<string name="nav_preferences">Preferences</string> <string name="nav_preferences">Preferences</string>
@ -45,9 +42,7 @@
<string name="nav_resetdb">Reset Databases</string> <string name="nav_resetdb">Reset Databases</string>
<string name="reset_db_confirm">Do you really want to reset the databases?</string> <string name="reset_db_confirm">Do you really want to reset the databases?</string>
<string name="nav_exit">Exit</string> <string name="nav_exit">Exit</string>
<string name="description_actions">Some buttons to quickly access common features</string>
<string name="description_config_builder">Used for configuring the active plugins</string> <string name="description_config_builder">Used for configuring the active plugins</string>
<string name="description_objectives">Learning program</string>
<string name="description_loop">Activate or deactivate the implementation triggering the loop.</string> <string name="description_loop">Activate or deactivate the implementation triggering the loop.</string>
<string name="description_ama">State of the algorithm in 2017</string> <string name="description_ama">State of the algorithm in 2017</string>
<string name="description_smb">Most recent algorithm for advanced users</string> <string name="description_smb">Most recent algorithm for advanced users</string>
@ -92,20 +87,14 @@
<string name="loop_constraintsprocessed_label">After processed constraints</string> <string name="loop_constraintsprocessed_label">After processed constraints</string>
<string name="loop_tbrsetbypump_label">Temp basal set by pump</string> <string name="loop_tbrsetbypump_label">Temp basal set by pump</string>
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string> <string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
<string name="safety">Safety</string>
<string name="openapsma_disabled">Plugin is disabled</string> <string name="openapsma_disabled">Plugin is disabled</string>
<string name="constraints_violation">Constraints violation</string> <string name="constraints_violation">Constraints violation</string>
<string name="setbasalquestion">Accept new temp basal:</string>
<string name="changeyourinput">Change your input!</string> <string name="changeyourinput">Change your input!</string>
<string name="configbuilder_bgsource">BG Source</string> <string name="configbuilder_bgsource">BG Source</string>
<string name="configbuilder_bgsource_description">Where should AAPS gain it\'s data from?</string> <string name="configbuilder_bgsource_description">Where should AAPS gain it\'s data from?</string>
<string name="apsmode_title">APS Mode</string>
<string name="openloop_newsuggestion">New suggestion available</string> <string name="openloop_newsuggestion">New suggestion available</string>
<string name="carbssuggestion">Carbs Suggestion</string> <string name="carbssuggestion">Carbs Suggestion</string>
<string name="carb_time_label">Carb time</string>
<string name="profile_label">Profile</string> <string name="profile_label">Profile</string>
<string name="overview_tempbasal_button">TempBasal</string>
<string name="overview_extendedbolus_button">Extended Bolus</string>
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string> <string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
<string name="exported">Preferences exported</string> <string name="exported">Preferences exported</string>
<string name="ue_exported">User Entries exported</string> <string name="ue_exported">User Entries exported</string>
@ -141,7 +130,6 @@
<string name="end_user_license_agreement_i_understand">I UNDERSTAND AND AGREE</string> <string name="end_user_license_agreement_i_understand">I UNDERSTAND AND AGREE</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="reloadprofile">Reload profile</string> <string name="reloadprofile">Reload profile</string>
<string name="quickwizard">QuickWizard</string>
<string name="quickwizardsettings">QuickWizard settings</string> <string name="quickwizardsettings">QuickWizard settings</string>
<string name="overview_editquickwizard_buttontext">Button text:</string> <string name="overview_editquickwizard_buttontext">Button text:</string>
<string name="overview_editquickwizard_carbs">Carbs:</string> <string name="overview_editquickwizard_carbs">Carbs:</string>
@ -149,7 +137,6 @@
<string name="overview_editquickwizardlistactivity_add">Add</string> <string name="overview_editquickwizardlistactivity_add">Add</string>
<string name="overview_quickwizard_item_edit_button">Edit</string> <string name="overview_quickwizard_item_edit_button">Edit</string>
<string name="correctionbous">Corr</string> <string name="correctionbous">Corr</string>
<string name="actions">Actions</string>
<string name="ns_upload_only">(DANGEROUS TO DISABLE) NS upload only</string> <string name="ns_upload_only">(DANGEROUS TO DISABLE) NS upload only</string>
<string name="ns_upload_only_summary">NS upload only (disabled sync). Not effective on SGV unless a local source like xDrip+ is selected. Not effective on Profiles while NS-Profiles is used.\n!!! WARNING !!! Disabling this option may cause malfunctions and insulin overdose if any of your component (AAPS, NS, xDrip+) is wrong configured. Carefully watch if data displayed by AAPS match the pump state!</string> <string name="ns_upload_only_summary">NS upload only (disabled sync). Not effective on SGV unless a local source like xDrip+ is selected. Not effective on Profiles while NS-Profiles is used.\n!!! WARNING !!! Disabling this option may cause malfunctions and insulin overdose if any of your component (AAPS, NS, xDrip+) is wrong configured. Carefully watch if data displayed by AAPS match the pump state!</string>
<string name="pumpNotInitialized">Pump not initialized!</string> <string name="pumpNotInitialized">Pump not initialized!</string>
@ -161,7 +148,6 @@
<string name="wear">Wear</string> <string name="wear">Wear</string>
<string name="resend_all_data">Resend All Data</string> <string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string> <string name="open_settings_on_wear">Open Settings on Wear</string>
<string name="basal_rate">Basal rate</string>
<string name="ongoingnotificaction">Ongoing Notification</string> <string name="ongoingnotificaction">Ongoing Notification</string>
<string name="old_data">OLD DATA</string> <string name="old_data">OLD DATA</string>
<string name="openapsama">OpenAPS AMA</string> <string name="openapsama">OpenAPS AMA</string>
@ -169,14 +155,12 @@
<string name="openapsma_autosensdata_label">Autosens data</string> <string name="openapsma_autosensdata_label">Autosens data</string>
<string name="openapsma_scriptdebugdata_label">Script debug</string> <string name="openapsma_scriptdebugdata_label">Script debug</string>
<string name="openapsama_useautosens">Use Autosens feature</string> <string name="openapsama_useautosens">Use Autosens feature</string>
<string name="actions_shortname">ACT</string>
<string name="configbuilder_shortname">CONF</string> <string name="configbuilder_shortname">CONF</string>
<string name="loop_shortname">LOOP</string> <string name="loop_shortname">LOOP</string>
<string name="oaps_shortname">OAPS</string> <string name="oaps_shortname">OAPS</string>
<string name="dynisf_shortname">DYNISF</string> <string name="dynisf_shortname">DYNISF</string>
<string name="overview_shortname">HOME</string> <string name="overview_shortname">HOME</string>
<string name="treatments_shortname">TREAT</string> <string name="treatments_shortname">TREAT</string>
<string name="objectives_shortname">OBJ</string>
<string name="wear_shortname">WEAR</string> <string name="wear_shortname">WEAR</string>
<string name="short_tabtitles">Shorten tab titles</string> <string name="short_tabtitles">Shorten tab titles</string>
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string> <string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
@ -195,22 +179,9 @@
<string name="executing">Executing</string> <string name="executing">Executing</string>
<string name="wear_settings">Wear settings</string> <string name="wear_settings">Wear settings</string>
<string name="nosuccess">not successful - please check phone</string> <string name="nosuccess">not successful - please check phone</string>
<string name="patientage">Patient type</string>
<string name="child">Child</string>
<string name="teenage">Teenage</string>
<string name="adult">Adult</string>
<string name="resistantadult">Insulin resistant adult</string>
<string name="pregnant">Pregnancy</string>
<string name="patientage_summary">Please select patient type to setup safety limits</string>
<string name="patient_name">Patient name</string> <string name="patient_name">Patient name</string>
<string name="patient_name_summary">Please provide patient name or nickname to differentiate among multiple setups</string> <string name="patient_name_summary">Please provide patient name or nickname to differentiate among multiple setups</string>
<string name="key_i_understand" translatable="false">I_understand</string> <string name="key_i_understand" translatable="false">I_understand</string>
<string name="duration15m">15 mins</string>
<string name="duration30m">30 mins</string>
<string name="duration1h">1 hour</string>
<string name="duration2h">2 hours</string>
<string name="duration3h">3 hours</string>
<string name="duration10h">10 hours</string>
<string name="restartingapp">Exiting application to apply settings.</string> <string name="restartingapp">Exiting application to apply settings.</string>
<string name="configbuilder_insulin_description">Which type of insulin are you using?</string> <string name="configbuilder_insulin_description">Which type of insulin are you using?</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string> <string name="enablesuperbolus">Enable superbolus in wizard</string>
@ -224,13 +195,7 @@
<string name="devslope_shortname">DEVSLOPE</string> <string name="devslope_shortname">DEVSLOPE</string>
<string name="nav_about">About</string> <string name="nav_about">About</string>
<string name="smscommunicator_missingphonestatepermission">Missing phone state permission</string> <string name="smscommunicator_missingphonestatepermission">Missing phone state permission</string>
<string name="overview_extendedbolus_cancel_button">Cancel Extended Bolus</string>
<string name="doprofileswitch">Do Profile Switch</string> <string name="doprofileswitch">Do Profile Switch</string>
<string name="careportal_sensor_label">Sensor</string>
<string name="careportal_insulin_label">Insulin</string>
<string name="careportal_pb_label">Pump battery</string>
<string name="careportal_age_label">age:</string>
<string name="careportal_level_label">level:</string>
<string name="ns_alarm_options">Alarm options</string> <string name="ns_alarm_options">Alarm options</string>
<string name="key_ns_announcements" translatable="false">ns_announcements</string> <string name="key_ns_announcements" translatable="false">ns_announcements</string>
<string name="key_ns_alarms" translatable="false">ns_alarms</string> <string name="key_ns_alarms" translatable="false">ns_alarms</string>
@ -264,15 +229,12 @@
<string name="key_DynISFAdjust" translatable="false">DynISFAdjust</string> <string name="key_DynISFAdjust" translatable="false">DynISFAdjust</string>
<string name="DynISFAdjust_title" formatted="false">DynamicISF Adjustment Factor %</string> <string name="DynISFAdjust_title" formatted="false">DynamicISF Adjustment Factor %</string>
<string name="DynISFAdjust_summary" formatted="false">Adjustment factor for DynamicISF. Set more than 100% for more aggressive correction doses, and less than 100% for less aggressive corrections.</string> <string name="DynISFAdjust_summary" formatted="false">Adjustment factor for DynamicISF. Set more than 100% for more aggressive correction doses, and less than 100% for less aggressive corrections.</string>
<string name="key_use_smb" translatable="false">use_smb</string>
<string name="key_use_uam" translatable="false">use_uam</string>
<string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string> <string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string>
<string name="enableuam">Enable UAM</string> <string name="enableuam">Enable UAM</string>
<string name="enablesmb">Enable SMB</string> <string name="enablesmb">Enable SMB</string>
<string name="enablesmb_summary">Use Super Micro Boluses instead of temp basal for faster action</string> <string name="enablesmb_summary">Use Super Micro Boluses instead of temp basal for faster action</string>
<string name="enableuam_summary">Detection of Unannounced meals</string> <string name="enableuam_summary">Detection of Unannounced meals</string>
<string name="invalid">INVALID</string> <string name="invalid">INVALID</string>
<string name="careportal_newnstreatment_percentage_label">Percentage</string>
<string name="default_temptargets">Default Temp-Targets</string> <string name="default_temptargets">Default Temp-Targets</string>
<string name="eatingsoon_duration">eatingsoon duration</string> <string name="eatingsoon_duration">eatingsoon duration</string>
<string name="eatingsoon_target">eatingsoon target</string> <string name="eatingsoon_target">eatingsoon target</string>
@ -308,13 +270,6 @@
<string name="overview_editquickwizard_usecob">COB calculation</string> <string name="overview_editquickwizard_usecob">COB calculation</string>
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string> <string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
<string name="overview_editquickwizard_usepercentage">Percentage calculation</string> <string name="overview_editquickwizard_usepercentage">Percentage calculation</string>
<string name="loopenabled">Loop enabled</string>
<string name="apsselected">APS selected</string>
<string name="synchaswritepermission">Synchronization service has write permission</string>
<string name="closedmodeenabled">Closed mode enabled</string>
<string name="maxiobset">Maximal IOB set properly</string>
<string name="hasbgdata">BG available from selected source</string>
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="key_enableSMB_always" translatable="false">enableSMB_always</string> <string name="key_enableSMB_always" translatable="false">enableSMB_always</string>
<string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string> <string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string>
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string> <string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>
@ -342,11 +297,9 @@
<string name="carb_increment_button_message">Number of carbs to add when button is pressed</string> <string name="carb_increment_button_message">Number of carbs to add when button is pressed</string>
<string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string> <string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string>
<string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string> <string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string>
<string name="overview_cgm">CGM</string>
<string name="ignore5m">Ignore 5m</string> <string name="ignore5m">Ignore 5m</string>
<string name="ignore15m">Ignore 15m</string> <string name="ignore15m">Ignore 15m</string>
<string name="ignore30m">Ignore 30m</string> <string name="ignore30m">Ignore 30m</string>
<string name="nav_historybrowser">History browser</string>
<string name="wear_notifysmb_title">Notify on SMB</string> <string name="wear_notifysmb_title">Notify on SMB</string>
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string> <string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
<string name="wear_predictions_summary">Show the predictions on the watchface.</string> <string name="wear_predictions_summary">Show the predictions on the watchface.</string>
@ -364,34 +317,10 @@
<string name="overview_show_cob">Carbs On Board</string> <string name="overview_show_cob">Carbs On Board</string>
<string name="overview_show_iob">Insulin On Board</string> <string name="overview_show_iob">Insulin On Board</string>
<string name="overview_show_basals">Basals</string> <string name="overview_show_basals">Basals</string>
<string name="closed_loop_disabled_on_dev_branch">Running dev version. Closed loop is disabled.</string>
<string name="engineering_mode_enabled">Engineering mode enabled</string> <string name="engineering_mode_enabled">Engineering mode enabled</string>
<string name="pumpisnottempbasalcapable">Pump is not temp basal capable</string>
<string name="closedmodedisabledinpreferences">Closed loop mode disabled in preferences</string>
<string name="autosensdisabledinpreferences">Autosens disabled in preferences</string>
<string name="smbdisabledinpreferences">SMB disabled in preferences</string>
<string name="uamdisabledinpreferences">UAM disabled in preferences</string>
<string name="uamdisabledoref1notselected">UAM disabled because it rely on Oref1 sensitivity plugin</string>
<string name="key_openapsma_max_basal" translatable="false">openapsma_max_basal</string>
<string name="key_openapsama_current_basal_safety_multiplier" translatable="false">openapsama_current_basal_safety_multiplier</string>
<string name="key_openapsama_max_daily_safety_multiplier" translatable="false">openapsama_max_daily_safety_multiplier</string>
<string name="maxbasalmultiplier">max basal multiplier</string>
<string name="maxdailybasalmultiplier">max daily basal multiplier</string>
<string name="key_openapsma_max_iob" translatable="false">openapsma_max_iob</string>
<string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string> <string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
<string name="basal_set_correctly">Basal set correctly</string> <string name="basal_set_correctly">Basal set correctly</string>
<string name="key_treatmentssafety_maxbolus" translatable="false">treatmentssafety_maxbolus</string>
<string name="key_lgs_threshold" translatable="false">lgsThreshold</string>
<string name="limitingextendedbolus">Limiting extended bolus to %1$.1f U because of %2$s</string>
<string name="limitingcarbs">Limiting carbs to %1$d g because of %2$s</string>
<string name="limitingiob">Limiting IOB to %1$.1f U because of %2$s</string>
<string name="maxvalueinpreferences">max value in preferences</string>
<string name="hardlimit">hard limit</string>
<string name="key_openapsama_useautosens" translatable="false">openapsama_useautosens</string>
<string name="smbalwaysdisabled">SMB always and after carbs disabled because active BG source doesn\'t support advanced filtering</string>
<string name="smbnotallowedinopenloopmode">SMB not allowed in open loop mode</string>
<string name="iobcobcalculator" translatable="false">IobCobCalculator</string> <string name="iobcobcalculator" translatable="false">IobCobCalculator</string>
<string name="key_openapssmb_max_iob" translatable="false">openapsmb_max_iob</string>
<string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string> <string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string>
<string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string> <string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string>
<string name="absorption_cutoff_title">Meal max absorption time [h]</string> <string name="absorption_cutoff_title">Meal max absorption time [h]</string>
@ -486,23 +415,15 @@
<string name="key_smbmaxminutes" translatable="false">smbmaxminutes</string> <string name="key_smbmaxminutes" translatable="false">smbmaxminutes</string>
<string name="key_uamsmbmaxminutes" translatable="false">uamsmbmaxminutes</string> <string name="key_uamsmbmaxminutes" translatable="false">uamsmbmaxminutes</string>
<string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string> <string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string>
<string name="increasingmaxbasal">Increasing max basal value because setting is lower than your max basal in profile</string>
<string name="unitsnosemicolon">Units</string> <string name="unitsnosemicolon">Units</string>
<string name="objectives_button_unfinish">Clear finished</string>
<string name="objectives_button_unstart">Clear started</string>
<string name="doyouwantresetstart">Do you want reset objective start? You may lose your progress.</string>
<string name="setupwizard_units_prompt">Select units you want to display values in</string> <string name="setupwizard_units_prompt">Select units you want to display values in</string>
<string name="key_wear_detailediob" translatable="false">wear_detailediob</string> <string name="key_wear_detailediob" translatable="false">wear_detailediob</string>
<string name="key_wear_showbgi" translatable="false">wear_showbgi</string> <string name="key_wear_showbgi" translatable="false">wear_showbgi</string>
<string name="low_mark_comment">Lower value of in range area (display only)</string> <string name="low_mark_comment">Lower value of in range area (display only)</string>
<string name="high_mark_comment">Higher value of in range area (display only)</string> <string name="high_mark_comment">Higher value of in range area (display only)</string>
<string name="tools">Tools</string>
<string name="show_calculation">Show calcuation</string>
<string name="show_removed">Show removed</string> <string name="show_removed">Show removed</string>
<string name="clearqueueconfirm">Clear queue? All data in queue will be lost!</string> <string name="clearqueueconfirm">Clear queue? All data in queue will be lost!</string>
<string name="key_wear_detailed_delta" translatable="false">wear_detailed_delta</string> <string name="key_wear_detailed_delta" translatable="false">wear_detailed_delta</string>
<string name="ebstopsloop">Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?</string>
<string name="closed_loop_disabled_with_eb">Closed loop disabled because of running Extended bolus</string>
<string name="chartmenu">Chart menu</string> <string name="chartmenu">Chart menu</string>
<string name="databroadcaster" translatable="false">Data Broadcaster</string> <string name="databroadcaster" translatable="false">Data Broadcaster</string>
<string name="loop_smbrequest_time_label">SMB request time</string> <string name="loop_smbrequest_time_label">SMB request time</string>
@ -517,12 +438,6 @@
<string name="overview_show_absinsulin">Absolute insulin</string> <string name="overview_show_absinsulin">Absolute insulin</string>
<string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string> <string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string>
<string name="current_master_password">Current master password</string> <string name="current_master_password">Current master password</string>
<string name="classic_description">Original skin</string>
<string name="lowres_description">Low Resolution skin</string>
<string name="buttonson_description">Buttons are always displayed on bottom of screen</string>
<string name="largedisplay_description">Large display</string>
<string name="key_skin" translatable="false">skin</string>
<string name="skin">Skin</string>
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string> <string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
<string name="copytolocalprofile_invalid">Unable to create profile. Profile is invalid.</string> <string name="copytolocalprofile_invalid">Unable to create profile. Profile is invalid.</string>
<string name="cta_dont_kill_my_app_info">Don\'t kill my app?</string> <string name="cta_dont_kill_my_app_info">Don\'t kill my app?</string>
@ -531,7 +446,6 @@
<string name="enablebolusreminder_summary">Use reminder to bolus later with wizard ("post-bolus")</string> <string name="enablebolusreminder_summary">Use reminder to bolus later with wizard ("post-bolus")</string>
<string name="fabric_upload_disabled">Crash logs upload disabled!</string> <string name="fabric_upload_disabled">Crash logs upload disabled!</string>
<string name="graph_menu_divider_header">Graph</string> <string name="graph_menu_divider_header">Graph</string>
<string name="chart_menu">Chart menu</string>
<string name="clear_filter">Clear filter</string> <string name="clear_filter">Clear filter</string>
<string name="cannula">Cannula</string> <string name="cannula">Cannula</string>
<string name="common_values">Use values of your largest food you usually eat\n</string> <string name="common_values">Use values of your largest food you usually eat\n</string>
@ -541,19 +455,10 @@
<string name="privacy_summary">You can provide optional email address if you want to be notified about app crashes. This is not an automated service. You will be contacted by developers in dangerous situations.</string> <string name="privacy_summary">You can provide optional email address if you want to be notified about app crashes. This is not an automated service. You will be contacted by developers in dangerous situations.</string>
<string name="data_status">BG data status</string> <string name="data_status">BG data status</string>
<string name="remove_bg_readings">Remove BG readings</string> <string name="remove_bg_readings">Remove BG readings</string>
<string name="statuslights_cannula_age">cannula age</string>
<string name="statuslights_patch_pump_age">patch pump age</string>
<string name="patch_pump">Patch pump</string>
<string name="identification">Identification (email, FB or Discord nick etc)</string> <string name="identification">Identification (email, FB or Discord nick etc)</string>
<string name="identification_not_set">Identification not set in dev mode</string> <string name="identification_not_set">Identification not set in dev mode</string>
<string name="a11y_dialog">dialog</string> <string name="a11y_dialog">dialog</string>
<string name="a11y_current_bg">current blood glucose</string>
<string name="not_available_full">Not available</string> <string name="not_available_full">Not available</string>
<string name="a11y_graph">graph</string>
<string name="a11y_bg_quality">blood glucose quality</string>
<string name="a11y_insulin_label">insulin</string>
<string name="a11y_blood_glucose">blood glucose</string>
<string name="a11y_bg_outdated">outdated</string>
<!-- WEAR OS--> <!-- WEAR OS-->
<string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string> <string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string>
<string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string> <string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string>
@ -577,7 +482,6 @@
<string name="loop_status">Loop status</string> <string name="loop_status">Loop status</string>
<string name="graph_scale">Graph scale</string> <string name="graph_scale">Graph scale</string>
<string name="a11y_open_settings">open settings</string> <string name="a11y_open_settings">open settings</string>
<string name="a11y_set_carb_timer">set carb timer alarm</string>
<string name="device_all">All</string> <string name="device_all">All</string>
<string name="device_phone">Phone</string> <string name="device_phone">Phone</string>
<string name="device_watch">Watch</string> <string name="device_watch">Watch</string>

View file

@ -97,7 +97,7 @@
</PreferenceCategory> </PreferenceCategory>
<info.nightscout.androidaps.skins.SkinListPreference <info.nightscout.plugins.skins.SkinListPreference
android:key="@string/key_skin" android:key="@string/key_skin"
android:title="@string/skin" /> android:title="@string/skin" />

View file

@ -14,9 +14,6 @@ import info.nightscout.androidaps.insight.database.InsightDbHelper
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
@ -25,19 +22,23 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInf
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.androidaps.utils.Profiler import info.nightscout.androidaps.utils.Profiler
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.implementation.constraints.ConstraintsImpl
import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Objectives
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
@ -210,7 +211,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
fabricPrivacy, fabricPrivacy,
dateUtil, dateUtil,
repository, repository,
glucoseStatusProvider glucoseStatusProvider,
sp
) )
safetyPlugin = safetyPlugin =
SafetyPlugin( SafetyPlugin(
@ -220,10 +222,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
sp, sp,
rxBus, rxBus,
constraintChecker, constraintChecker,
openAPSAMAPlugin,
openAPSSMBPlugin,
openAPSSMBDynamicISFPlugin,
sensitivityOref1Plugin,
activePlugin, activePlugin,
hardLimits, hardLimits,
BuildHelperImpl(config, fileListProvider), BuildHelperImpl(config, fileListProvider),
@ -238,6 +236,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
constraintsPluginsList.add(danaRPlugin) constraintsPluginsList.add(danaRPlugin)
constraintsPluginsList.add(danaRSPlugin) constraintsPluginsList.add(danaRSPlugin)
constraintsPluginsList.add(insightPlugin) constraintsPluginsList.add(insightPlugin)
constraintsPluginsList.add(openAPSAMAPlugin)
constraintsPluginsList.add(openAPSSMBPlugin) constraintsPluginsList.add(openAPSSMBPlugin)
`when`(activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)).thenReturn(constraintsPluginsList) `when`(activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)).thenReturn(constraintsPluginsList)
objectivesPlugin.onStart() objectivesPlugin.onStart()
@ -260,7 +259,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
@Test @Test
fun isClosedLoopAllowedTest() { fun isClosedLoopAllowedTest() {
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed") `when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed")
objectivesPlugin.objectives[ObjectivesPlugin.MAXIOB_ZERO_CL_OBJECTIVE].startedOn = 0 objectivesPlugin.objectives[Objectives.MAXIOB_ZERO_CL_OBJECTIVE].startedOn = 0
var c: Constraint<Boolean> = constraintChecker.isClosedLoopAllowed() var c: Constraint<Boolean> = constraintChecker.isClosedLoopAllowed()
aapsLogger.debug("Reason list: " + c.reasonList.toString()) aapsLogger.debug("Reason list: " + c.reasonList.toString())
// Assert.assertTrue(c.reasonList[0].toString().contains("Closed loop is disabled")) // Safety & Objectives // Assert.assertTrue(c.reasonList[0].toString().contains("Closed loop is disabled")) // Safety & Objectives
@ -275,7 +274,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
// Safety & Objectives // Safety & Objectives
@Test @Test
fun isAutosensModeEnabledTest() { fun isAutosensModeEnabledTest() {
objectivesPlugin.objectives[ObjectivesPlugin.AUTOSENS_OBJECTIVE].startedOn = 0 objectivesPlugin.objectives[Objectives.AUTOSENS_OBJECTIVE].startedOn = 0
`when`(sp.getBoolean(R.string.key_openapsama_useautosens, false)).thenReturn(false) `when`(sp.getBoolean(R.string.key_openapsama_useautosens, false)).thenReturn(false)
val c = constraintChecker.isAutosensModeEnabled() val c = constraintChecker.isAutosensModeEnabled()
Assert.assertEquals(true, c.reasonList.size == 2) // Safety & Objectives Assert.assertEquals(true, c.reasonList.size == 2) // Safety & Objectives
@ -304,7 +303,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
// Safety & Objectives // Safety & Objectives
@Test @Test
fun isSMBModeEnabledTest() { fun isSMBModeEnabledTest() {
objectivesPlugin.objectives[ObjectivesPlugin.SMB_OBJECTIVE].startedOn = 0 objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0
`when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(false) `when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(false)
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("open") `when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("open")
// `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(Constraint(true)) // `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(Constraint(true))
@ -423,7 +422,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
val d = constraintChecker.getMaxIOBAllowed() val d = constraintChecker.getMaxIOBAllowed()
Assert.assertEquals(1.5, d.value(), 0.01) Assert.assertEquals(1.5, d.value(), 0.01)
Assert.assertEquals(d.reasonList.toString(), 2, d.reasonList.size) Assert.assertEquals(d.reasonList.toString(), 2, d.reasonList.size)
Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("OpenAPSAMA: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
} }
@Test @Test
@ -439,6 +438,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
val d = constraintChecker.getMaxIOBAllowed() val d = constraintChecker.getMaxIOBAllowed()
Assert.assertEquals(3.0, d.value(), 0.01) Assert.assertEquals(3.0, d.value(), 0.01)
Assert.assertEquals(d.reasonList.toString(), 2, d.reasonList.size) Assert.assertEquals(d.reasonList.toString(), 2, d.reasonList.size)
Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("OpenAPSSMB: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
} }
} }

View file

@ -1,24 +1,26 @@
package info.nightscout.androidaps.plugins.constraints.safety package info.nightscout.androidaps.plugins.safety
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.HardLimitsMock import info.nightscout.androidaps.HardLimitsMock
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.utils.Profiler
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
@ -30,20 +32,20 @@ class SafetyPluginTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP
@Mock lateinit var constraintChecker: Constraints @Mock lateinit var constraintChecker: Constraints
@Mock lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin
@Mock lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin
@Mock lateinit var openAPSSMBDynamicISFPlugin: OpenAPSSMBDynamicISFPlugin
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
@Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var activePlugin: ActivePlugin
@Mock lateinit var buildHelper: BuildHelper @Mock lateinit var buildHelper: BuildHelper
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
@Mock lateinit var glimpPlugin: GlimpPlugin @Mock lateinit var glimpPlugin: GlimpPlugin
@Mock lateinit var profiler: Profiler
@Mock lateinit var repository: AppRepository @Mock lateinit var repository: AppRepository
@Mock lateinit var glucoseStatusProvider: GlucoseStatusProvider
private lateinit var hardLimits: HardLimits private lateinit var hardLimits: HardLimits
private lateinit var safetyPlugin: SafetyPlugin private lateinit var safetyPlugin: SafetyPlugin
private lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin
private lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin
val injector = HasAndroidInjector { AndroidInjector { } } private val injector = HasAndroidInjector { AndroidInjector { } }
private val pumpDescription = PumpDescription() private val pumpDescription = PumpDescription()
@Before @Before
@ -67,19 +69,21 @@ class SafetyPluginTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") `when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
`when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") `when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
`when`(rh.gs(R.string.key_child)).thenReturn("child") `when`(rh.gs(R.string.key_child)).thenReturn("child")
`when`(rh.gs(R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend")
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
`when`(config.APS).thenReturn(true) `when`(config.APS).thenReturn(true)
hardLimits = HardLimitsMock(sp, rh) hardLimits = HardLimitsMock(sp, rh)
safetyPlugin = SafetyPlugin( safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, buildHelper, iobCobCalculator, config, dateUtil)
injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, openAPSSMBDynamicISFPlugin, sensitivityOref1Plugin, activePlugin, openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy,
hardLimits, buildHelper, dateUtil, repository, glucoseStatusProvider, sp)
iobCobCalculator, config, dateUtil openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, sp,
) dateUtil, repository, glucoseStatusProvider)
} }
@Test fun pumpDescriptionShouldLimitLoopInvocation() { @Test
fun pumpDescriptionShouldLimitLoopInvocation() {
pumpDescription.isTempBasalCapable = false pumpDescription.isTempBasalCapable = false
var c = Constraint(true) var c = Constraint(true)
c = safetyPlugin.isLoopInvocationAllowed(c) c = safetyPlugin.isLoopInvocationAllowed(c)
@ -87,7 +91,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun disabledEngineeringModeShouldLimitClosedLoop() { @Test
fun disabledEngineeringModeShouldLimitClosedLoop() {
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed") `when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed")
`when`(buildHelper.isEngineeringModeOrRelease()).thenReturn(false) `when`(buildHelper.isEngineeringModeOrRelease()).thenReturn(false)
var c = Constraint(true) var c = Constraint(true)
@ -96,7 +101,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun setOpenLoopInPreferencesShouldLimitClosedLoop() { @Test
fun setOpenLoopInPreferencesShouldLimitClosedLoop() {
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("open") `when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("open")
var c = Constraint(true) var c = Constraint(true)
c = safetyPlugin.isClosedLoopAllowed(c) c = safetyPlugin.isClosedLoopAllowed(c)
@ -104,7 +110,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun notEnabledSMBInPreferencesDisablesSMB() { @Test
fun notEnabledSMBInPreferencesDisablesSMB() {
`when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(false) `when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(false)
`when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(true)) `when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(true))
var c = Constraint(true) var c = Constraint(true)
@ -113,7 +120,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun openLoopPreventsSMB() { @Test
fun openLoopPreventsSMB() {
`when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(true) `when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(true)
`when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(false)) `when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(false))
var c = Constraint(true) var c = Constraint(true)
@ -122,7 +130,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun bgSourceShouldPreventSMBAlways() { @Test
fun bgSourceShouldPreventSMBAlways() {
`when`(activePlugin.activeBgSource).thenReturn(glimpPlugin) `when`(activePlugin.activeBgSource).thenReturn(glimpPlugin)
var c = Constraint(true) var c = Constraint(true)
c = safetyPlugin.isAdvancedFilteringEnabled(c) c = safetyPlugin.isAdvancedFilteringEnabled(c)
@ -130,7 +139,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals(false, c.value()) Assert.assertEquals(false, c.value())
} }
@Test fun basalRateShouldBeLimited() { @Test
fun basalRateShouldBeLimited() {
`when`(sp.getDouble(R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
`when`(sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
`when`(sp.getDouble(R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) `when`(sp.getDouble(R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
@ -149,7 +159,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting max basal rate to 1.00 U/h because of max value in preferences", c.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting max basal rate to 1.00 U/h because of max value in preferences", c.getMostLimitedReasons(aapsLogger))
} }
@Test fun doNotAllowNegativeBasalRate() { @Test
fun doNotAllowNegativeBasalRate() {
`when`(sp.getString(R.string.key_age, "")).thenReturn("child") `when`(sp.getString(R.string.key_age, "")).thenReturn("child")
val d = Constraint(-0.5) val d = Constraint(-0.5)
safetyPlugin.applyBasalConstraints(d, validProfile) safetyPlugin.applyBasalConstraints(d, validProfile)
@ -162,7 +173,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
) )
} }
@Test fun percentBasalRateShouldBeLimited() { @Test
fun percentBasalRateShouldBeLimited() {
// No limit by default // No limit by default
`when`(sp.getDouble(R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
`when`(sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
@ -185,7 +197,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting max percent rate to 100% because of pump limit", i.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting max percent rate to 100% because of pump limit", i.getMostLimitedReasons(aapsLogger))
} }
@Test fun doNotAllowNegativePercentBasalRate() { @Test
fun doNotAllowNegativePercentBasalRate() {
`when`(sp.getString(R.string.key_age, "")).thenReturn("child") `when`(sp.getString(R.string.key_age, "")).thenReturn("child")
val i = Constraint(-22) val i = Constraint(-22)
safetyPlugin.applyBasalPercentConstraints(i, validProfile) safetyPlugin.applyBasalPercentConstraints(i, validProfile)
@ -201,7 +214,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting max percent rate to 0% because of pump limit", i.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting max percent rate to 0% because of pump limit", i.getMostLimitedReasons(aapsLogger))
} }
@Test fun bolusAmountShouldBeLimited() { @Test
fun bolusAmountShouldBeLimited() {
`when`(sp.getDouble(R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) `when`(sp.getDouble(R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
`when`(sp.getString(R.string.key_age, "")).thenReturn("child") `when`(sp.getString(R.string.key_age, "")).thenReturn("child")
var d = Constraint(Constants.REALLYHIGHBOLUS) var d = Constraint(Constants.REALLYHIGHBOLUS)
@ -216,7 +230,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting bolus to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting bolus to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
} }
@Test fun doNotAllowNegativeBolusAmount() { @Test
fun doNotAllowNegativeBolusAmount() {
`when`(sp.getDouble(R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) `when`(sp.getDouble(R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
`when`(sp.getString(R.string.key_age, "")).thenReturn("child") `when`(sp.getString(R.string.key_age, "")).thenReturn("child")
var d = Constraint(-22.0) var d = Constraint(-22.0)
@ -226,7 +241,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting bolus to 0.0 U because of it must be positive value", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting bolus to 0.0 U because of it must be positive value", d.getMostLimitedReasons(aapsLogger))
} }
@Test fun carbsAmountShouldBeLimited() { @Test
fun carbsAmountShouldBeLimited() {
// No limit by default // No limit by default
`when`(sp.getInt(R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48) `when`(sp.getInt(R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48)
@ -242,10 +258,13 @@ class SafetyPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Safety: Limiting carbs to 48 g because of max value in preferences", i.getReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting carbs to 48 g because of max value in preferences", i.getReasons(aapsLogger))
} }
@Test fun iobShouldBeLimited() { @Test
`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true) fun iobShouldBeLimited() {
`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false) openAPSAMAPlugin.setPluginEnabled(PluginType.APS, true)
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed") openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
//`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true)
//`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false)
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("lgs")
`when`(sp.getDouble(R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5) `when`(sp.getDouble(R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
`when`(sp.getDouble(R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0) `when`(sp.getDouble(R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
`when`(sp.getString(R.string.key_age, "")).thenReturn("teenage") `when`(sp.getString(R.string.key_age, "")).thenReturn("teenage")
@ -253,8 +272,22 @@ class SafetyPluginTest : TestBaseWithProfile() {
// Apply all limits // Apply all limits
var d = Constraint(Constants.REALLYHIGHIOB) var d = Constraint(Constants.REALLYHIGHIOB)
d = safetyPlugin.applyMaxIOBConstraints(d) d = safetyPlugin.applyMaxIOBConstraints(d)
Assert.assertEquals(3.0, d.value(), 0.01) Assert.assertEquals(HardLimits.MAX_IOB_LGS, d.value(), 0.01)
Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences\nSafety: Limiting IOB to 22.0 U because of hard limit", d.getReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting IOB to 0.0 U because of Low Glucose Suspend", d.getReasons(aapsLogger))
Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting IOB to 0.0 U because of Low Glucose Suspend", d.getMostLimitedReasons(aapsLogger))
// Apply all limits
d = Constraint(Constants.REALLYHIGHIOB)
val a = openAPSAMAPlugin.applyMaxIOBConstraints(d)
Assert.assertEquals(1.5, a.value(), 0.01)
Assert.assertEquals("OpenAPSAMA: Limiting IOB to 1.5 U because of max value in preferences\nOpenAPSAMA: Limiting IOB to 7.0 U because of hard limit", d.getReasons(aapsLogger))
Assert.assertEquals("OpenAPSAMA: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
// Apply all limits
d = Constraint(Constants.REALLYHIGHIOB)
val s = openAPSSMBPlugin.applyMaxIOBConstraints(d)
Assert.assertEquals(3.0, s.value(), 0.01)
Assert.assertEquals("OpenAPSSMB: Limiting IOB to 3.0 U because of max value in preferences\nOpenAPSSMB: Limiting IOB to 22.0 U because of hard limit", d.getReasons(aapsLogger))
Assert.assertEquals("OpenAPSSMB: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
} }
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils package info.nightscout.androidaps.utils
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.plugins.constraints.objectives.SntpClient
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test

View file

@ -79,7 +79,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
override fun generateDialog(root: LinearLayout) { override fun generateDialog(root: LinearLayout) {
val unitResId = if (value.units == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol val unitResId = if (value.units == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol
LayoutBuilder() LayoutBuilder()
.add(LabelWithElement(rh, rh.gs(R.string.careportal_temporarytarget) + "\n[" + rh.gs(unitResId) + "]", "", value)) .add(LabelWithElement(rh, rh.gs(R.string.temporary_target) + "\n[" + rh.gs(unitResId) + "]", "", value))
.add(LabelWithElement(rh, rh.gs(R.string.duration_min_label), "", duration)) .add(LabelWithElement(rh, rh.gs(R.string.duration_min_label), "", duration))
.build(root) .build(root)
} }

View file

@ -54,7 +54,7 @@ class TriggerTempTarget(injector: HasAndroidInjector) : Trigger(injector) {
return this return this
} }
override fun friendlyName(): Int = R.string.careportal_temporarytarget override fun friendlyName(): Int = R.string.temporary_target
override fun friendlyDescription(): String = override fun friendlyDescription(): String =
rh.gs(R.string.temptargetcompared, rh.gs(comparator.value.stringRes)) rh.gs(R.string.temptargetcompared, rh.gs(comparator.value.stringRes))
@ -65,7 +65,7 @@ class TriggerTempTarget(injector: HasAndroidInjector) : Trigger(injector) {
override fun generateDialog(root: LinearLayout) { override fun generateDialog(root: LinearLayout) {
LayoutBuilder() LayoutBuilder()
.add(StaticLabel(rh, R.string.careportal_temporarytarget, this)) .add(StaticLabel(rh, R.string.temporary_target, this))
.add(comparator) .add(comparator)
.build(root) .build(root)
} }

View file

@ -75,7 +75,7 @@ class PumpEnactResultObject(injector: HasAndroidInjector) : PumpEnactResult {
isTempCancel -> { isTempCancel -> {
ret += "\n${rh.gs(R.string.enacted)}: $enacted" ret += "\n${rh.gs(R.string.enacted)}: $enacted"
if (comment.isNotEmpty()) ret += "\n${rh.gs(R.string.comment)}: $comment" if (comment.isNotEmpty()) ret += "\n${rh.gs(R.string.comment)}: $comment"
ret += "\n${rh.gs(R.string.canceltemp)}" ret += "\n${rh.gs(R.string.cancel_temp)}"
} }
isPercent -> { isPercent -> {
@ -113,7 +113,7 @@ class PumpEnactResultObject(injector: HasAndroidInjector) : PumpEnactResult {
isTempCancel -> { isTempCancel -> {
ret += "<br><b>" + rh.gs(R.string.enacted) + "</b>: " + enacted ret += "<br><b>" + rh.gs(R.string.enacted) + "</b>: " + enacted
ret += "<br><b>" + rh.gs(R.string.comment) + "</b>: " + comment + ret += "<br><b>" + rh.gs(R.string.comment) + "</b>: " + comment +
"<br>" + rh.gs(R.string.canceltemp) "<br>" + rh.gs(R.string.cancel_temp)
} }
isPercent && percent != -1 -> { isPercent && percent != -1 -> {

View file

@ -102,7 +102,7 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (isChangeRequested) { if (isChangeRequested) {
// rate // rate
var ret: String = if (rate == 0.0 && duration == 0) "${rh.gs(R.string.canceltemp)} " var ret: String = if (rate == 0.0 && duration == 0) "${rh.gs(R.string.cancel_temp)} "
else if (rate == -1.0) "${rh.gs(R.string.let_temp_basal_run)}\n" else if (rate == -1.0) "${rh.gs(R.string.let_temp_basal_run)}\n"
else if (usePercent) "${rh.gs(R.string.rate)}: ${DecimalFormatter.to2Decimal(percent.toDouble())}% (${DecimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0)} U/h) " + else if (usePercent) "${rh.gs(R.string.rate)}: ${DecimalFormatter.to2Decimal(percent.toDouble())}% (${DecimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0)} U/h) " +
"${rh.gs(R.string.duration)}: ${DecimalFormatter.to2Decimal(duration.toDouble())} min " "${rh.gs(R.string.duration)}: ${DecimalFormatter.to2Decimal(duration.toDouble())} min "
@ -127,7 +127,7 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (isChangeRequested) { if (isChangeRequested) {
// rate // rate
var ret: String = if (rate == 0.0 && duration == 0) rh.gs(R.string.canceltemp) + "<br>" else if (rate == -1.0) rh.gs(R.string.let_temp_basal_run) + "<br>" else if (usePercent) "<b>" + rh.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(percent.toDouble()) + "% " + var ret: String = if (rate == 0.0 && duration == 0) rh.gs(R.string.cancel_temp) + "<br>" else if (rate == -1.0) rh.gs(R.string.let_temp_basal_run) + "<br>" else if (usePercent) "<b>" + rh.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(percent.toDouble()) + "% " +
"(" + DecimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0) + " U/h)<br>" + "(" + DecimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0) + " U/h)<br>" +
"<b>" + rh.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration.toDouble()) + " min<br>" else "<b>" + rh.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " + "<b>" + rh.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration.toDouble()) + " min<br>" else "<b>" + rh.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
"(" + DecimalFormatter.to2Decimal(rate / pump.baseBasalRate * 100.0) + "%) <br>" + "(" + DecimalFormatter.to2Decimal(rate / pump.baseBasalRate * 100.0) + "%) <br>" +

View file

@ -138,16 +138,16 @@ class Translator @Inject internal constructor(
TherapyEvent.Type.QUESTION -> rh.gs(R.string.careportal_question) TherapyEvent.Type.QUESTION -> rh.gs(R.string.careportal_question)
TherapyEvent.Type.EXERCISE -> rh.gs(R.string.careportal_exercise) TherapyEvent.Type.EXERCISE -> rh.gs(R.string.careportal_exercise)
TherapyEvent.Type.CANNULA_CHANGE -> rh.gs(R.string.careportal_pump_site_change) TherapyEvent.Type.CANNULA_CHANGE -> rh.gs(R.string.careportal_pump_site_change)
TherapyEvent.Type.PUMP_BATTERY_CHANGE -> rh.gs(R.string.careportal_pumpbatterychange) TherapyEvent.Type.PUMP_BATTERY_CHANGE -> rh.gs(R.string.pump_battery_change)
TherapyEvent.Type.SENSOR_STARTED -> rh.gs(R.string.careportal_cgmsensorstart) TherapyEvent.Type.SENSOR_STARTED -> rh.gs(R.string.careportal_cgmsensorstart)
TherapyEvent.Type.SENSOR_STOPPED -> rh.gs(R.string.careportal_cgm_sensor_stop) TherapyEvent.Type.SENSOR_STOPPED -> rh.gs(R.string.careportal_cgm_sensor_stop)
TherapyEvent.Type.SENSOR_CHANGE -> rh.gs(R.string.careportal_cgmsensorinsert) TherapyEvent.Type.SENSOR_CHANGE -> rh.gs(R.string.cgm_sensor_insert)
TherapyEvent.Type.INSULIN_CHANGE -> rh.gs(R.string.careportal_insulin_cartridge_change) TherapyEvent.Type.INSULIN_CHANGE -> rh.gs(R.string.careportal_insulin_cartridge_change)
TherapyEvent.Type.DAD_ALERT -> rh.gs(R.string.careportal_dad_alert) TherapyEvent.Type.DAD_ALERT -> rh.gs(R.string.careportal_dad_alert)
TherapyEvent.Type.TEMPORARY_BASAL_START -> rh.gs(R.string.careportal_tempbasalstart) TherapyEvent.Type.TEMPORARY_BASAL_START -> rh.gs(R.string.careportal_tempbasalstart)
TherapyEvent.Type.TEMPORARY_BASAL_END -> rh.gs(R.string.careportal_tempbasalend) TherapyEvent.Type.TEMPORARY_BASAL_END -> rh.gs(R.string.careportal_tempbasalend)
TherapyEvent.Type.PROFILE_SWITCH -> rh.gs(R.string.careportal_profileswitch) TherapyEvent.Type.PROFILE_SWITCH -> rh.gs(R.string.careportal_profileswitch)
TherapyEvent.Type.TEMPORARY_TARGET -> rh.gs(R.string.careportal_temporarytarget) TherapyEvent.Type.TEMPORARY_TARGET -> rh.gs(R.string.temporary_target)
TherapyEvent.Type.TEMPORARY_TARGET_CANCEL -> rh.gs(R.string.careportal_temporarytargetcancel) TherapyEvent.Type.TEMPORARY_TARGET_CANCEL -> rh.gs(R.string.careportal_temporarytargetcancel)
TherapyEvent.Type.APS_OFFLINE -> rh.gs(R.string.careportal_openapsoffline) TherapyEvent.Type.APS_OFFLINE -> rh.gs(R.string.careportal_openapsoffline)
TherapyEvent.Type.NS_MBG -> rh.gs(R.string.careportal_mbg) TherapyEvent.Type.NS_MBG -> rh.gs(R.string.careportal_mbg)

View file

@ -51,7 +51,7 @@ class UserEntryPresentationHelper @Inject constructor(
Sources.TTDialog -> R.drawable.ic_temptarget_high Sources.TTDialog -> R.drawable.ic_temptarget_high
Sources.ProfileSwitchDialog -> R.drawable.ic_actions_profileswitch Sources.ProfileSwitchDialog -> R.drawable.ic_actions_profileswitch
Sources.LoopDialog -> R.drawable.ic_loop_closed Sources.LoopDialog -> R.drawable.ic_loop_closed
Sources.TempBasalDialog -> R.drawable.ic_actions_starttempbasal Sources.TempBasalDialog -> R.drawable.ic_actions_start_temp_basal
Sources.CalibrationDialog -> R.drawable.ic_calibration Sources.CalibrationDialog -> R.drawable.ic_calibration
Sources.FillDialog -> R.drawable.ic_cp_pump_cannula Sources.FillDialog -> R.drawable.ic_cp_pump_cannula
Sources.BgCheck -> R.drawable.ic_cp_bgcheck Sources.BgCheck -> R.drawable.ic_cp_bgcheck

View file

@ -309,7 +309,7 @@
<string name="startprofile">Start profile %1$d%% for %2$d min</string> <string name="startprofile">Start profile %1$d%% for %2$d min</string>
<!-- APSResult--> <!-- APSResult-->
<string name="canceltemp">Cancel temp basal</string> <string name="cancel_temp">Cancel temp basal</string>
<string name="let_temp_basal_run">Let temp basal run</string> <string name="let_temp_basal_run">Let temp basal run</string>
<string name="rate">Rate</string> <string name="rate">Rate</string>
<string name="duration">Duration</string> <string name="duration">Duration</string>
@ -335,7 +335,7 @@
<string name="careportal_question_message">Question : %1$s</string> <string name="careportal_question_message">Question : %1$s</string>
<string name="careportal_exercise_message">Exercise : %1$s</string> <string name="careportal_exercise_message">Exercise : %1$s</string>
<string name="careportal_pump_site_change">Pump Site Change</string> <string name="careportal_pump_site_change">Pump Site Change</string>
<string name="careportal_cgmsensorinsert">CGM Sensor Insert</string> <string name="cgm_sensor_insert">CGM Sensor Insert</string>
<string name="careportal_cgmsensorstart">CGM Sensor Start</string> <string name="careportal_cgmsensorstart">CGM Sensor Start</string>
<string name="careportal_cgm_sensor_stop">CGM Sensor Stop</string> <string name="careportal_cgm_sensor_stop">CGM Sensor Stop</string>
<string name="careportal_dad_alert">D.A.D. Alert</string> <string name="careportal_dad_alert">D.A.D. Alert</string>
@ -349,8 +349,8 @@
<string name="careportal_tempbasalend">Temp Basal End</string> <string name="careportal_tempbasalend">Temp Basal End</string>
<string name="careportal_carbscorrection">Carbs correction</string> <string name="careportal_carbscorrection">Carbs correction</string>
<string name="careportal_openapsoffline">OpenAPS Offline</string> <string name="careportal_openapsoffline">OpenAPS Offline</string>
<string name="careportal_pumpbatterychange">Pump Battery Change</string> <string name="pump_battery_change">Pump Battery Change</string>
<string name="careportal_temporarytarget">Temporary target</string> <string name="temporary_target">Temporary target</string>
<string name="careportal_temporarytargetvalue">Temporary target value</string> <string name="careportal_temporarytargetvalue">Temporary target value</string>
<string name="careportal_temporarytargetcancel">Temporary target cancel</string> <string name="careportal_temporarytargetcancel">Temporary target cancel</string>
<string name="boluswizard">Bolus wizard</string> <string name="boluswizard">Bolus wizard</string>

View file

@ -30,7 +30,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.configbuilder_insulin)).thenReturn("Insulin") `when`(rh.gs(R.string.configbuilder_insulin)).thenReturn("Insulin")
`when`(rh.gs(R.string.smb_shortname)).thenReturn("SMB") `when`(rh.gs(R.string.smb_shortname)).thenReturn("SMB")
`when`(rh.gs(R.string.insulin_unit_shortname)).thenReturn("U") `when`(rh.gs(R.string.insulin_unit_shortname)).thenReturn("U")
`when`(rh.gs(R.string.canceltemp)).thenReturn("Cancel temp basal") `when`(rh.gs(R.string.cancel_temp)).thenReturn("Cancel temp basal")
`when`(rh.gs(R.string.duration)).thenReturn("Duration") `when`(rh.gs(R.string.duration)).thenReturn("Duration")
`when`(rh.gs(R.string.percent)).thenReturn("Percent") `when`(rh.gs(R.string.percent)).thenReturn("Percent")
`when`(rh.gs(R.string.absolute)).thenReturn("Absolute") `when`(rh.gs(R.string.absolute)).thenReturn("Absolute")

View file

@ -284,4 +284,8 @@ interface Pump {
* Pumps with a hardware link can set via config "Battery Change Logging" * Pumps with a hardware link can set via config "Battery Change Logging"
*/ */
fun isBatteryChangeLoggingEnabled(): Boolean = false fun isBatteryChangeLoggingEnabled(): Boolean = false
/**
* Pumps is connect via RileyLink
*/
fun isUseRileyLinkBatteryLevel(): Boolean = false
} }

View file

@ -2,6 +2,7 @@ package info.nightscout.interfaces.ui
import android.content.Context import android.content.Context
import androidx.annotation.RawRes import androidx.annotation.RawRes
import androidx.annotation.StringRes
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
/** /**
@ -12,6 +13,7 @@ interface ActivityNames {
val mainActivityClass: Class<*> val mainActivityClass: Class<*>
val tddStatsActivity: Class<*> val tddStatsActivity: Class<*>
val historyBrowseActivity: Class<*>
val errorHelperActivity: Class<*> val errorHelperActivity: Class<*>
val bolusProgressHelperActivity: Class<*> val bolusProgressHelperActivity: Class<*>
val singleFragmentActivity: Class<*> val singleFragmentActivity: Class<*>
@ -25,7 +27,11 @@ interface ActivityNames {
*/ */
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0) fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0)
fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String) fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String)
fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String?) fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String? = null)
fun runTempBasalDialog(fragmentManager: FragmentManager)
fun runTempTargetDialog(fragmentManager: FragmentManager)
fun runExtendedBolusDialog(fragmentManager: FragmentManager)
fun runFillDialog(fragmentManager: FragmentManager)
enum class Mode(val i: Int) { enum class Mode(val i: Int) {
RUNNING_PROFILE(1), RUNNING_PROFILE(1),
@ -34,4 +40,15 @@ interface ActivityNames {
PROFILE_COMPARE(4) PROFILE_COMPARE(4)
} }
fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: Mode, customProfile: String?= null, customProfileName: String? = null, customProfile2: String? = null) fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: Mode, customProfile: String?= null, customProfileName: String? = null, customProfile2: String? = null)
enum class EventType {
BGCHECK,
SENSOR_INSERT,
BATTERY_CHANGE,
NOTE,
EXERCISE,
QUESTION,
ANNOUNCEMENT
}
fun runCareDialog(fragmentManager: FragmentManager, options: EventType, @StringRes event: Int)
} }

View file

@ -26,6 +26,9 @@ dependencies {
implementation project(':interfaces') implementation project(':interfaces')
implementation project(':ns-sdk') implementation project(':ns-sdk')
api "androidx.appcompat:appcompat:$appcompat_version"
api "com.google.android.material:material:$material_version"
// Actions // Actions
api 'androidx.gridlayout:gridlayout:1.0.0' api 'androidx.gridlayout:gridlayout:1.0.0'
@ -48,4 +51,6 @@ dependencies {
api 'com.eatthepath:java-otp:0.3.1' api 'com.eatthepath:java-otp:0.3.1'
api 'com.github.kenglxn.QRGen:android:2.6.0' api 'com.github.kenglxn.QRGen:android:2.6.0'
// Overview
api 'com.google.android.flexbox:flexbox:3.0.0'
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.constraints.objectives package info.nightscout.plugins.constraints.objectives
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
@ -16,26 +16,25 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSmoothScroller import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
import info.nightscout.androidaps.plugins.constraints.objectives.dialogs.NtpProgressDialog
import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
import info.nightscout.androidaps.utils.SntpClient
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.entities.ValueWithUnit import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.plugins.databinding.ObjectivesFragmentBinding
import info.nightscout.plugins.databinding.ObjectivesItemBinding
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNtpStatus import info.nightscout.rx.events.EventNtpStatus
import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP

View file

@ -1,20 +1,8 @@
package info.nightscout.androidaps.plugins.constraints.objectives package info.nightscout.plugins.constraints.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective0
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective1
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective10
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective2
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective3
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective4
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective5
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective6
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective7
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective9
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Objectives import info.nightscout.interfaces.constraints.Objectives
@ -27,6 +15,18 @@ import info.nightscout.interfaces.constraints.Objectives.Companion.SMB_OBJECTIVE
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.objectives.objectives.Objective0
import info.nightscout.plugins.constraints.objectives.objectives.Objective1
import info.nightscout.plugins.constraints.objectives.objectives.Objective10
import info.nightscout.plugins.constraints.objectives.objectives.Objective2
import info.nightscout.plugins.constraints.objectives.objectives.Objective3
import info.nightscout.plugins.constraints.objectives.objectives.Objective4
import info.nightscout.plugins.constraints.objectives.objectives.Objective5
import info.nightscout.plugins.constraints.objectives.objectives.Objective6
import info.nightscout.plugins.constraints.objectives.objectives.Objective7
import info.nightscout.plugins.constraints.objectives.objectives.Objective9
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP

View file

@ -0,0 +1,200 @@
package info.nightscout.plugins.constraints.objectives
import android.os.SystemClock
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.utils.DateUtil
import java.net.DatagramPacket
import java.net.DatagramSocket
import java.net.InetAddress
import javax.inject.Inject
import javax.inject.Singleton
/**
* {@hide}
*
*
* Simple SNTP client class for retrieving network time.
*
*
* Sample usage:
* <pre>SntpClient client = new SntpClient();
* if (client.requestTime("time.foo.com")) {
* long now = client.getNtpTime() + SystemClock.elapsedRealtime() - client.getNtpTimeReference();
* }
</pre> *
*/
@Singleton
class SntpClient @Inject constructor(
private val aapsLogger: AAPSLogger,
private val dateUtil: DateUtil
) {
companion object {
//private final int REFERENCE_TIME_OFFSET = 16;
private const val ORIGINATE_TIME_OFFSET = 24
private const val RECEIVE_TIME_OFFSET = 32
private const val TRANSMIT_TIME_OFFSET = 40
private const val NTP_PACKET_SIZE = 48
private const val NTP_PORT = 123
private const val NTP_MODE_CLIENT = 3
private const val NTP_VERSION = 3
// Number of seconds between Jan 1, 1900 and Jan 1, 1970
// 70 years plus 17 leap days
private const val OFFSET_1900_TO_1970 = (365L * 70L + 17L) * 24L * 60L * 60L
}
/**
* Returns the time computed from the NTP transaction.
*
* @return time value computed from NTP server response.
*/
// system time computed from NTP server response
private var ntpTime: Long = 0
/**
* Returns the reference clock value (value of SystemClock.elapsedRealtime())
* corresponding to the NTP time.
*
* @return reference clock corresponding to the NTP time.
*/
// value of SystemClock.elapsedRealtime() corresponding to mNtpTime
private var ntpTimeReference: Long = 0
/**
* Returns the round trip time of the NTP transaction
*
* @return round trip time in milliseconds.
*/
// round trip time in milliseconds
private var roundTripTime: Long = 0
abstract class Callback : Runnable {
var networkConnected = false
var success = false
var time: Long = 0
}
@Synchronized fun ntpTime(callback: Callback, isConnected: Boolean) {
callback.networkConnected = isConnected
if (callback.networkConnected) {
Thread { doNtpTime(callback) }.start()
} else {
callback.run()
}
}
fun doNtpTime(callback: Callback) {
aapsLogger.debug("Time detection started")
callback.success = requestTime("time.google.com", 5000)
callback.time = ntpTime + SystemClock.elapsedRealtime() - ntpTimeReference
aapsLogger.debug("Time detection ended: " + callback.success + " " + dateUtil.dateAndTimeString(ntpTime))
callback.run()
}
/**
* Sends an SNTP request to the given host and processes the response.
*
* @param host host name of the server.
* @param timeout network timeout in milliseconds.
* @return true if the transaction was successful.
*/
@Suppress("SameParameterValue")
@Synchronized private fun requestTime(host: String, timeout: Int): Boolean {
try {
val socket = DatagramSocket()
socket.soTimeout = timeout
val address = InetAddress.getByName(host)
val buffer = ByteArray(NTP_PACKET_SIZE)
val request = DatagramPacket(buffer, buffer.size, address, NTP_PORT)
// set mode = 3 (client) and version = 3
// mode is in low 3 bits of first byte
// version is in bits 3-5 of first byte
buffer[0] = (NTP_MODE_CLIENT or (NTP_VERSION shl 3)).toByte()
// get current time and write it to the request packet
val requestTime = System.currentTimeMillis()
val requestTicks = SystemClock.elapsedRealtime()
writeTimeStamp(buffer, TRANSMIT_TIME_OFFSET, requestTime)
socket.send(request)
// read the response
val response = DatagramPacket(buffer, buffer.size)
socket.receive(response)
val responseTicks = SystemClock.elapsedRealtime()
val responseTime = requestTime + (responseTicks - requestTicks)
socket.close()
// extract the results
val originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET)
val receiveTime = readTimeStamp(buffer, RECEIVE_TIME_OFFSET)
val transmitTime = readTimeStamp(buffer, TRANSMIT_TIME_OFFSET)
val roundTripTime = responseTicks - requestTicks - (transmitTime - receiveTime)
val clockOffset = (receiveTime - originateTime + (transmitTime - responseTime)) / 2
// save our results - use the times on this side of the network latency
// (response rather than request time)
ntpTime = responseTime + clockOffset
ntpTimeReference = responseTicks
this.roundTripTime = roundTripTime
} catch (e: Exception) {
aapsLogger.debug("request time failed: $e")
return false
}
return true
}
/**
* Reads an unsigned 32 bit big endian number from the given offset in the buffer.
*/
private fun read32(buffer: ByteArray, offset: Int): Long {
val b0 = buffer[offset]
val b1 = buffer[offset + 1]
val b2 = buffer[offset + 2]
val b3 = buffer[offset + 3]
// convert signed bytes to unsigned values
val i0 = if (b0.toInt() and 0x80 == 0x80) (b0.toInt() and 0x7F) + 0x80 else b0.toInt()
val i1 = if (b1.toInt() and 0x80 == 0x80) (b1.toInt() and 0x7F) + 0x80 else b1.toInt()
val i2 = if (b2.toInt() and 0x80 == 0x80) (b2.toInt() and 0x7F) + 0x80 else b2.toInt()
val i3 = if (b3.toInt() and 0x80 == 0x80) (b3.toInt() and 0x7F) + 0x80 else b3.toInt()
return (i0.toLong() shl 24) + (i1.toLong() shl 16) + (i2.toLong() shl 8) + i3.toLong()
}
/**
* Reads the NTP time stamp at the given offset in the buffer and returns
* it as a system time (milliseconds since January 1, 1970).
*/
private fun readTimeStamp(buffer: ByteArray, offset: Int): Long {
val seconds = read32(buffer, offset)
val fraction = read32(buffer, offset + 4)
return (seconds - OFFSET_1900_TO_1970) * 1000 + fraction * 1000L / 0x100000000L
}
/**
* Writes system time (milliseconds since January 1, 1970) as an NTP time stamp
* at the given offset in the buffer.
*/
@Suppress("SameParameterValue")
private fun writeTimeStamp(buffer: ByteArray, offsetParam: Int, time: Long) {
var offset = offsetParam
var seconds = time / 1000L
val milliseconds = time - seconds * 1000L
seconds += OFFSET_1900_TO_1970
// write seconds in big endian format
buffer[offset++] = (seconds shr 24).toByte()
buffer[offset++] = (seconds shr 16).toByte()
buffer[offset++] = (seconds shr 8).toByte()
buffer[offset++] = (seconds shr 0).toByte()
val fraction = milliseconds * 0x100000000L / 1000L
// write fraction in big endian format
buffer[offset++] = (fraction shr 24).toByte()
buffer[offset++] = (fraction shr 16).toByte()
buffer[offset++] = (fraction shr 8).toByte()
// low order bits should be random data
buffer[offset] = (Math.random() * 255.0).toInt().toByte()
}
}

View file

@ -1,21 +1,21 @@
package info.nightscout.androidaps.plugins.constraints.objectives.activities package info.nightscout.plugins.constraints.objectives.activities
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import dagger.android.support.DaggerDialogFragment import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.databinding.ObjectivesExamFragmentBinding import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.plugins.constraints.objectives.objectives.Objective.Option
import info.nightscout.plugins.databinding.ObjectivesExamFragmentBinding
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective.Option
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.rx.bus.RxBus
import javax.inject.Inject import javax.inject.Inject
class ObjectivesExamDialog : DaggerDialogFragment() { class ObjectivesExamDialog : DaggerDialogFragment() {
@ -96,8 +96,8 @@ class ObjectivesExamDialog : DaggerDialogFragment() {
context?.let { binding.examHints.addView(h.generate(it)) } context?.let { binding.examHints.addView(h.generate(it)) }
} }
// Disabled to // Disabled to
binding.examDisabledto.text = rh.gs(R.string.answerdisabledto, dateUtil.timeString(task.disabledTo)) binding.examDisabledTo.text = rh.gs(R.string.answerdisabledto, dateUtil.timeString(task.disabledTo))
binding.examDisabledto.visibility = if (task.isEnabledAnswer()) View.GONE else View.VISIBLE binding.examDisabledTo.visibility = if (task.isEnabledAnswer()) View.GONE else View.VISIBLE
// Buttons // Buttons
binding.examVerify.isEnabled = !task.answered && task.isEnabledAnswer() binding.examVerify.isEnabled = !task.answered && task.isEnabledAnswer()
binding.examVerify.setOnClickListener { binding.examVerify.setOnClickListener {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.constraints.objectives.dialogs package info.nightscout.plugins.constraints.objectives.dialogs
import android.os.Bundle import android.os.Bundle
import android.os.SystemClock import android.os.SystemClock

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.constraints.objectives.events package info.nightscout.plugins.constraints.objectives.events
import info.nightscout.rx.events.EventUpdateGui import info.nightscout.rx.events.EventUpdateGui

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import android.content.Context import android.content.Context
import android.text.util.Linkify import android.text.util.Linkify
@ -7,7 +7,7 @@ import android.widget.TextView
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.ValueWrapper import info.nightscout.database.impl.ValueWrapper
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.R
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin import info.nightscout.plugins.general.actions.ActionsPlugin
import javax.inject.Inject import javax.inject.Inject
class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(injector, "usage", R.string.objectives_usage_objective, R.string.objectives_usage_gate) { class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(injector, "usage", R.string.objectives_usage_objective, R.string.objectives_usage_gate) {

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) { class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) {

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) { class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) {
@ -113,7 +113,7 @@ class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.s
.option(Option(R.string.pumpdisconnect_openloop, false)) .option(Option(R.string.pumpdisconnect_openloop, false))
.hint(Hint(R.string.pumpdisconnect_hint1)) .hint(Hint(R.string.pumpdisconnect_hint1))
) )
tasks.add(ExamTask(this, R.string.insulin_label, R.string.insulin_ultrarapid, "insulin") tasks.add(ExamTask(this, R.string.insulin_plugins, R.string.insulin_ultrarapid, "insulin")
.option(Option(R.string.insulin_novorapid, false)) .option(Option(R.string.insulin_novorapid, false))
.option(Option(R.string.insulin_humalog, false)) .option(Option(R.string.insulin_humalog, false))
.option(Option(R.string.insulin_actrapid, false)) .option(Option(R.string.insulin_actrapid, false))

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.plugins.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate) class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate)

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,9 +1,8 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject
@ -11,7 +10,6 @@ import javax.inject.Inject
class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R.string.objectives_maxiob_objective, R.string.objectives_maxiob_gate) { class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R.string.objectives_maxiob_objective, R.string.objectives_maxiob_gate) {
@Inject lateinit var constraintChecker: Constraints @Inject lateinit var constraintChecker: Constraints
@Inject lateinit var safetyPlugin: SafetyPlugin
init { init {
tasks.add(MinimumDurationTask(this, T.days(1).msecs())) tasks.add(MinimumDurationTask(this, T.days(1).msecs()))

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) { class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) {

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) { class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) {

View file

@ -0,0 +1,2 @@
package info.nightscout.plugins.constraints.objectives.objectives

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.constraints.safety package info.nightscout.plugins.constraints.safety
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.extensions.putDouble import info.nightscout.androidaps.extensions.putDouble
import info.nightscout.androidaps.extensions.putInt import info.nightscout.androidaps.extensions.putInt
import info.nightscout.androidaps.extensions.putString import info.nightscout.androidaps.extensions.putString
@ -11,11 +10,7 @@ import info.nightscout.androidaps.extensions.storeString
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
@ -29,6 +24,7 @@ import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.interfaces.utils.Round import info.nightscout.interfaces.utils.Round
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
@ -47,10 +43,6 @@ class SafetyPlugin @Inject constructor(
private val sp: SP, private val sp: SP,
private val rxBus: RxBus, private val rxBus: RxBus,
private val constraintChecker: Constraints, private val constraintChecker: Constraints,
private val openAPSAMAPlugin: OpenAPSAMAPlugin,
private val openAPSSMBPlugin: OpenAPSSMBPlugin,
private val openAPSSMBDynamicISFPlugin: OpenAPSSMBDynamicISFPlugin,
private val sensitivityOref1Plugin: SensitivityOref1Plugin,
private val activePlugin: ActivePlugin, private val activePlugin: ActivePlugin,
private val hardLimits: HardLimits, private val hardLimits: HardLimits,
private val buildHelper: BuildHelper, private val buildHelper: BuildHelper,
@ -110,8 +102,6 @@ class SafetyPlugin @Inject constructor(
override fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> { override fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
val enabled = sp.getBoolean(R.string.key_use_uam, false) val enabled = sp.getBoolean(R.string.key_use_uam, false)
if (!enabled) value.set(aapsLogger, false, rh.gs(R.string.uamdisabledinpreferences), this) if (!enabled) value.set(aapsLogger, false, rh.gs(R.string.uamdisabledinpreferences), this)
val oref1Enabled = sensitivityOref1Plugin.isEnabled()
if (!oref1Enabled) value.set(aapsLogger, false, rh.gs(R.string.uamdisabledoref1notselected), this)
return value return value
} }
@ -203,12 +193,6 @@ class SafetyPlugin @Inject constructor(
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> { override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
val apsMode = sp.getString(R.string.key_aps_mode, "open") val apsMode = sp.getString(R.string.key_aps_mode, "open")
val maxIobPref: Double = if (openAPSSMBPlugin.isEnabled() || openAPSSMBDynamicISFPlugin.isEnabled()) sp.getDouble(R.string.key_openapssmb_max_iob, 3.0) else sp.getDouble(R.string
.key_openapsma_max_iob, 1.5)
maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limitingiob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this)
if (openAPSAMAPlugin.isEnabled()) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), rh.gs(R.string.limitingiob, hardLimits.maxIobAMA(), rh.gs(R.string.hardlimit)), this)
if (openAPSSMBPlugin.isEnabled()) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), rh.gs(R.string.limitingiob, hardLimits.maxIobSMB(), rh.gs(R.string.hardlimit)), this)
if (openAPSSMBDynamicISFPlugin.isEnabled()) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), rh.gs(R.string.limitingiob, hardLimits.maxIobSMB(), rh.gs(R.string.hardlimit)), this)
if (apsMode == "lgs") maxIob.setIfSmaller(aapsLogger, HardLimits.MAX_IOB_LGS, rh.gs(R.string.limitingiob, HardLimits.MAX_IOB_LGS, rh.gs(R.string.lowglucosesuspend)), this) if (apsMode == "lgs") maxIob.setIfSmaller(aapsLogger, HardLimits.MAX_IOB_LGS, rh.gs(R.string.limitingiob, HardLimits.MAX_IOB_LGS, rh.gs(R.string.lowglucosesuspend)), this)
return maxIob return maxIob
} }

View file

@ -0,0 +1,33 @@
package info.nightscout.plugins.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.objectives.objectives.Objective0
import info.nightscout.plugins.constraints.objectives.objectives.Objective1
import info.nightscout.plugins.constraints.objectives.objectives.Objective10
import info.nightscout.plugins.constraints.objectives.objectives.Objective2
import info.nightscout.plugins.constraints.objectives.objectives.Objective3
import info.nightscout.plugins.constraints.objectives.objectives.Objective4
import info.nightscout.plugins.constraints.objectives.objectives.Objective5
import info.nightscout.plugins.constraints.objectives.objectives.Objective6
import info.nightscout.plugins.constraints.objectives.objectives.Objective7
import info.nightscout.plugins.constraints.objectives.objectives.Objective9
@Module
@Suppress("unused")
abstract class ObjectivesModule {
@ContributesAndroidInjector abstract fun objectiveInjector(): Objective
@ContributesAndroidInjector abstract fun objective0Injector(): Objective0
@ContributesAndroidInjector abstract fun objective1Injector(): Objective1
@ContributesAndroidInjector abstract fun objective2Injector(): Objective2
@ContributesAndroidInjector abstract fun objective3Injector(): Objective3
@ContributesAndroidInjector abstract fun objective4Injector(): Objective4
@ContributesAndroidInjector abstract fun objective5Injector(): Objective5
@ContributesAndroidInjector abstract fun objective6Injector(): Objective6
@ContributesAndroidInjector abstract fun objective7Injector(): Objective7
@ContributesAndroidInjector abstract fun objective9Injector(): Objective9
@ContributesAndroidInjector abstract fun objective10Injector(): Objective10
}

View file

@ -11,7 +11,9 @@ import dagger.Module
ProfileModule::class, ProfileModule::class,
SyncModule::class, SyncModule::class,
SourceModule::class, SourceModule::class,
VirtualPumpModule::class VirtualPumpModule::class,
ObjectivesModule::class,
SkinsModule::class
] ]
) )

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.di package info.nightscout.plugins.di
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import dagger.multibindings.IntKey import dagger.multibindings.IntKey
import dagger.multibindings.IntoMap import dagger.multibindings.IntoMap
import info.nightscout.androidaps.skins.SkinButtonsOn import info.nightscout.plugins.skins.SkinButtonsOn
import info.nightscout.androidaps.skins.SkinClassic import info.nightscout.plugins.skins.SkinClassic
import info.nightscout.androidaps.skins.SkinInterface import info.nightscout.plugins.skins.SkinInterface
import info.nightscout.androidaps.skins.SkinLargeDisplay import info.nightscout.plugins.skins.SkinLargeDisplay
import info.nightscout.androidaps.skins.SkinLowRes import info.nightscout.plugins.skins.SkinLowRes
import javax.inject.Qualifier import javax.inject.Qualifier
@Module @Module

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.actions package info.nightscout.plugins.general.actions
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
@ -10,12 +10,6 @@ import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
import info.nightscout.ui.dialogs.ProfileSwitchDialog
import info.nightscout.ui.dialogs.TempBasalDialog
import info.nightscout.ui.dialogs.TempTargetDialog
import info.nightscout.androidaps.extensions.toStringMedium import info.nightscout.androidaps.extensions.toStringMedium
import info.nightscout.androidaps.extensions.toStringShort import info.nightscout.androidaps.extensions.toStringShort
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
@ -24,8 +18,6 @@ import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.ui.SingleClickButton import info.nightscout.androidaps.utils.ui.SingleClickButton
@ -40,6 +32,10 @@ import info.nightscout.interfaces.Config
import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomAction
import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Callback
import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.ActionsFragmentBinding
import info.nightscout.plugins.skins.SkinProvider
import info.nightscout.plugins.ui.StatusLightHandler
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventCustomActionsChanged import info.nightscout.rx.events.EventCustomActionsChanged
@ -52,10 +48,6 @@ import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import info.nightscout.ui.activities.TDDStatsActivity
import info.nightscout.ui.dialogs.CareDialog
import info.nightscout.ui.dialogs.ExtendedBolusDialog
import info.nightscout.ui.dialogs.FillDialog
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject import javax.inject.Inject
@ -91,6 +83,7 @@ class ActionsFragment : DaggerFragment() {
private lateinit var dm: DisplayMetrics private lateinit var dm: DisplayMetrics
private var _binding: ActionsFragmentBinding? = null private var _binding: ActionsFragmentBinding? = null
// This property is only valid between onCreateView and onDestroyView. // This property is only valid between onCreateView and onDestroyView.
private val binding get() = _binding!! private val binding get() = _binding!!
@ -105,7 +98,7 @@ class ActionsFragment : DaggerFragment() {
activity?.windowManager?.defaultDisplay?.getMetrics(dm) activity?.windowManager?.defaultDisplay?.getMetrics(dm)
} }
_binding = ActionsFragmentBinding.inflate(inflater, container, false) _binding = ActionsFragmentBinding.inflate(inflater, container, false)
return binding.root return binding.root
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -118,7 +111,7 @@ class ActionsFragment : DaggerFragment() {
protectionCheck.queryProtection( protectionCheck.queryProtection(
activity, activity,
ProtectionCheck.Protection.BOLUS, ProtectionCheck.Protection.BOLUS,
UIRunnable { ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog")}) UIRunnable { activityNames.runProfileSwitchDialog(childFragmentManager) })
} }
} }
binding.tempTarget.setOnClickListener { binding.tempTarget.setOnClickListener {
@ -126,7 +119,7 @@ class ActionsFragment : DaggerFragment() {
protectionCheck.queryProtection( protectionCheck.queryProtection(
activity, activity,
ProtectionCheck.Protection.BOLUS, ProtectionCheck.Protection.BOLUS,
UIRunnable { TempTargetDialog().show(childFragmentManager, "Actions") }) UIRunnable { activityNames.runTempTargetDialog(childFragmentManager) })
} }
} }
binding.extendedBolus.setOnClickListener { binding.extendedBolus.setOnClickListener {
@ -135,7 +128,7 @@ class ActionsFragment : DaggerFragment() {
OKDialog.showConfirmation( OKDialog.showConfirmation(
activity, rh.gs(R.string.extended_bolus), rh.gs(R.string.ebstopsloop), activity, rh.gs(R.string.extended_bolus), rh.gs(R.string.ebstopsloop),
Runnable { Runnable {
ExtendedBolusDialog().show(childFragmentManager, "Actions") activityNames.runExtendedBolusDialog(childFragmentManager)
}, null }, null
) )
}) })
@ -158,7 +151,7 @@ class ActionsFragment : DaggerFragment() {
protectionCheck.queryProtection( protectionCheck.queryProtection(
activity, activity,
ProtectionCheck.Protection.BOLUS, ProtectionCheck.Protection.BOLUS,
UIRunnable { TempBasalDialog().show(childFragmentManager, "Actions") }) UIRunnable { activityNames.runTempBasalDialog(childFragmentManager) })
} }
} }
binding.cancelTempBasal.setOnClickListener { binding.cancelTempBasal.setOnClickListener {
@ -175,31 +168,31 @@ class ActionsFragment : DaggerFragment() {
} }
binding.fill.setOnClickListener { binding.fill.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { FillDialog().show(childFragmentManager, "FillDialog") }) protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { activityNames.runFillDialog(childFragmentManager) })
} }
} }
binding.historyBrowser.setOnClickListener { startActivity(Intent(context, HistoryBrowseActivity::class.java)) } binding.historyBrowser.setOnClickListener { startActivity(Intent(context, activityNames.historyBrowseActivity::class.java)) }
binding.tddStats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) } binding.tddStats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity::class.java)) }
binding.bgCheck.setOnClickListener { binding.bgCheck.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.BGCHECK, R.string.careportal_bgcheck).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.BGCHECK, R.string.careportal_bgcheck)
} }
binding.cgmSensorInsert.setOnClickListener { binding.cgmSensorInsert.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.SENSOR_INSERT, R.string.careportal_cgmsensorinsert).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.SENSOR_INSERT, R.string.cgm_sensor_insert)
} }
binding.pumpBatteryChange.setOnClickListener { binding.pumpBatteryChange.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.BATTERY_CHANGE, R.string.careportal_pumpbatterychange).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.BATTERY_CHANGE, R.string.pump_battery_change)
} }
binding.note.setOnClickListener { binding.note.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.NOTE, R.string.careportal_note).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.NOTE, R.string.careportal_note)
} }
binding.exercise.setOnClickListener { binding.exercise.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.EXERCISE, R.string.careportal_exercise).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.EXERCISE, R.string.careportal_exercise)
} }
binding.question.setOnClickListener { binding.question.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.QUESTION, R.string.careportal_question).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.QUESTION, R.string.careportal_question)
} }
binding.announcement.setOnClickListener { binding.announcement.setOnClickListener {
CareDialog().setOptions(CareDialog.EventType.ANNOUNCEMENT, R.string.careportal_announcement).show(childFragmentManager, "Actions") activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.ANNOUNCEMENT, R.string.careportal_announcement)
} }
sp.putBoolean(R.string.key_objectiveuseactions, true) sp.putBoolean(R.string.key_objectiveuseactions, true)
@ -301,7 +294,7 @@ class ActionsFragment : DaggerFragment() {
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel) statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel)
sensorLevelLabel.text = if (activeBgSource.sensorBatteryLevel == -1) "" else rh.gs(R.string.careportal_level_label) sensorLevelLabel.text = if (activeBgSource.sensorBatteryLevel == -1) "" else rh.gs(R.string.level_label)
} else { } else {
statusLightHandler.updateStatusLights(cannulaAge, insulinAge, null, sensorAge, null, pbAge, null) statusLightHandler.updateStatusLights(cannulaAge, insulinAge, null, sensorAge, null, pbAge, null)
sensorLevelLabel.text = "" sensorLevelLabel.text = ""

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.general.actions package info.nightscout.plugins.general.actions
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject import javax.inject.Inject
@ -19,13 +19,13 @@ class ActionsPlugin @Inject constructor(
config: Config config: Config
) : PluginBase( ) : PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.GENERAL) .mainType(PluginType.GENERAL)
.fragmentClass(ActionsFragment::class.qualifiedName) .fragmentClass(ActionsFragment::class.qualifiedName)
.enableByDefault(config.APS || config.PUMPCONTROL) .enableByDefault(config.APS || config.PUMPCONTROL)
.visibleByDefault(config.APS || config.PUMPCONTROL) .visibleByDefault(config.APS || config.PUMPCONTROL)
.pluginIcon(R.drawable.ic_action) .pluginIcon(R.drawable.ic_action)
.pluginName(R.string.actions) .pluginName(R.string.actions)
.shortName(R.string.actions_shortname) .shortName(R.string.actions_shortname)
.description(R.string.description_actions), .description(R.string.description_actions),
aapsLogger, rh, injector aapsLogger, rh, injector
) )

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import android.util.DisplayMetrics import android.util.DisplayMetrics
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.androidaps.databinding.OverviewFragmentBinding import info.nightscout.plugins.databinding.OverviewFragmentBinding
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class SkinClassic @Inject constructor(private val config: Config): SkinInterface { class SkinClassic @Inject constructor(private val config: Config) : SkinInterface {
override val description: Int get() = R.string.classic_description override val description: Int get() = R.string.classic_description
override val mainGraphHeight: Int get() = 200 override val mainGraphHeight: Int get() = 200

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.TypedValue.COMPLEX_UNIT_PX import android.util.TypedValue.COMPLEX_UNIT_PX
@ -6,9 +6,9 @@ import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.androidaps.databinding.ActionsFragmentBinding import info.nightscout.plugins.databinding.ActionsFragmentBinding
import info.nightscout.androidaps.databinding.OverviewFragmentBinding import info.nightscout.plugins.databinding.OverviewFragmentBinding
interface SkinInterface { interface SkinInterface {

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import android.util.DisplayMetrics import android.util.DisplayMetrics
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.OverviewFragmentBinding
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class SkinLargeDisplay @Inject constructor(private val config: Config): SkinInterface { class SkinLargeDisplay @Inject constructor(private val config: Config) : SkinInterface {
override val description: Int get() = R.string.largedisplay_description override val description: Int get() = R.string.largedisplay_description
override val mainGraphHeight: Int get() = 400 override val mainGraphHeight: Int get() = 400

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.View.GONE import android.view.View.GONE
import android.view.ViewGroup import android.view.ViewGroup
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.androidaps.databinding.ActionsFragmentBinding import info.nightscout.plugins.databinding.ActionsFragmentBinding
import info.nightscout.androidaps.databinding.OverviewFragmentBinding import info.nightscout.plugins.databinding.OverviewFragmentBinding
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -44,7 +44,7 @@ class SkinLowRes @Inject constructor(private val config: Config) : SkinInterface
infoCard.elevation = 0F infoCard.elevation = 0F
infoCard.radius = 0F infoCard.radius = 0F
val paramInfo = (infoCard.layoutParams as ViewGroup.MarginLayoutParams).apply { val paramInfo = (infoCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
setMargins(0,0,0,0) setMargins(0, 0, 0, 0)
} }
infoCard.layoutParams = paramInfo infoCard.layoutParams = paramInfo
@ -52,21 +52,21 @@ class SkinLowRes @Inject constructor(private val config: Config) : SkinInterface
statusCard.radius = 0F statusCard.radius = 0F
statusCard.strokeWidth = 1 statusCard.strokeWidth = 1
val paramStatus = (statusCard.layoutParams as ViewGroup.MarginLayoutParams).apply { val paramStatus = (statusCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
setMargins(0,0,0,0) setMargins(0, 0, 0, 0)
} }
statusCard.layoutParams = paramStatus statusCard.layoutParams = paramStatus
nsclientCard.elevation = 0F nsclientCard.elevation = 0F
nsclientCard.radius = 0F nsclientCard.radius = 0F
val paramNsClient = (nsclientCard.layoutParams as ViewGroup.MarginLayoutParams).apply { val paramNsClient = (nsclientCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
setMargins(0,0,0,0) setMargins(0, 0, 0, 0)
} }
nsclientCard.layoutParams = paramNsClient nsclientCard.layoutParams = paramNsClient
graphCard.elevation = 0F graphCard.elevation = 0F
graphCard.radius = 0F graphCard.radius = 0F
val paramGraph = (graphCard.layoutParams as ViewGroup.MarginLayoutParams).apply { val paramGraph = (graphCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
setMargins(0,0,0,0) setMargins(0, 0, 0, 0)
} }
graphCard.layoutParams = paramGraph graphCard.layoutParams = paramGraph

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.skins package info.nightscout.plugins.skins
import info.nightscout.androidaps.R import info.nightscout.plugins.R
import info.nightscout.androidaps.di.SkinsModule import info.nightscout.plugins.di.SkinsModule
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import okhttp3.internal.toImmutableMap import okhttp3.internal.toImmutableMap
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,17 +1,16 @@
package info.nightscout.androidaps.plugins.general.overview package info.nightscout.plugins.ui
import android.widget.TextView import android.widget.TextView
import androidx.annotation.StringRes import androidx.annotation.StringRes
import info.nightscout.androidaps.R
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.ValueWrapper
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.plugins.R
import info.nightscout.plugins.sync.nsclient.extensions.age import info.nightscout.plugins.sync.nsclient.extensions.age
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
@ -77,7 +76,7 @@ class StatusLightHandler @Inject constructor(
// The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do. // The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
// Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a" // Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
// Pump instance check is needed because at startup, the pump can still be VirtualPumpPlugin and that will cause a crash // Pump instance check is needed because at startup, the pump can still be VirtualPumpPlugin and that will cause a crash
val erosBatteryLinkAvailable = pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel val erosBatteryLinkAvailable = pump.model() == PumpType.OMNIPOD_EROS && pump.isUseRileyLinkBatteryLevel()
if (pump.model().supportBatteryLevel || erosBatteryLinkAvailable) { if (pump.model().supportBatteryLevel || erosBatteryLinkAvailable) {
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%") handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
@ -122,4 +121,4 @@ class StatusLightHandler @Inject constructor(
handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units) handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units)
} }
} }
} }

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".plugins.general.actions.ActionsFragment"> tools:context=".general.actions.ActionsFragment">
<LinearLayout <LinearLayout
android:id="@+id/buttons_layout" android:id="@+id/buttons_layout"
@ -64,7 +64,7 @@
android:drawableTop="@drawable/ic_temptarget_high" android:drawableTop="@drawable/ic_temptarget_high"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_temporarytarget" android:text="@string/temporary_target"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="1" app:layout_column="1"
app:layout_columnWeight="1" app:layout_columnWeight="1"
@ -76,10 +76,10 @@
style="@style/GrayButton" style="@style/GrayButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_starttempbasal" android:drawableTop="@drawable/ic_actions_start_temp_basal"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/overview_tempbasal_button" android:text="@string/tempbasal_button"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="0" app:layout_column="0"
app:layout_columnWeight="1" app:layout_columnWeight="1"
@ -91,10 +91,10 @@
style="@style/GrayButton" style="@style/GrayButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cancelbasal" android:drawableTop="@drawable/ic_cancel_basal"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/canceltemp" android:text="@string/cancel_temp"
android:textSize="11sp" android:textSize="11sp"
android:visibility="gone" android:visibility="gone"
app:layout_column="0" app:layout_column="0"
@ -110,7 +110,7 @@
android:drawableTop="@drawable/ic_actions_start_extended_bolus" android:drawableTop="@drawable/ic_actions_start_extended_bolus"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/overview_extendedbolus_button" android:text="@string/extended_bolus_button"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="1" app:layout_column="1"
app:layout_columnWeight="1" app:layout_columnWeight="1"
@ -122,10 +122,10 @@
style="@style/GrayButton" style="@style/GrayButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_cancelextbolus" android:drawableTop="@drawable/ic_actions_cancel_extended_bolus"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/overview_extendedbolus_cancel_button" android:text="@string/extended_bolus_cancel_button"
android:textSize="11sp" android:textSize="11sp"
android:visibility="gone" android:visibility="gone"
app:layout_column="1" app:layout_column="1"
@ -153,7 +153,7 @@
<include <include
android:id="@+id/status" android:id="@+id/status"
layout="@layout/careportal_stats_fragment" layout="@layout/actions_stats_fragment"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" /> android:layout_marginTop="10dp" />
@ -161,7 +161,7 @@
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/careportal_statuslightbutton" android:id="@+id/careportal_statuslight_button"
style="@style/Widget.MaterialComponents.CardView" style="@style/Widget.MaterialComponents.CardView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -226,7 +226,7 @@
android:drawableTop="@drawable/ic_cp_cgm_insert" android:drawableTop="@drawable/ic_cp_cgm_insert"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_cgmsensorinsert" android:text="@string/cgm_sensor_insert"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="0" app:layout_column="0"
app:layout_columnWeight="1" app:layout_columnWeight="1"
@ -241,7 +241,7 @@
android:drawableTop="@drawable/ic_cp_pump_battery" android:drawableTop="@drawable/ic_cp_pump_battery"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_pumpbatterychange" android:text="@string/pump_battery_change"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="1" app:layout_column="1"
app:layout_columnWeight="1" app:layout_columnWeight="1"
@ -349,7 +349,7 @@
android:drawableTop="@drawable/ic_pump_history" android:drawableTop="@drawable/ic_pump_history"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/nav_historybrowser" android:text="@string/nav_history_browser"
android:textSize="11sp" android:textSize="11sp"
app:layout_column="0" app:layout_column="0"
app:layout_columnWeight="1" app:layout_columnWeight="1"

View file

@ -4,7 +4,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:stretchColumns="0,2,4" android:stretchColumns="0,2,4"
tools:context=".plugins.general.actions.ActionsFragment"> tools:context="info.nightscout.plugins.general.actions.ActionsFragment">
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -17,7 +17,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text="@string/careportal_sensor_label" android:text="@string/sensor_label"
android:textSize="14sp" android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_sensor" /> app:drawableStartCompat="@drawable/ic_cp_age_sensor" />
@ -28,7 +28,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_age_label" android:text="@string/age_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -47,7 +47,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_level_label" android:text="@string/level_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -89,7 +89,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text="@string/careportal_insulin_label" android:text="@string/insulin_label"
android:textSize="14sp" android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_insulin" /> app:drawableStartCompat="@drawable/ic_cp_age_insulin" />
@ -100,7 +100,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_age_label" android:text="@string/age_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -119,7 +119,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_level_label" android:text="@string/level_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -173,7 +173,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_age_label" android:text="@string/age_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -235,7 +235,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text="@string/careportal_pb_label" android:text="@string/pb_label"
android:textSize="14sp" android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_battery" /> app:drawableStartCompat="@drawable/ic_cp_age_battery" />
@ -246,7 +246,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_age_label" android:text="@string/age_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -265,7 +265,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:text="@string/careportal_level_label" android:text="@string/level_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".plugins.constraints.objectives.activities.ObjectivesExamDialog"> tools:context="constraints.objectives.activities.ObjectivesExamDialog">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -40,7 +40,7 @@
android:background="?attr/objectivesBackgroundColor" android:background="?attr/objectivesBackgroundColor"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="4dp" android:padding="4dp"
app:layout_constraintTop_toBottomOf="@+id/exam_disabledto"> app:layout_constraintTop_toBottomOf="@+id/exam_disabled_to">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/exam_reset" android:id="@+id/exam_reset"
@ -101,7 +101,7 @@
tools:text="Name" /> tools:text="Name" />
<TextView <TextView
android:id="@+id/exam_disabledto" android:id="@+id/exam_disabled_to"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -127,7 +127,7 @@
style="@style/OkCancelButton.Text" style="@style/OkCancelButton.Text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/previous_button" /> android:text="@string/objectives_previous_button" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
@ -140,7 +140,7 @@
style="@style/OkCancelButton.Text" style="@style/OkCancelButton.Text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/next_button" /> android:text="@string/objectives_next_button" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/next_unanswered_button" android:id="@+id/next_unanswered_button"

View file

@ -3,7 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".plugins.constraints.objectives.ObjectivesFragment"> tools:context=".constraints.objectives.ObjectivesFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -5,7 +5,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
tools:context=".plugins.general.overview.OverviewFragment"> tools:context="info.nightscout.androidaps.plugins.general.overview.OverviewFragment">
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/top_part_scrollbar" android:id="@+id/top_part_scrollbar"

View file

@ -82,7 +82,7 @@
<ImageView <ImageView
android:layout_width="28dp" android:layout_width="28dp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:contentDescription="@string/careportal_sensor_label" android:contentDescription="@string/sensor_label"
android:scaleX="1.6" android:scaleX="1.6"
android:scaleY="1.6" android:scaleY="1.6"
app:srcCompat="@drawable/ic_cp_age_sensor" /> app:srcCompat="@drawable/ic_cp_age_sensor" />

View file

@ -44,4 +44,19 @@
<item>YpsoPump</item> <item>YpsoPump</item>
</string-array> </string-array>
<string-array name="ageArray">
<item>@string/child</item>
<item>@string/teenage</item>
<item>@string/adult</item>
<item>@string/resistantadult</item>
<item>@string/pregnant</item>
</string-array>
<string-array name="ageValues" translatable="false">
<item>@string/key_child</item>
<item>@string/key_teenage</item>
<item>@string/key_adult</item>
<item>@string/key_resistantadult</item>
<item>@string/key_pregnant</item>
</string-array>
</resources> </resources>

View file

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dia_whatmeansdia">What is true about DIA?</string>
<string name="dia_label_exam">Duration of Insulin Action (DIA)</string>
<string name="dia_profile">You should set the value for DIA in your profile.</string>
<string name="dia_minimumis5h">The minimum allowed value is 5 hours.</string>
<string name="dia_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html?#insulin</string>
<string name="dia_meaningisequaltodiapump">If you are satisfied that the value for DIA that you used in your pump prior to AAPS worked well, there is no need to change this when you start looping.</string>
<string name="dia_valuemustbedetermined">You should determine for yourself the appropriate value for DIA.</string>
<string name="hypott_label">Hypo Temp-Target</string>
<string name="hypott_whenhypott">What is primary reason to set a hypo temp target?</string>
<string name="hypott_wrongbasal">To correct for hypos caused by incorrect basal rate settings.</string>
<string name="hypott_preventoversmb">To prevent AAPS from overcorrecting for a blood glucose rise caused by the fast acting carbs used to treat a hypo.</string>
<string name="hypott_exercise">To correct for a hypo induced as a result of exercise.</string>
<string name="hypott_0basal">To prevent blood glucose from going low if there is already a 0% temporary basal rate running.</string>
<string name="hypott_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html</string>
<string name="offlineprofile_whatprofile">Which profile can be used and configured offline?</string>
<string name="offlineprofile_label">Topic: Offline Profile</string>
<string name="offlineprofile_nsprofile">NS Profile can be used, but not configured.</string>
<string name="offlineprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#profile</string>
<string name="pumpdisconnect_label">Reasons for applying "Disconnect pump" in AAPS</string>
<string name="pumpdisconnect_whattodo">What should be done when disconnecting the pump?</string>
<string name="pumpdisconnect_unnecessary">This is unnecessary as insulin will not be delivered if the pump is physically disconnected.</string>
<string name="pumpdisconnect_missinginsulin">It prevents AAPS from accounting for insulin that was not delivered whilst the pump is physically disconnected. </string>
<string name="pumpdisconnect_notstop">It will not stop insulin delivery if the pump remains connected.</string>
<string name="pumpdisconnect_openloop">It will send AAPS into open loop mode.</string>
<string name="pumpdisconnect_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#other-settings</string>
<string name="objectives_label">AAPS Settings</string>
<string name="objectives2_label">AAPS Settings</string>
<string name="objectives_howtosave">What are the best practices for backing up your settings?</string>
<string name="objectives_notesettings">You do not need to export your settings provided that you make a note of them.</string>
<string name="objectives_afterobjective">Export your settings after you finish completing an objective.</string>
<string name="objectives_afterchange">Export your settings after changing any of your settings.</string>
<string name="objectives_afterinitialsetup">Export your settings after you finish your initial set-up and have set your Preferences.</string>
<string name="objectives2_maintenance">Export your settings locally using the maintenance menu.</string>
<string name="objectives2_internalstorage">Your settings file is found in the folder Internal Storage/AAPS/preferences on your phone.</string>
<string name="objectives2_cloud">Copy your preferences file to a safe location outside of your phone (e.g. by using a cloud drive, connecting a cable to a computer, email, etc.)</string>
<string name="objectives2_easyrestore">If your phone is damaged or lost, there are easy ways to remotely recover your settings without a backup.</string>
<string name="objectives_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/ExportImportSettings.html</string>
<string name="objectives_hint2">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
<string name="noisycgm_label">Noisy CGM Readings</string>
<string name="noisycgm_whattodo">What should be done if CGM data is noisy?</string>
<string name="noisycgm_nothing">Do nothing - AAPS will deal with it.</string>
<string name="noisycgm_pause">Disable the closed loop to avoid possible over or underdosing.</string>
<string name="noisycgm_replacesensor">Replace consistently noisy or inaccurate sensors.</string>
<string name="noisycgm_checksmoothing">Verify that your CGM app provides smoothed data.</string>
<string name="noisycgm_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
<string name="exerciseprofile_label">Exercise and Profiles</string>
<string name="exerciseprofile_whattodo">How can you use profiles to best help the system deal with aerobic exercise?</string>
<string name="exerciseprofile_switchprofilebelow100">Do a profile switch to less than 100%.</string>
<string name="exerciseprofile_switchprofileabove100">Do a profile switch to more than 100%.</string>
<string name="exerciseprofile_leaveat100">Leave the profile set to 100%.</string>
<string name="exerciseprofile_suspendloop">Suspend the loop.</string>
<string name="exerciseprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="exercise_label">Exercise and Temporary Targets</string>
<string name="exercise_whattodo">How can you use temporary targets to best help the system deal with aerobic exercise?</string>
<string name="exercise_settt">Set an activity blood glucose target starting a suitable time before beginning exercise.</string>
<string name="exercise_setfinished">Set an activity blood glucose target after finishing exercise.</string>
<string name="exercise_setunchanged">Leave your blood glucose target unchanged.</string>
<string name="exercise_15g">Wait until blood glucose drops below your hypo temp target and then eat 15 g of fast acting carbohydrates.</string>
<string name="exercise_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="suspendloop_label">Disabled/Suspended loop</string>
<string name="suspendloop_doigetinsulin">Do I receive insulin when the loop is disabled/suspended?</string>
<string name="suspendloop_yes">Yes, basal insulin continues to be delivered.</string>
<string name="suspendloop_no">No, delivery of insulin is stopped.</string>
<string name="basaltest_label">Basal, ISF, and I:C Testing</string>
<string name="basaltest_when">When should these values be validated?</string>
<string name="basaltest_beforeloop">Before starting looping.</string>
<string name="basaltest_havingregularhighlow">When experiencing frequent high or low blood glucose.</string>
<string name="basaltest_weekly">At least once per week.</string>
<string name="basaltest_fixed">Once set and validated, these values should not change over time.</string>
<string name="basaltest_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#androidaps-settings</string>
<string name="prerequisites_label">Prerequisites</string>
<string name="prerequisites_what">What is essential to set up and use AAPS?</string>
<string name="prerequisites_determinedcorrectprofile">Validated profile information (Basal, IC, ISF, DIA).</string>
<string name="prerequisites_computer">A computer with Android Studio installed and configured.</string>
<string name="prerequisites_phone">A supported phone.</string>
<string name="prerequisites_pump">A compatible insulin pump if you are planning to run a closed loop.</string>
<string name="prerequisites_nightscout">Nightscout, to keep a log of all data and review settings.</string>
<string name="prerequisites_tidepoolaccount">A Tidepool account.</string>
<string name="prerequisites_googleaccount">A Google account.</string>
<string name="prerequisites_githubaccount">A Github account.</string>
<string name="prerequisites_beanandroiddeveloper">Experience in programming or editing code.</string>
<string name="prerequisites_own670g">A MiniMed 670G pump.</string>
<string name="prerequisites_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="prerequisites_smartwatch">A Smartwatch.</string>
<string name="prerequisites_supportedcgm">A Supported CGM.</string>
<string name="prerequisites2_label">Prerequisites</string>
<string name="prerequisites2_what">What is essential to set up and use AAPS?</string>
<string name="prerequisites2_profile">Validated information to set up a profile (ISF, I:C ratio, basal rates, DIA etc.).</string>
<string name="prerequisites2_device">A compatible Android device (e.g. mobile/cell phone, full Android watch, or tablet).</string>
<string name="prerequisites2_internet">AAPS requires an internet connection in order to run in closed loop.</string>
<string name="prerequisites2_supportedcgm">A supported CGM and appropriate app to receive blood glucose values on the phone/device.</string>
<string name="prerequisites2_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="update_label">Updating AAPS</string>
<string name="whatistrue">Check all correct answers.</string>
<string name="update_git">You need to have Git installed and configured on your computer.</string>
<string name="update_asap">When updated versions of AAPS are released, the earlier versions may be remotely limited after a specified time.</string>
<string name="update_keys">You should save and note the location of your keystore and use the same signing key for updates as for your previous installation.</string>
<string name="update_neverupdate">Never update if the system is working well.</string>
<string name="update_askfriend">If you have difficulty building the apk, you can install an apk that has been built by a friend.</string>
<string name="update_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
<string name="troubleshooting_label">Troubleshooting</string>
<string name="troubleshooting_wheretoask">Where can you look for help with AAPS?</string>
<string name="troubleshooting_fb">You can ask for advice in the AAPS Users Facebook group.</string>
<string name="troubleshooting_wiki">You should read (and re-read) the AAPS documentation.</string>
<string name="troubleshooting_gitter">You can ask for advice and log technical problems or issues in the AAPS Discord.</string>
<string name="troubleshooting_yourendo">You should ask your diabetes clinic/endocrinologist.</string>
<string name="troubleshooting_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#troubleshooting</string>
<string name="troubleshooting_hint2">https://www.facebook.com/groups/AndroidAPSUsers/</string>
<string name="troubleshooting_hint3">https://discord.gg/4fQUWHZ4Mw</string>
<string name="insulin_plugins">Insulin Plugins</string>
<string name="insulin_ultrarapid">Which insulin should you use with the Ultra-Rapid Oref plugin?</string>
<string name="insulin_fiasp">Fiasp®</string>
<string name="insulin_novorapid">NovoRapid®/Novolog®</string>
<string name="insulin_humalog">Humalog®</string>
<string name="insulin_actrapid">Actrapid®/Humalin R®/"regular" human insulin.</string>
<string name="insulin_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#insulin</string>
<string name="sensitivity_label">Sensitivity Plugins</string>
<string name="sensitivity_which">Check all correct answers.</string>
<string name="sensitivity_adjust">Sensitivity plugins allow AAPS to adjust for temporary or short-lived changes in insulin sensitivity (for example hormonal changes or issues with absorption at the infusion site).</string>
<string name="sensitivity_edit">Sensitivity plugins provide the user with suggested changes to basal rates, I:C ratios and ISF that can be used to edit profile.</string>
<string name="sensitivity_cannula">Logging a cannula change will reset Autosens ratio back to 100%.</string>
<string name="sensitivity_time">Some of the plugin options have configurable time ranges that can be set by the user.</string>
<string name="sensitivity_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="sensitivity_hint2">https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens</string>
<string name="wrongcarbs_label">Carb Entry Errors</string>
<string name="wrongcarbs_whattodo">What should you do if youve made an incorrect carb entry?</string>
<string name="wrongcarbs_treatmentstab">Delete the incorrect entry in Treatments and enter the correct new carb value.</string>
<string name="wrongcarbs_addinsulin">Bolus with insulin using the infusion set prime menu.</string>
<string name="wrongcarbs_donothing">Do nothing AAPS will make the appropriate adjustments.</string>
<string name="wrongcarbs_bolus">Bolus with insulin using the Insulin (bolus) button in Overview.</string>
<string name="wronginsulin_label">Insulin delivery/entry errors</string>
<string name="wronginsulin_whattodo">What should you do if you received less insulin than the pump history suggests e.g. due to an occlusion, a failed cannula or forgetting to reattach the pump after a shower? </string>
<string name="wronginsulin_careportal">Delete insulin data from Nightscout Careportal to remove it from the pump history.</string>
<string name="wronginsulin_compare">Compare values in AAPS and pump history (if pump supports this).</string>
<string name="wronginsulin_prime">Bolus a proportion of your calculated missed insulin by either syringe/pen or using a prime.</string>
<string name="wronginsulin_donothing">Do nothing and allow AAPS to correct any resulting high blood glucose level.</string>
<string name="cob_label">Carbs on Board (COB)</string>
<string name="cob_question">How changing ISF value affects COB calculation?</string>
<string name="cob_longer">Increasing ISF will take absorbing carbs a longer time</string>
<string name="cob_shorter">Increasing ISF will take absorbing carbs a shorter time</string>
<string name="cob_no_effect">Increasing ISF will not affect calculated carbs absorption</string>
<string name="cob2_question">How changing IC value affects COB calculation?</string>
<string name="cob2_longer">Increasing IC will take absorbing carbs a longer time</string>
<string name="cob2_shorter">Increasing IC will take absorbing carbs a shorter time</string>
<string name="cob2_no_effect">Increasing IC will not affect calculated carbs absorption</string>
<string name="cob3_question">How changing profile percentage affects COB calculation?</string>
<string name="cob3_longer">Setting profile to 150% will take absorbing carbs a longer time</string>
<string name="cob3_shorter">Setting profile to 150% will take absorbing carbs a shorter time</string>
<string name="cob3_no_effect">Setting profile to 150% will not affect calculated carbs absorption</string>
<string name="iob_label">Insulin on Board (IOB)</string>
<string name="iob_value">IOB value is affected by issued temporary basals.</string>
<string name="iob_hightemp">High temp basal will not be given when your blood sugar is below target.</string>
<string name="iob_negiob">Negative IOB for a substantial period in the absence of exercise suggests your profile is too strong and less insulin is needed in your settings.</string>
<string name="iob_posiob">Positive IOB for a substantial period suggests insulin resistance or unannounced meals.</string>
<string name="breadgrams_label">Carb entry and boluses</string>
<string name="breadgrams_grams">Only grams should be used for estimating and recording carbohydrates consumed.</string>
<string name="breadgrams_exchange">Carbohydrates consumed can be recorded using an appropriate exchange system (e.g. DAFNE "CHO" exchanges or European "Bread Units").</string>
<string name="breadgrams_decay">AAPS uses a dynamic model to estimate carb “decay” and calculate COB.</string>
<string name="breadgrams_calc">If blood glucose levels are outside acceptable values (too low or too high) the bolus calculator can be used to provide suggestions for carb or insulin corrections.</string>
<string name="breadgrams_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
<string name="extendedcarbs_label">e-carbs</string>
<string name="extendedcarbs_handling">What could you use e-carbs (extended carbs) for?</string>
<string name="extendedcarbs_future">To schedule carbs in the future, possibly distributed over an interval (similar to an extended bolus distributing insulin over an interval).</string>
<string name="extendedcarbs_free">For logging \'free\' exercise carbs you want to hide from AAPS.</string>
<string name="extendedcarbs_fat">e-carbs (distributed in the future) can assist AAPS in dealing with high fat/protein meals.</string>
<string name="extendedcarbs_rescue">For logging rescue carbs you use to treat low blood glucose. </string>
<string name="extendedcarbs_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Extended-Carbs.html</string>
<string name="nsclient_label">Remote Monitoring</string>
<string name="nsclient_howcanyou">How can you monitor AAPS (for example for your child) remotely?</string>
<string name="nsclient_nightscout">AAPSClient app, Nightscout app and Nightscout webpage all allow you to follow AAPS remotely.</string>
<string name="nsclient_dexcomfollow">Other apps (e.g. Dexcom follow, xDrip running in follow mode) allow you to follow some parameters (e.g. blood glucose/sensor values) remotely, but use different algorithms so may have inaccurate IOB or COB values.</string>
<string name="nsclient_data">To follow AAPS remotely, both devices must have internet access (e.g. via Wi-Fi or mobile/cellular network data).</string>
<string name="nsclient_fullcontrol">AAPSClient used as a remote follower will both monitor and provide full control of AAPS.</string>
<string name="nsclient_hint1">https://androidaps.readthedocs.io/en/latest/EN/Children/Children.html</string>
<string name="isf_label_exam">Insulin Sensitivity Factor (ISF)</string>
<string name="isf_increasingvalue">Raising ISF values will lead to more insulin delivery to cover a specific amount of carbs.</string>
<string name="isf_decreasingvalue">Reducing ISF values lead to more insulin delivery to correct for an above target blood glucose.</string>
<string name="isf_noeffect">Raising or lowering ISF has no effect on insulin delivery when blood glucose levels are below target.</string>
<string name="isf_preferences">ISF should be entered in your AAPS Preferences.</string>
<string name="isf_profile">Changing the ISF value in your profile is enough to apply the change.</string>
<string name="isf_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-sensitivity-factor-isf-mmol-l-u-or-mg-dl-u</string>
<string name="isf_hint2">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html</string>
<string name="ic_multiple">You can use more than one value for I:C ratio in your profile.</string>
<string name="ic_isf">If you change your ISF in your profile you should always change your I:C ratio too.</string>
<string name="ic_label_exam">Insulin to Carbohydrate Ratio (I:C ratio)</string>
<string name="ic_increasingvalue">Higher I:C ratios lead to less insulin delivered for a given amount of carbs.</string>
<string name="ic_decreasingvalue">Lower I:C ratios lead to less insulin delivered for a given amount of carbs.</string>
<string name="ic_noeffect">If you have 0 COB, changing the IC ratio will lead to a different amount of insulin to correct a given BG value.</string>
<string name="ic_different">IC will be different if you count bread (exchange) unit as 10g or 12g.</string>
<string name="ic_meaning">IC meaning is: How many bread (exchange) units are covered by 1U of insulin.</string>
<string name="ic_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#carbohydrate-to-insulin-ratio-cr-g-u</string>
<string name="profileswitch_label">Profile Switching</string>
<string name="profileswitch_pctwillchange"> When specifying a 90% profile switch, which answers are true?</string>
<string name="profileswitch_basallower">Basal rates will be 10% lower.</string>
<string name="profileswitch_isfhigher">ISF will be 10% higher.</string>
<string name="profileswitch_iclower">The value of the I:C ratio will be a 10% lower number.</string>
<string name="profileswitch_unchanged">ISF and I:C ratios will be unchanged.</string>
<string name="profileswitch_hint1" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#profile-switch</string>
<string name="profileswitch2_label">Profile Switching</string>
<string name="profileswitch2_pctwillchange"> When specifying a 120% profile switch, which answers are true?</string>
<string name="profileswitch2_bghigher">Target blood glucose will be 20% higher.</string>
<string name="profileswitch2_basalhigher">Basal rates will be 20% higher.</string>
<string name="profileswitch2_bgunchanged">Target blood glucose will be unchanged.</string>
<string name="profileswitch2_isfhigher">ISF will be 20% higher.</string>
<string name="profileswitchtime_label">Profile Switching</string>
<string name="profileswitchtime_iwant">If you get up 2 hours earlier than usual, how should you notify AAPS of the change in your schedule?</string>
<string name="profileswitchtime_2">Initiate a profile switch with a timeshift of 2</string>
<string name="profileswitchtime__2">Initiate a profile switch with a timeshift of -2</string>
<string name="profileswitchtime_tt">Set an eating soon temporary target.</string>
<string name="profileswitchtime_100">Do a profile switch to more than 100%. </string>
<string name="profileswitchtime_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#timeshift</string>
<string name="profileswitch4_label">Changes to profiles</string>
<string name="profileswitch4_rates">Basal rates, ISF, I:C ratios, etc., should be set in profiles.</string>
<string name="profileswitch4_internet">Activating changes to your Nightscout Profile requires your AAPS phone to have an internet connection.</string>
<string name="profileswitch4_sufficient">Editing profiles to change values is sufficient to enact any changes made.</string>
<string name="profileswitch4_multi">Multiple profiles can be set up and selected to accommodate changing circumstances (e.g. hormonal changes, shift working, weekdays/weekend lifestyle).</string>
<string name="basalhelp_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html#good-individual-dosage-algorithm-for-your-diabetes-therapy</string>
<string name="basalhelp_label">Help with basal rates</string>
<string name="basalhelp_where">Where to go for help with basalrate etc.</string>
<string name="basalhelp_diabetesteam">Your diabetes team</string>
<string name="basalhelp_google">Google</string>
<string name="basalhelp_facebook">Facebook</string>
<string name="blank"></string>
<string name="other_medication_label">Other Medication. Please read the statement below and then check the box to accept the declaration.</string>
<string name="other_medication_text">AAPS reduces basal rates or suspends insulin delivery to raise blood sugar. Drugs in the class SGLT2 inhibitors (gliflozins) can prevent increases in blood glucose and therefore can produce a dangerous insulin deficiency leading to DKA.
\nCommon brand names are: Invokana®, Forxiga®, Jardiance®, Steglatro®, Suglat®, Apleway®, Deberza®, Synjardy®, Vokanamet®, Xigduo®.\n\nI hereby promise that I will not take such drugs when using AAPS or will deactivate the loop before using such drugs.</string>
</resources>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="key_objectiveuseactions" translatable="false">ObjectivesActionsUsed</string>
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
<string name="key_objectiveusescale" translatable="false">ObjectivesScaleUsed</string>
<string name="key_objectives_request_code" translatable="false">objectives_request_code</string>
<string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string>
<string name="objectives_button_start">Start</string>
<string name="objectives_button_verify">Verify</string>
<string name="nth_objective">%1$d. Objective</string>
<string name="objectivenotstarted">Objective %1$d not started</string>
<string name="objectivenotfinished">Objective %1$d not finished</string>
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
<string name="objectives_openloop_objective">Starting on an open loop</string>
<string name="objectives_openloop_gate">Run in Open Loop mode for a few days and manually enact lots of temp basals. Set up and use temporary and default temporary targets (e.g. for activity or hypo treatment carbs)</string>
<string name="objectives_maxbasal_objective">Understanding your open loop, including its temp basal recommendations</string>
<string name="objectives_maxbasal_gate">Based on that experience, decide what max basal should be, and set it on the pump and preferences</string>
<string name="objectives_maxiobzero_objective">Starting to close the loop with Low Glucose Suspend</string>
<string name="objectives_maxiobzero_gate">Run in closed loop with max IOB = 0 for a few days without too many LGS events</string>
<string name="objectives_maxiob_objective">Tuning the closed loop, raising max IOB above 0 and gradually lowering BG targets</string>
<string name="objectives_maxiob_gate">Run for a few days, and at least one night with no low BG alarms, before dropping BG</string>
<string name="objectives_autosens_objective">Adjust basals and ratios if needed, and then enable auto-sens</string>
<string name="objectives_autosens_gate">1 week successful daytime looping with regular carb entry</string>
<string name="objectives_smb_objective">Enabling additional features for daytime use, such as SMB</string>
<string name="objectives_auto_objective">Enabling automation</string>
<string name="objectives_smb_gate">You must read the wiki and rise maxIOB to get SMBs working fine! A good start is maxIOB=average mealbolus + 3 x max daily basal</string>
<string name="objectives_auto_gate">Read the docs on how automation works. Set up your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. (https://androidaps.readthedocs.io/en/latest/EN/Usage/Automation.html)</string>
<string name="objectives_bgavailableinns">BG available in NS</string>
<string name="objectives_pumpstatusavailableinns">Pump status available in NS</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="accomplished">Accomplished: %1$s</string>
<string name="objectives_usage_objective">Learn how to control AAPS</string>
<string name="objectives_usage_gate">Perform different actions in AAPS</string>
<string name="objectives_useprofileswitch">Set profile 90% for 10 min (Long-press profile name on Overview)</string>
<string name="objectives_usedisconnectpump">Simulate shower. Disconnect pump for 1h (Long-press on Open Loop)</string>
<string name="objectives_usereconnectpump">... and reconnect back the same way</string>
<string name="objectives_usetemptarget">Create custom temporary target with 10 min duration (Long-press on your current target)</string>
<string name="objectives_useactions">In Config Builder enable Actions plugin, make it visible and display its content from top menu</string>
<string name="objectives_useloop">Display content of Loop plugin</string>
<string name="objectives_usescale">Use scale function by long-pressing BG chart</string>
<string name="objectives_button_enter">Enter</string>
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">If you have at least 3 months of closed loop experience with other systems you might qualify for a code to skip objectives. See https://androidaps.readthedocs.io/en/latest/EN/Usage/Objectives.html#skip-objectives for details.</string>
<string name="codeaccepted">Code accepted</string>
<string name="codeinvalid">Code invalid</string>
<string name="objectives_exam_objective">Prove your knowledge</string>
<string name="objectives_exam_gate">Study the questions.  You are given four possible answers for each question. There may be more than one correct answer. Please check all those that are correct and select VERIFY.</string>
<string name="answerdisabledto">Answering disabled until: %1$s</string>
<string name="wronganswer">Wrong answer!</string>
<string name="unfinshed_button">Next unfinished</string>
<string name="requestcode">Request code: %1$s</string>
<string name="objectives_hint">(check all correct answers)</string>
<string name="disconnectpump_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath</string>
<string name="usetemptarget_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="useaction_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder</string>
<string name="usescale_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="notconnected">Not connected to the internet</string>
<string name="failedretrievetime">Failed retrieve time</string>
<string name="requirementnotmet">Objective requirements not met</string>
</resources>

View file

@ -234,9 +234,89 @@
<string name="phone_checker" translatable="false">PhoneChecker</string> <string name="phone_checker" translatable="false">PhoneChecker</string>
<!-- Objectives --> <!-- Objectives -->
<string name="key_objectives_bg_is_available_in_ns" translatable="false">ObjectivesbgIsAvailableInNS</string>
<string name="key_objectives_pump_status_is_available_in_ns" translatable="false">ObjectivespumpStatusIsAvailableInNS</string>
<string name="completed_well_done">Completed, well done!</string> <string name="completed_well_done">Completed, well done!</string>
<string name="not_completed_yet">Not completed yet</string> <string name="not_completed_yet">Not completed yet</string>
<string name="time_elapsed">Time elapsed</string> <string name="time_elapsed">Time elapsed</string>
<string name="maxiobset">Maximal IOB set properly</string>
<string name="hasbgdata">BG available from selected source</string>
<string name="synchaswritepermission">Synchronization service has write permission</string>
<string name="loopenabled">Loop enabled</string>
<string name="apsselected">APS selected</string>
<string name="closedmodeenabled">Closed mode enabled</string>
<string name="objectives_shortname">OBJ</string>
<string name="description_objectives">Learning program</string>
<string name="doyouwantresetstart">Do you want reset objective start? You may lose your progress.</string>
<string name="objectives_next_button">Next</string>
<string name="objectives_previous_button">Prev</string>
<string name="objectives_button_unfinish">Clear finished</string>
<string name="objectives_button_unstart">Clear started</string>
<!-- Actions -->
<string name="actions">Actions</string>
<string name="description_actions">Some buttons to quickly access common features</string>
<string name="actions_shortname">ACT</string>
<string name="tempbasal_button">TempBasal</string>
<string name="extended_bolus_button">Extended Bolus</string>
<string name="extended_bolus_cancel_button">Cancel Extended Bolus</string>
<string name="tools">Tools</string>
<string name="nav_history_browser">History browser</string>
<string name="sensor_label">Sensor</string>
<string name="age_label">age:</string>
<string name="level_label">level:</string>
<string name="insulin_label">Insulin</string>
<string name="pb_label">Pump battery</string>
<string name="cannula">Cannula</string>
<string name="ebstopsloop">Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?</string>
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="statuslights_cannula_age">cannula age</string>
<string name="statuslights_patch_pump_age">patch pump age</string>
<string name="patch_pump">Patch pump</string>
<!-- Safety -->
<string name="key_openapsama_useautosens" translatable="false">openapsama_useautosens</string>
<string name="key_use_smb" translatable="false">use_smb</string>
<string name="key_use_uam" translatable="false">use_uam</string>
<string name="key_openapsma_max_basal" translatable="false">openapsma_max_basal</string>
<string name="key_openapsama_current_basal_safety_multiplier" translatable="false">openapsama_current_basal_safety_multiplier</string>
<string name="key_openapsama_max_daily_safety_multiplier" translatable="false">openapsama_max_daily_safety_multiplier</string>
<string name="key_treatmentssafety_maxbolus" translatable="false">treatmentssafety_maxbolus</string>
<string name="key_lgs_threshold" translatable="false">lgsThreshold</string>
<string name="key_openapssmb_max_iob" translatable="false">openapsmb_max_iob</string>
<string name="limitingextendedbolus">Limiting extended bolus to %1$.1f U because of %2$s</string>
<string name="limitingcarbs">Limiting carbs to %1$d g because of %2$s</string>
<string name="limitingiob">Limiting IOB to %1$.1f U because of %2$s</string>
<string name="maxbasalmultiplier">max basal multiplier</string>
<string name="maxdailybasalmultiplier">max daily basal multiplier</string>
<string name="key_openapsma_max_iob" translatable="false">openapsma_max_iob</string>
<string name="safety" translatable="false">Safety</string>
<string name="pumpisnottempbasalcapable">Pump is not temp basal capable</string>
<string name="closedmodedisabledinpreferences">Closed loop mode disabled in preferences</string>
<string name="autosensdisabledinpreferences">Autosens disabled in preferences</string>
<string name="smbdisabledinpreferences">SMB disabled in preferences</string>
<string name="uamdisabledinpreferences">UAM disabled in preferences</string>
<string name="uamdisabledoref1notselected">UAM disabled because it rely on Oref1 sensitivity plugin</string>
<string name="closed_loop_disabled_on_dev_branch">Running dev version. Closed loop is disabled.</string>
<string name="closed_loop_disabled_with_eb">Closed loop disabled because of running Extended bolus</string>
<string name="smbalwaysdisabled">SMB always and after carbs disabled because active BG source doesn\'t support advanced filtering</string>
<string name="smbnotallowedinopenloopmode">SMB not allowed in open loop mode</string>
<string name="increasingmaxbasal">Increasing max basal value because setting is lower than your max basal in profile</string>
<string name="maxvalueinpreferences">max value in preferences</string>
<string name="hardlimit">hard limit</string>
<string name="treatmentssafety_title">Treatments safety</string>
<string name="patientage_summary">Please select patient type to setup safety limits</string>
<string name="child">Child</string>
<string name="teenage">Teenage</string>
<string name="adult">Adult</string>
<string name="resistantadult">Insulin resistant adult</string>
<string name="pregnant">Pregnancy</string>
<string name="treatmentssafety_maxbolus_title">Max allowed bolus [U]</string>
<string name="treatmentssafety_maxcarbs_title">Max allowed carbs [g]</string>
<string name="patientage">Patient type</string>
<!-- Overview --> <!-- Overview -->
<string name="key_statuslights_copy_ns" translatable="false">statuslights_copy_ns</string> <string name="key_statuslights_copy_ns" translatable="false">statuslights_copy_ns</string>
@ -276,6 +356,16 @@
<string name="statuslights_bat_critical">Threshold critical pump battery level [%]</string> <string name="statuslights_bat_critical">Threshold critical pump battery level [%]</string>
<string name="statuslights">Status lights</string> <string name="statuslights">Status lights</string>
<string name="statuslights_copy_ns">Copy settings from NS</string> <string name="statuslights_copy_ns">Copy settings from NS</string>
<string name="a11y_graph">graph</string>
<string name="a11y_insulin_label">insulin</string>
<string name="chart_menu">Chart menu</string>
<string name="a11y_bg_quality">blood glucose quality</string>
<string name="a11y_blood_glucose">blood glucose</string>
<string name="a11y_bg_outdated">outdated</string>
<string name="apsmode_title">APS Mode</string>
<string name="setbasalquestion">Accept new temp basal:</string>
<string name="overview_cgm">CGM</string>
<string name="quickwizard">QuickWizard</string>
<!-- NSClient --> <!-- NSClient -->
<string name="key_ns_client_autoscroll" translatable="false">ns_client_autoscroll</string> <string name="key_ns_client_autoscroll" translatable="false">ns_client_autoscroll</string>
@ -483,8 +573,13 @@
<string name="uploader_short">UPLD</string> <string name="uploader_short">UPLD</string>
<string name="ns_malfunction">NSClient malfunction. Consider NS and NSClient restart.</string> <string name="ns_malfunction">NSClient malfunction. Consider NS and NSClient restart.</string>
<!-- Objectives --> <!-- Skins -->
<string name="key_objectives_bg_is_available_in_ns" translatable="false">ObjectivesbgIsAvailableInNS</string> <string name="key_skin" translatable="false">skin</string>
<string name="key_objectives_pump_status_is_available_in_ns" translatable="false">ObjectivespumpStatusIsAvailableInNS</string>
<string name="classic_description">Original skin</string>
<string name="lowres_description">Low Resolution skin</string>
<string name="buttonson_description">Buttons are always displayed on bottom of screen</string>
<string name="largedisplay_description">Large display</string>
<string name="skin">Skin</string>
</resources> </resources>

View file

@ -0,0 +1,84 @@
package info.nightscout.androidaps
import info.nightscout.core.main.R
import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
import kotlin.math.max
import kotlin.math.min
class HardLimitsMock @Inject constructor(
private val sp: SP,
private val rh: ResourceHelper
) : HardLimits {
companion object {
private const val CHILD = 0
private const val TEENAGE = 1
private const val ADULT = 2
private const val RESISTANT_ADULT = 3
private const val PREGNANT = 4
private val MAX_BOLUS = doubleArrayOf(5.0, 10.0, 17.0, 25.0, 60.0)
// Very Hard Limits Ranges
// First value is the Lowest and second value is the Highest a Limit can define
val VERY_HARD_LIMIT_MIN_BG = doubleArrayOf(80.0, 180.0)
val VERY_HARD_LIMIT_MAX_BG = doubleArrayOf(90.0, 200.0)
val VERY_HARD_LIMIT_TARGET_BG = doubleArrayOf(80.0, 200.0)
// Very Hard Limits Ranges for Temp Targets
val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180)
val VERY_HARD_LIMIT_TEMP_MAX_BG = intArrayOf(72, 270)
val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200)
val MIN_DIA = doubleArrayOf(5.0, 5.0, 5.0, 5.0, 5.0)
val MAX_DIA = doubleArrayOf(9.0, 9.0, 9.0, 9.0, 10.0)
val MIN_IC = doubleArrayOf(2.0, 2.0, 2.0, 2.0, 0.3)
val MAX_IC = doubleArrayOf(100.0, 100.0, 100.0, 100.0, 100.0)
const val MIN_ISF = 2.0 // mgdl
const val MAX_ISF = 1000.0 // mgdl
val MAX_IOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0, 25.0)
val MAX_IOB_SMB = doubleArrayOf(7.0, 13.0, 22.0, 30.0, 70.0)
val MAX_BASAL = doubleArrayOf(2.0, 5.0, 10.0, 12.0, 25.0)
//LGS Hard limits
//No IOB at all
const val MAX_IOB_LGS = 0.0
}
private fun loadAge(): Int = when (sp.getString(R.string.key_age, "")) {
rh.gs(R.string.key_child) -> CHILD
rh.gs(R.string.key_teenage) -> TEENAGE
rh.gs(R.string.key_adult) -> ADULT
rh.gs(R.string.key_resistantadult) -> RESISTANT_ADULT
rh.gs(R.string.key_pregnant) -> PREGNANT
else -> ADULT
}
override fun maxBolus(): Double = MAX_BOLUS[loadAge()]
override fun maxIobAMA(): Double = MAX_IOB_AMA[loadAge()]
override fun maxIobSMB(): Double = MAX_IOB_SMB[loadAge()]
override fun maxBasal(): Double = MAX_BASAL[loadAge()]
override fun minDia(): Double = MIN_DIA[loadAge()]
override fun maxDia(): Double = MAX_DIA[loadAge()]
override fun minIC(): Double = MIN_IC[loadAge()]
override fun maxIC(): Double = MAX_IC[loadAge()]
// safety checks
override fun checkHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Boolean =
value == verifyHardLimits(value, valueName, lowLimit, highLimit)
override fun isInRange(value: Double, lowLimit: Double, highLimit: Double): Boolean =
value in lowLimit..highLimit
override fun verifyHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Double {
var newValue = value
if (newValue < lowLimit || newValue > highLimit) {
newValue = max(newValue, lowLimit)
newValue = min(newValue, highLimit)
}
return newValue
}
}

Some files were not shown because too many files have changed in this diff Show more