diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index 90e09659e2..d3d2bfcd7a 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -40,7 +40,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus @@ -78,7 +78,7 @@ class MainActivity : NoSplashAppCompatActivity() { @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var iconsProvider: IconsProvider - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var signatureVerifierPlugin: SignatureVerifierPlugin @Inject lateinit var config: Config @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index d8da3f08b6..a7dab3c4a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -19,6 +19,7 @@ import info.nightscout.androidaps.interfaces.CarbTimer import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.ConfigBuilder +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DataSyncSelector import info.nightscout.androidaps.interfaces.IconsProvider import info.nightscout.androidaps.interfaces.ImportExportPrefs @@ -36,7 +37,7 @@ import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.PluginStore -import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation +import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl import info.nightscout.androidaps.plugins.general.autotune.AutotunePlugin import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider @@ -60,6 +61,7 @@ import info.nightscout.implementation.BolusTimerImpl import info.nightscout.implementation.CarbTimerImpl import info.nightscout.implementation.LocalAlertUtilsImpl import info.nightscout.implementation.XDripBroadcastImpl +import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.implementation.queue.CommandQueueImplementation import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.shared.logging.AAPSLogger @@ -108,11 +110,14 @@ open class AppModule { ActivePlugin, repository: AppRepository, dateUtil: DateUtil, config: Config, hardLimits: HardLimits, aapsSchedulers: AapsSchedulers, fabricPrivacy: FabricPrivacy, deviceStatusData: DeviceStatusData ): ProfileFunction = - ProfileFunctionImplementation( + ProfileFunctionImpl( aapsLogger, sp, rxBus, rh, activePlugin, repository, dateUtil, config, hardLimits, aapsSchedulers, fabricPrivacy, deviceStatusData ) + @Provides + @Singleton + internal fun provideConstraints(activePlugin: ActivePlugin): Constraints = ConstraintsImpl(activePlugin) @Module interface AppBindings { @@ -130,8 +135,7 @@ open class AppModule { @Binds fun bindAutotuneInterface(autotunePlugin: AutotunePlugin): Autotune @Binds fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator @Binds fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator - @Binds fun bindDataSyncSelector(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector - + @Binds fun bindDataSyncSelectorInterface(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector @Binds fun bindPumpSyncInterface(pumpSyncImplementation: PumpSyncImplementation): PumpSync @Binds fun bindXDripBroadcastInterface(xDripBroadcastImpl: XDripBroadcastImpl): XDripBroadcast @Binds fun bindCarbTimerInterface(carbTimer: CarbTimerImpl): CarbTimer diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt index 8df008ed23..452e9606e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.HtmlHelper import info.nightscout.androidaps.utils.ToastUtils @@ -36,7 +36,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { @Inject lateinit var ctx: Context @Inject lateinit var rh: ResourceHelper - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt index e9820377d9..f9e0848e9b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt @@ -22,7 +22,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.HtmlHelper @@ -40,7 +40,7 @@ import kotlin.math.abs class FillDialog : DialogFragmentWithDate() { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var rh: ResourceHelper @Inject lateinit var ctx: Context @Inject lateinit var commandQueue: CommandQueue diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt index d25fff10ed..0f8dafe47c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -21,7 +21,7 @@ import info.nightscout.androidaps.extensions.formatColor import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.alertDialogs.OKDialog @@ -41,7 +41,7 @@ import kotlin.math.max class InsulinDialog : DialogFragmentWithDate() { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var rh: ResourceHelper @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt index 4820917e38..d04fcb3105 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt @@ -37,7 +37,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.DateUtil @@ -65,7 +65,7 @@ class LoopDialog : DaggerDialogFragment() { @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var loop: Loop @Inject lateinit var activePlugin: ActivePlugin - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var configBuilder: ConfigBuilder @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index c44370bad9..6e07438101 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -14,7 +14,7 @@ import info.nightscout.androidaps.databinding.DialogTempbasalBinding import info.nightscout.androidaps.extensions.formatColor import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.HtmlHelper import info.nightscout.androidaps.utils.ToastUtils @@ -30,7 +30,7 @@ import kotlin.math.abs class TempBasalDialog : DialogFragmentWithDate() { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var activePlugin: ActivePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index 60609fe12d..de278cb854 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -24,7 +24,7 @@ import info.nightscout.androidaps.interfaces.GlucoseUnit import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.HtmlHelper import info.nightscout.androidaps.utils.ToastUtils @@ -41,7 +41,7 @@ import javax.inject.Inject class TempTargetDialog : DialogFragmentWithDate() { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var defaultValueHelper: DefaultValueHelper diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt index 2f01d661f0..2424be5d47 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.HtmlHelper @@ -42,7 +42,7 @@ import kotlin.math.abs class TreatmentDialog : DialogFragmentWithDate() { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var rh: ResourceHelper @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index ac8adc39d3..7918dffd31 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -31,7 +31,7 @@ import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.extensions.valueToUnits import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS @@ -53,7 +53,7 @@ class WizardDialog : DaggerDialogFragment() { @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var ctx: Context @Inject lateinit var sp: SP @Inject lateinit var rxBus: RxBus diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt index bf57ff5d7b..d361f31b77 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt @@ -55,7 +55,7 @@ import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification @@ -87,7 +87,7 @@ class LoopPlugin @Inject constructor( private val rxBus: RxBus, private val sp: SP, config: Config, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, rh: ResourceHelper, private val profileFunction: ProfileFunction, private val context: Context, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt index 184b2b2bd3..08ad43aa41 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback import info.nightscout.androidaps.plugins.aps.loop.APSResult import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.shared.sharedPreferences.SP import org.json.JSONArray @@ -37,7 +37,7 @@ class DetermineBasalAdapterAMAJS internal constructor(scriptReader: ScriptReader private val injector: HasAndroidInjector @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var iobCobCalculator: IobCobCalculator diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt index 99a6325cc1..a658026409 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DateUtil @@ -43,7 +43,7 @@ class OpenAPSAMAPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, private val rxBus: RxBus, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, rh: ResourceHelper, private val profileFunction: ProfileFunction, private val context: Context, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt index c23f14d54a..aac146196b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt @@ -13,7 +13,7 @@ import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback import info.nightscout.androidaps.plugins.aps.loop.APSResult import info.nightscout.androidaps.plugins.aps.loop.ScriptReader -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.shared.SafeParse import info.nightscout.androidaps.interfaces.ResourceHelper @@ -31,7 +31,7 @@ import javax.inject.Inject class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader: ScriptReader, private val injector: HasAndroidInjector) : DetermineBasalAdapterInterface { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var sp: SP @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt index 5256342edf..d69750e7a9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt @@ -26,7 +26,6 @@ import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DateUtil @@ -45,7 +44,7 @@ class OpenAPSSMBPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, private val rxBus: RxBus, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, rh: ResourceHelper, private val profileFunction: ProfileFunction, val context: Context, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt index 45e22db183..6f62428a7e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.interfaces.ResourceHelper @@ -42,7 +42,7 @@ import kotlin.math.ln class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scriptReader: ScriptReader, private val injector: HasAndroidInjector) : DetermineBasalAdapterInterface { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var sp: SP @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt index ea2d85eeaa..176cfe3089 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.HardLimits @@ -30,7 +30,7 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, rxBus: RxBus, - constraintChecker: ConstraintChecker, + constraintChecker: Constraints, rh: ResourceHelper, profileFunction: ProfileFunction, context: Context, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt rename to app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt index bdb8bcf411..dc79e8df30 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt @@ -27,7 +27,7 @@ import javax.inject.Inject import javax.inject.Singleton @Singleton -class ProfileFunctionImplementation @Inject constructor( +class ProfileFunctionImpl @Inject constructor( private val aapsLogger: AAPSLogger, private val sp: SP, private val rxBus: RxBus, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt index dd10f4a33d..e15e5279a3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt @@ -2,8 +2,7 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.androidaps.utils.T import javax.inject.Inject @@ -11,7 +10,7 @@ import javax.inject.Inject @Suppress("SpellCheckingInspection") class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R.string.objectives_maxiob_objective, R.string.objectives_maxiob_gate) { - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var safetyPlugin: SafetyPlugin init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt index 4f4a835e9f..30a2f47603 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt @@ -11,7 +11,7 @@ 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.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin @@ -34,7 +34,7 @@ class SafetyPlugin @Inject constructor( rh: ResourceHelper, private val sp: SP, private val rxBus: RxBus, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val openAPSAMAPlugin: OpenAPSAMAPlugin, private val openAPSSMBPlugin: OpenAPSSMBPlugin, private val openAPSSMBDynamicISFPlugin: OpenAPSSMBDynamicISFPlugin, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index ccb34fabba..dd7735c1e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -73,7 +73,7 @@ import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus @@ -126,7 +126,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList @Inject lateinit var rh: ResourceHelper @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var statusLightHandler: StatusLightHandler @Inject lateinit var nsDeviceStatus: NSDeviceStatus @Inject lateinit var loop: Loop diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt index cd4169347b..19fa03887b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.extensions.valueToUnitsString import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus import info.nightscout.androidaps.plugins.general.overview.graphExtensions.GlucoseValueDataPoint import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider @@ -72,7 +72,7 @@ class DataHandlerMobile @Inject constructor( private val defaultValueHelper: DefaultValueHelper, private val trendCalculator: TrendCalculator, private val dateUtil: DateUtil, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val uel: UserEntryLogger, private val activePlugin: ActivePlugin, private val commandQueue: CommandQueue, diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt index 3ca74ce899..0f0aa7211d 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt @@ -35,7 +35,7 @@ import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.queue.Callback @@ -64,7 +64,7 @@ class BolusWizard @Inject constructor( @Inject lateinit var rxBus: RxBus @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var loop: Loop diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index ee67c07b13..a352343466 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -15,7 +15,6 @@ import info.nightscout.androidaps.logging.UserEntryLogger 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.configBuilder.ConstraintChecker 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 @@ -32,6 +31,7 @@ import info.nightscout.androidaps.plugins.source.GlimpPlugin import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl +import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -64,7 +64,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { private lateinit var danaPump: DanaPump private lateinit var insightDbHelper: InsightDbHelper - private lateinit var constraintChecker: ConstraintChecker + private lateinit var constraintChecker: ConstraintsImpl private lateinit var safetyPlugin: SafetyPlugin private lateinit var objectivesPlugin: ObjectivesPlugin private lateinit var comboPlugin: ComboPlugin @@ -123,7 +123,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { //SafetyPlugin `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) - constraintChecker = ConstraintChecker(activePlugin) + constraintChecker = ConstraintsImpl(activePlugin) val glucoseStatusProvider = GlucoseStatusProvider(aapsLogger = aapsLogger, iobCobCalculator = iobCobCalculator, dateUtil = dateUtil) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt index 6914c34e49..df4af5b255 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.receivers.ReceiverStatusStore @@ -35,7 +35,7 @@ class LoopPluginTest : TestBase() { @Mock lateinit var sp: SP private val rxBus: RxBus = RxBus(aapsSchedulers, aapsLogger) - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var rh: ResourceHelper @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var context: Context diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt index da0e9b7187..39ca5fb51d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription 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.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin @@ -28,7 +28,7 @@ import org.mockito.Mockito.`when` class SafetyPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin @Mock lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin @Mock lateinit var openAPSSMBDynamicISFPlugin: OpenAPSSMBDynamicISFPlugin @@ -103,7 +103,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Test fun notEnabledSMBInPreferencesDisablesSMB() { `when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(false) - `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(Constraint(true)) + `when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(true)) var c = Constraint(true) c = safetyPlugin.isSMBModeEnabled(c) Assert.assertTrue(c.getReasons(aapsLogger).contains("SMB disabled in preferences")) @@ -112,7 +112,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Test fun openLoopPreventsSMB() { `when`(sp.getBoolean(R.string.key_use_smb, false)).thenReturn(true) - `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(Constraint(false)) + `when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(Constraint(false)) var c = Constraint(true) c = safetyPlugin.isSMBModeEnabled(c) Assert.assertTrue(c.getReasons(aapsLogger).contains("SMB not allowed in open loop mode")) diff --git a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt index 97872fc3d2..0e0d8bcb84 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.data.IobTotal import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin @@ -27,7 +27,7 @@ class BolusWizardTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var profileFunction: ProfileFunction - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var context: Context @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueue diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt index c7710432f7..fc67a6e217 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt @@ -14,7 +14,7 @@ import info.nightscout.androidaps.events.EventNetworkChange import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.automation.actions.* import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui @@ -47,7 +47,7 @@ class AutomationPlugin @Inject constructor( private val fabricPrivacy: FabricPrivacy, private val loop: Loop, private val rxBus: RxBus, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, aapsLogger: AAPSLogger, private val aapsSchedulers: AapsSchedulers, private val config: Config, diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt index 709b4c037b..6f6137c5a2 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt @@ -1,31 +1,56 @@ package info.nightscout.androidaps.interfaces +import info.nightscout.androidaps.Constants + /** * Constraints interface * * Every function has a param from previous chained call * Function can limit the value even more and add another reason of restriction * - * see [info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker] + * see [info.nightscout.implementation.constraints.ConstraintsImpl] * which iterates over all registered plugins with [Constraints] implemented * * @return updated parameter */ interface Constraints { - fun isLoopInvocationAllowed(value: Constraint): Constraint = value - fun isClosedLoopAllowed(value: Constraint): Constraint = value - fun isLgsAllowed(value: Constraint): Constraint = value - fun isAutosensModeEnabled(value: Constraint): Constraint = value - fun isSMBModeEnabled(value: Constraint): Constraint = value - fun isUAMEnabled(value: Constraint): Constraint = value - fun isAdvancedFilteringEnabled(value: Constraint): Constraint = value - fun isSuperBolusEnabled(value: Constraint): Constraint = value + fun isLoopInvocationAllowed(value: Constraint = Constraint(true)): Constraint = value + fun isClosedLoopAllowed(value: Constraint = Constraint(true)): Constraint = value + fun isLgsAllowed(value: Constraint = Constraint(true)): Constraint = value + fun isAutosensModeEnabled(value: Constraint = Constraint(true)): Constraint = value + fun isSMBModeEnabled(value: Constraint = Constraint(true)): Constraint = value + fun isUAMEnabled(value: Constraint = Constraint(true)): Constraint = value + fun isAdvancedFilteringEnabled(value: Constraint = Constraint(true)): Constraint = value + fun isSuperBolusEnabled(value: Constraint = Constraint(true)): Constraint = value + fun isAutomationEnabled(value: Constraint = Constraint(true)): Constraint = value fun applyBasalConstraints(absoluteRate: Constraint, profile: Profile): Constraint = absoluteRate fun applyBasalPercentConstraints(percentRate: Constraint, profile: Profile): Constraint = percentRate fun applyBolusConstraints(insulin: Constraint): Constraint = insulin fun applyExtendedBolusConstraints(insulin: Constraint): Constraint = insulin fun applyCarbsConstraints(carbs: Constraint): Constraint = carbs fun applyMaxIOBConstraints(maxIob: Constraint): Constraint = maxIob - fun isAutomationEnabled(value: Constraint): Constraint = value + + /* + * Determine max values by walking through all constraints + */ + fun getMaxBasalAllowed(profile: Profile): Constraint = + applyBasalConstraints(Constraint(Constants.REALLYHIGHBASALRATE), profile) + + fun getMaxBasalPercentAllowed(profile: Profile): Constraint = + applyBasalPercentConstraints(Constraint(Constants.REALLYHIGHPERCENTBASALRATE), profile) + + fun getMaxBolusAllowed(): Constraint = + applyBolusConstraints(Constraint(Constants.REALLYHIGHBOLUS)) + + fun getMaxExtendedBolusAllowed(): Constraint = + applyExtendedBolusConstraints(Constraint(Constants.REALLYHIGHBOLUS)) + + fun getMaxCarbsAllowed(): Constraint = + applyCarbsConstraints(Constraint(Constants.REALLYHIGHCARBS)) + + fun getMaxIOBAllowed(): Constraint = + applyMaxIOBConstraints(Constraint(Constants.REALLYHIGHIOB)) + + } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt index c96b0b405b..010dea9225 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt @@ -9,20 +9,19 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.convertedToPercent import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpDescription -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.HtmlHelper.fromHtml -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP import org.json.JSONException import org.json.JSONObject -import java.util.* import javax.inject.Inject import kotlin.math.abs import kotlin.math.max @@ -34,7 +33,7 @@ import kotlin.math.max open class APSResult @Inject constructor(val injector: HasAndroidInjector) { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var sp: SP @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt index b2ed11b65e..c26ab637af 100644 --- a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt @@ -5,8 +5,8 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.database.entities.TemporaryBasal import info.nightscout.androidaps.interfaces.Constraint +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble import org.junit.Assert @@ -18,7 +18,7 @@ import org.mockito.Mockito.`when` class APSResultTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraints: Constraints @Mock lateinit var iobCobCalculator: IobCobCalculator private val injector = HasAndroidInjector { AndroidInjector { } } @@ -31,7 +31,7 @@ class APSResultTest : TestBaseWithProfile() { val apsResult = APSResult { AndroidInjector { } } .also { it.aapsLogger = aapsLogger - it.constraintChecker = constraintChecker + it.constraintChecker = constraints it.sp = sp it.activePlugin = activePluginProvider it.iobCobCalculator = iobCobCalculator @@ -66,36 +66,92 @@ class APSResultTest : TestBaseWithProfile() { Assert.assertEquals(false, apsResult.isChangeRequested) // request equal temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 70.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 70.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(70).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) // request zero temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 10.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 10.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(0).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // request high temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 190.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 190.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(200).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // request slightly different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 70.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 70.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(80).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 70.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 70.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(120).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // it should work with absolute temps too // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 1.0, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 1.0, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(100).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 2.0, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 2.0, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).percent(50).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) @@ -111,39 +167,103 @@ class APSResultTest : TestBaseWithProfile() { Assert.assertEquals(false, apsResult.isChangeRequested) // request equal temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 2.0, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 2.0, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(2.0).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 200.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 200.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(2.0).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) // request zero temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 0.1, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 0.1, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(0.0).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // request high temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 34.9, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 34.9, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(35.0).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // request slightly different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 1.1, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 1.1, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(1.2).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 1.1, duration = 30, isAbsolute = true, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 1.1, + duration = 30, + isAbsolute = true, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(1.5).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) // it should work with percent temps too // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 110.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 110.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(1.1).duration(30) Assert.assertEquals(false, apsResult.isChangeRequested) - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(TemporaryBasal(timestamp = 0, rate = 200.0, duration = 30, isAbsolute = false, type = TemporaryBasal.Type.NORMAL)) + `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( + TemporaryBasal( + timestamp = 0, + rate = 200.0, + duration = 30, + isAbsolute = false, + type = TemporaryBasal.Type.NORMAL + ) + ) apsResult.tempBasalRequested(true).rate(0.5).duration(30) Assert.assertEquals(true, apsResult.isChangeRequested) } @@ -152,7 +272,7 @@ class APSResultTest : TestBaseWithProfile() { val apsResult = APSResult { AndroidInjector { } } .also { it.aapsLogger = aapsLogger - it.constraintChecker = constraintChecker + it.constraintChecker = constraints it.sp = sp it.activePlugin = activePluginProvider it.iobCobCalculator = iobCobCalculator @@ -169,7 +289,7 @@ class APSResultTest : TestBaseWithProfile() { val apsResult = APSResult { AndroidInjector { } } .also { it.aapsLogger = aapsLogger - it.constraintChecker = constraintChecker + it.constraintChecker = constraints it.sp = sp it.activePlugin = activePluginProvider it.iobCobCalculator = iobCobCalculator @@ -184,7 +304,7 @@ class APSResultTest : TestBaseWithProfile() { @Before fun prepare() { - `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(closedLoopEnabled) + `when`(constraints.isClosedLoopAllowed(anyObject())).thenReturn(closedLoopEnabled) `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) `when`(sp.getDouble(ArgumentMatchers.anyInt(), ArgumentMatchers.anyDouble())).thenReturn(30.0) `when`(profileFunction.getProfile()).thenReturn(validProfile) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt b/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt similarity index 76% rename from core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt rename to implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt index 0aa41d107e..5d0557798d 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt +++ b/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt @@ -1,63 +1,14 @@ -package info.nightscout.androidaps.plugins.configBuilder +package info.nightscout.implementation.constraints -import info.nightscout.androidaps.Constants -import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.Profile import javax.inject.Inject import javax.inject.Singleton -@OpenForTesting @Singleton -class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlugin) : Constraints { - - fun isLoopInvocationAllowed(): Constraint = - isLoopInvocationAllowed(Constraint(true)) - - fun isClosedLoopAllowed(): Constraint = - isClosedLoopAllowed(Constraint(true)) - - fun isLgsAllowed(): Constraint = - isLgsAllowed(Constraint(true)) - - fun isAutosensModeEnabled(): Constraint = - isAutosensModeEnabled(Constraint(true)) - - fun isSMBModeEnabled(): Constraint = - isSMBModeEnabled(Constraint(true)) - - fun isUAMEnabled(): Constraint = - isUAMEnabled(Constraint(true)) - - fun isAdvancedFilteringEnabled(): Constraint = - isAdvancedFilteringEnabled(Constraint(true)) - - fun isSuperBolusEnabled(): Constraint = - isSuperBolusEnabled(Constraint(true)) - - fun getMaxBasalAllowed(profile: Profile): Constraint = - applyBasalConstraints(Constraint(Constants.REALLYHIGHBASALRATE), profile) - - fun getMaxBasalPercentAllowed(profile: Profile): Constraint = - applyBasalPercentConstraints(Constraint(Constants.REALLYHIGHPERCENTBASALRATE), profile) - - fun getMaxBolusAllowed(): Constraint = - applyBolusConstraints(Constraint(Constants.REALLYHIGHBOLUS)) - - fun getMaxExtendedBolusAllowed(): Constraint = - applyExtendedBolusConstraints(Constraint(Constants.REALLYHIGHBOLUS)) - - fun getMaxCarbsAllowed(): Constraint = - applyCarbsConstraints(Constraint(Constants.REALLYHIGHCARBS)) - - fun getMaxIOBAllowed(): Constraint = - applyMaxIOBConstraints(Constraint(Constants.REALLYHIGHIOB)) - - fun isAutomationEnabled(): Constraint = - isAutomationEnabled(Constraint(true)) +class ConstraintsImpl @Inject constructor(private val activePlugin: ActivePlugin) : Constraints { override fun isLoopInvocationAllowed(value: Constraint): Constraint { val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java) diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt index 65177e94b9..999f62acc8 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt @@ -31,7 +31,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification @@ -82,7 +82,7 @@ class CommandQueueImplementation @Inject constructor( private val rxBus: RxBus, private val aapsSchedulers: AapsSchedulers, private val rh: ResourceHelper, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val profileFunction: ProfileFunction, private val activePlugin: ActivePlugin, private val context: Context, diff --git a/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt index a5cfb3c152..78211c0604 100644 --- a/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger import info.nightscout.androidaps.services.LocationServiceHelper @@ -33,7 +33,7 @@ class BolusTimerImplTest : TestBase() { @Mock lateinit var fabricPrivacy: FabricPrivacy @Mock lateinit var loop: Loop @Mock lateinit var rxBus: RxBus - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var config: Config @Mock lateinit var locationServiceHelper: LocationServiceHelper @Mock lateinit var activePlugin: ActivePlugin diff --git a/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt index a6923ad2ee..be03ee5c88 100644 --- a/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger import info.nightscout.androidaps.services.LocationServiceHelper @@ -35,7 +35,7 @@ class CarbTimerImplTest : TestBase() { @Mock lateinit var fabricPrivacy: FabricPrivacy @Mock lateinit var loop: Loop @Mock lateinit var rxBus: RxBus - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var config: Config @Mock lateinit var locationServiceHelper: LocationServiceHelper @Mock lateinit var activePlugin: ActivePlugin diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt index 5324fdf01b..8688ae5089 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt @@ -17,11 +17,11 @@ import info.nightscout.androidaps.interfaces.AndroidPermission import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Constraint +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.androidaps.queue.commands.CustomCommand @@ -47,7 +47,7 @@ import java.util.Calendar class CommandQueueImplementationTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var sp: SP @Mock lateinit var powerManager: PowerManager @@ -62,7 +62,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { rxBus: RxBus, aapsSchedulers: AapsSchedulers, rh: ResourceHelper, - constraintChecker: ConstraintChecker, + constraintChecker: Constraints, profileFunction: ProfileFunction, activePlugin: ActivePlugin, context: Context, diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt index 7329abdfcd..ac8db35717 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt @@ -14,7 +14,7 @@ import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute @@ -28,7 +28,7 @@ import org.mockito.Mockito class QueueThreadTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var sp: SP @Mock lateinit var powerManager: PowerManager diff --git a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 7ff8da4c91..dc7e6d803b 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -34,7 +34,7 @@ import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.plugins.general.smsCommunicator.events.EventSmsCommunicatorUpdateGui @@ -71,7 +71,7 @@ class SmsCommunicatorPlugin @Inject constructor( private val smsManager: SmsManager?, private val aapsSchedulers: AapsSchedulers, private val sp: SP, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val rxBus: RxBus, private val profileFunction: ProfileFunction, private val fabricPrivacy: FabricPrivacy, diff --git a/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt index 0975a57510..b9083fcf9b 100644 --- a/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTe import info.nightscout.androidaps.database.transactions.Transaction import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore @@ -47,7 +47,7 @@ import org.mockito.invocation.InvocationOnMock class SmsCommunicatorPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var loop: Loop diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index 88609dbc9b..e5d6e3ddfd 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -19,7 +19,7 @@ import info.nightscout.androidaps.interfaces.PumpSync.TemporaryBasalType import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.utils.DateUtil @@ -42,7 +42,7 @@ class DanaRKoreanPlugin @Inject constructor( rxBus: RxBus, private val context: Context, rh: ResourceHelper, - constraintChecker: ConstraintChecker, + constraintChecker: Constraints, activePlugin: ActivePlugin, sp: SP, commandQueue: CommandQueue, diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 75c5ec5079..1327d5aa85 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -37,6 +37,7 @@ import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo; import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended; import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal; import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; +import info.nightscout.androidaps.interfaces.Constraints; import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.dialogs.BolusProgressDialog; @@ -50,7 +51,6 @@ import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.shared.logging.AAPSLogger; import info.nightscout.shared.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; @@ -64,7 +64,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { @Inject AAPSLogger aapsLogger; @Inject RxBus rxBus; @Inject ResourceHelper rh; - @Inject ConstraintChecker constraintChecker; + @Inject Constraints constraintChecker; @Inject DanaPump danaPump; @Inject DanaRPlugin danaRPlugin; @Inject DanaRKoreanPlugin danaRKoreanPlugin; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index 40e9688199..3bd6c48967 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -17,17 +17,16 @@ import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService; import info.nightscout.androidaps.danar.AbstractDanaRPlugin; import info.nightscout.androidaps.danar.R; import info.nightscout.androidaps.data.DetailedBolusInfo; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraint; +import info.nightscout.androidaps.interfaces.Constraints; +import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; +import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage; @@ -36,8 +35,9 @@ import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.Round; import info.nightscout.androidaps.utils.T; -import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.utils.rx.AapsSchedulers; +import info.nightscout.shared.logging.AAPSLogger; +import info.nightscout.shared.logging.LTag; import info.nightscout.shared.sharedPreferences.SP; import io.reactivex.rxjava3.disposables.CompositeDisposable; @@ -48,7 +48,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { private final AAPSLogger aapsLogger; private final Context context; private final ResourceHelper rh; - private final ConstraintChecker constraintChecker; + private final Constraints constraintChecker; private final DetailedBolusInfoStorage detailedBolusInfoStorage; private final TemporaryBasalStorage temporaryBasalStorage; private final FabricPrivacy fabricPrivacy; @@ -63,7 +63,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { RxBus rxBus, Context context, ResourceHelper rh, - ConstraintChecker constraintChecker, + Constraints constraintChecker, ActivePlugin activePlugin, SP sp, CommandQueue commandQueue, diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index 881eda371f..1be361b923 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -10,7 +10,6 @@ import info.nightscout.androidaps.dana.DanaFragment; import info.nightscout.androidaps.dana.DanaPump; import info.nightscout.androidaps.dana.comm.RecordTypes; import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventPreferenceChange; @@ -22,23 +21,23 @@ import info.nightscout.androidaps.interfaces.Constraints; import info.nightscout.androidaps.interfaces.Dana; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; -import info.nightscout.androidaps.interfaces.PumpDescription; +import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.Pump; +import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; +import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.common.ManufacturerType; -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.Round; -import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.utils.rx.AapsSchedulers; +import info.nightscout.shared.logging.AAPSLogger; +import info.nightscout.shared.logging.LTag; import info.nightscout.shared.sharedPreferences.SP; import io.reactivex.rxjava3.disposables.CompositeDisposable; @@ -55,7 +54,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump protected PumpDescription pumpDescription = new PumpDescription(); protected DanaPump danaPump; - protected ConstraintChecker constraintChecker; + protected Constraints constraintChecker; protected RxBus rxBus; protected ActivePlugin activePlugin; protected SP sp; @@ -67,7 +66,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump HasAndroidInjector injector, DanaPump danaPump, ResourceHelper rh, - ConstraintChecker constraintChecker, + Constraints constraintChecker, AAPSLogger aapsLogger, AapsSchedulers aapsSchedulers, CommandQueue commandQueue, diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 883572425e..bf86382b95 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -21,20 +21,20 @@ import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraint; +import info.nightscout.androidaps.interfaces.Constraints; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; +import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.Round; -import info.nightscout.androidaps.interfaces.ResourceHelper; import info.nightscout.androidaps.utils.rx.AapsSchedulers; +import info.nightscout.shared.logging.AAPSLogger; +import info.nightscout.shared.logging.LTag; import info.nightscout.shared.sharedPreferences.SP; import io.reactivex.rxjava3.disposables.CompositeDisposable; @@ -45,7 +45,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { private final AAPSLogger aapsLogger; private final Context context; private final ResourceHelper rh; - private final ConstraintChecker constraintChecker; + private final Constraints constraints; private final FabricPrivacy fabricPrivacy; @Inject @@ -56,7 +56,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { RxBus rxBus, Context context, ResourceHelper rh, - ConstraintChecker constraintChecker, + Constraints constraints, ActivePlugin activePlugin, SP sp, CommandQueue commandQueue, @@ -65,11 +65,11 @@ public class DanaRPlugin extends AbstractDanaRPlugin { FabricPrivacy fabricPrivacy, PumpSync pumpSync ) { - super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync); + super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync); this.aapsLogger = aapsLogger; this.context = context; this.rh = rh; - this.constraintChecker = constraintChecker; + this.constraints = constraints; this.fabricPrivacy = fabricPrivacy; useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); @@ -159,7 +159,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { @NonNull @Override public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { - detailedBolusInfo.insulin = constraintChecker.applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value(); + detailedBolusInfo.insulin = constraints.applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value(); if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) { EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId()); boolean connectionOK = false; @@ -207,7 +207,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { //This should not be needed while using queue because connection should be done before calling this PumpEnactResult result = new PumpEnactResult(getInjector()); - absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value(); + absoluteRate = constraints.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value(); boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d && absoluteRate >= 0.10d; final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d; @@ -217,8 +217,8 @@ public class DanaRPlugin extends AbstractDanaRPlugin { int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue(); // Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp. if (absoluteRate < 0.10d) percentRate = 0; - if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo((double) percentRate, 10d); - else percentRate = (int) Round.INSTANCE.floorTo((double) percentRate, 10d); + if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo(percentRate, 10d); + else percentRate = (int) Round.INSTANCE.floorTo(percentRate, 10d); if (percentRate > getPumpDescription().getMaxTempPercent()) { percentRate = getPumpDescription().getMaxTempPercent(); } @@ -286,7 +286,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { int durationInHalfHours = Math.max(durationInMinutes / 30, 1); // We keep current basal running so need to sub current basal double extendedRateToSet = absoluteRate - getBaseBasalRate(); - extendedRateToSet = constraintChecker.applyBasalConstraints(new Constraint<>(extendedRateToSet), profile).value(); + extendedRateToSet = constraints.applyBasalConstraints(new Constraint<>(extendedRateToSet), profile).value(); // needs to be rounded to 0.1 extendedRateToSet = Round.INSTANCE.roundTo(extendedRateToSet, pumpDescription.getExtendedBolusStep() * 2); // *2 because of half hours diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt index 491bb0b040..c59a6d7889 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.ConfigBuilder import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.androidaps.utils.CRC.getCrc16 @@ -46,7 +46,7 @@ open class MessageBase(injector: HasAndroidInjector) { @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Inject lateinit var temporaryBasalStorage: TemporaryBasalStorage - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var pumpSync: PumpSync @Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index 16bbb9112c..e56c04020d 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -21,7 +21,7 @@ import org.mockito.Mockito.`when` class DanaRPluginTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var pumpSync: PumpSync diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 2f198bafb4..98f0b9c7ea 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -16,7 +16,7 @@ import info.nightscout.androidaps.interfaces.ConfigBuilder import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.interfaces.ResourceHelper @@ -41,7 +41,7 @@ open class DanaRTestBase : TestBase() { @Mock lateinit var configBuilder: ConfigBuilder @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var pumpSync: PumpSync @Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index 6db1382b3a..5cb2260983 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -21,7 +21,7 @@ import org.mockito.Mockito.`when` class DanaRKoreanPluginTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var pumpSync: PumpSync diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index c0fc30ac73..bd7e61a7fa 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.shared.sharedPreferences.SP @@ -22,7 +22,7 @@ import org.mockito.Mockito.`when` class DanaRv2PluginTest : TestBaseWithProfile() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 964fe05fb8..e7fdd5e579 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -24,7 +24,7 @@ import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.common.ManufacturerType -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress @@ -54,7 +54,7 @@ class DanaRSPlugin @Inject constructor( private val rxBus: RxBus, private val context: Context, rh: ResourceHelper, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val profileFunction: ProfileFunction, private val sp: SP, commandQueue: CommandQueue, diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSetStepBolusStart.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSetStepBolusStart.kt index 4e9dab3a54..14e84ac302 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSetStepBolusStart.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSetStepBolusStart.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.shared.logging.LTag -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danars.encryption.BleEncryption import javax.inject.Inject @@ -15,7 +15,7 @@ class DanaRSPacketBolusSetStepBolusStart( ) : DanaRSPacket(injector) { @Inject lateinit var danaPump: DanaPump - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_START diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt index 994a56b43e..b17b6d8f74 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt @@ -29,7 +29,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.notifications.Notification @@ -65,7 +65,7 @@ class DanaRSService : DaggerService() { @Inject lateinit var danaRSPlugin: DanaRSPlugin @Inject lateinit var danaPump: DanaPump @Inject lateinit var activePlugin: ActivePlugin - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var activityNames: ActivityNames @Inject lateinit var bleComm: BLEComm @Inject lateinit var fabricPrivacy: FabricPrivacy diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt index 550484e1e7..6dbc566fd5 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import org.junit.Assert @@ -21,7 +21,7 @@ import org.mockito.Mockito class DanaRSPluginTest : DanaRSTestBase() { @Mock lateinit var context: Context - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt index 4fc446bd31..bf0e31b6a4 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.danars.encryption.BleEncryption import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import org.junit.Assert import org.junit.Test import org.mockito.Mock @@ -16,7 +16,7 @@ import org.mockito.Mockito.`when` class DanaRsMessageHashTableTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index ab385d84f3..cfdd79d1b2 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import org.junit.Assert @@ -19,7 +19,7 @@ import org.mockito.Mockito class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var context: Context @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index 61f6ac97a0..bf58a52435 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage @@ -22,7 +22,7 @@ import org.mockito.Mockito.`when` class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin - @Mock lateinit var constraintChecker: ConstraintChecker + @Mock lateinit var constraintChecker: Constraints @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var context: Context @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt index d6f144209b..b86b17a8dd 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt @@ -20,7 +20,7 @@ import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.common.ManufacturerType -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification @@ -51,7 +51,7 @@ class DiaconnG8Plugin @Inject constructor( private val rxBus: RxBus, private val context: Context, rh: ResourceHelper, - private val constraintChecker: ConstraintChecker, + private val constraintChecker: Constraints, private val profileFunction: ProfileFunction, private val sp: SP, commandQueue: CommandQueue, diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt index 1dd284d41c..4a1fa6dd66 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt @@ -59,7 +59,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.notifications.Notification @@ -96,7 +96,7 @@ class DiaconnG8Service : DaggerService() { @Inject lateinit var diaconnG8Plugin: DiaconnG8Plugin @Inject lateinit var diaconnG8Pump: DiaconnG8Pump @Inject lateinit var activePlugin: ActivePlugin - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Inject lateinit var bleCommonService: BLECommonService @Inject lateinit var fabricPrivacy: FabricPrivacy diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt index 2bae95c60c..2dbe5511ad 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt @@ -28,7 +28,7 @@ import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.DecimalFormatter @@ -54,7 +54,7 @@ class CarbsDialog : DialogFragmentWithDate() { @Inject lateinit var ctx: Context @Inject lateinit var rh: ResourceHelper - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var iobCobCalculator: IobCobCalculator diff --git a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt index 195a1f88a3..2cdef86ef5 100644 --- a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt +++ b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt @@ -29,7 +29,7 @@ import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.VariableSensitivityResult -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DateUtil @@ -60,7 +60,7 @@ class Widget : AppWidgetProvider() { @Inject lateinit var loop: Loop @Inject lateinit var config: Config @Inject lateinit var sp: SP - @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var constraintChecker: Constraints companion object { // This object doesn't behave like singleton,