:plugins:aps cleanup
This commit is contained in:
parent
12c3c664b7
commit
8bf9e83948
|
@ -112,7 +112,7 @@
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Receive ignore 5m, 15m, 30m requests for carb notifications -->
|
<!-- Receive ignore 5m, 15m, 30m requests for carb notifications -->
|
||||||
<receiver android:name="info.nightscout.plugins.aps.loop.CarbSuggestionReceiver" />
|
<receiver android:name="app.aaps.plugins.aps.loop.CarbSuggestionReceiver" />
|
||||||
|
|
||||||
<!-- Auto start -->
|
<!-- Auto start -->
|
||||||
<receiver
|
<receiver
|
||||||
|
|
|
@ -35,6 +35,7 @@ import app.aaps.implementation.db.CompatDBHelper
|
||||||
import app.aaps.implementation.lifecycle.ProcessLifecycleListener
|
import app.aaps.implementation.lifecycle.ProcessLifecycleListener
|
||||||
import app.aaps.implementation.plugin.PluginStore
|
import app.aaps.implementation.plugin.PluginStore
|
||||||
import app.aaps.implementation.receivers.NetworkChangeReceiver
|
import app.aaps.implementation.receivers.NetworkChangeReceiver
|
||||||
|
import app.aaps.plugins.aps.utils.StaticInjector
|
||||||
import app.aaps.receivers.BTReceiver
|
import app.aaps.receivers.BTReceiver
|
||||||
import app.aaps.receivers.ChargingStateReceiver
|
import app.aaps.receivers.ChargingStateReceiver
|
||||||
import app.aaps.receivers.KeepAliveWorker
|
import app.aaps.receivers.KeepAliveWorker
|
||||||
|
@ -46,7 +47,6 @@ import info.nightscout.androidaps.R
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.database.impl.transactions.VersionChangeTransaction
|
import info.nightscout.database.impl.transactions.VersionChangeTransaction
|
||||||
import info.nightscout.plugins.aps.utils.StaticInjector
|
|
||||||
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
||||||
import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
|
import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
|
||||||
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
||||||
|
|
|
@ -33,6 +33,11 @@ import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.utils.SafeParse
|
import app.aaps.core.interfaces.utils.SafeParse
|
||||||
import app.aaps.core.ui.dialogs.OKDialog
|
import app.aaps.core.ui.dialogs.OKDialog
|
||||||
import app.aaps.implementation.plugin.PluginStore
|
import app.aaps.implementation.plugin.PluginStore
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotunePlugin
|
||||||
|
import app.aaps.plugins.aps.loop.LoopPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
||||||
import dagger.android.support.AndroidSupportInjection
|
import dagger.android.support.AndroidSupportInjection
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||||
|
@ -43,12 +48,7 @@ import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
||||||
import info.nightscout.automation.AutomationPlugin
|
import info.nightscout.automation.AutomationPlugin
|
||||||
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
||||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
|
||||||
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.plugins.general.autotune.AutotunePlugin
|
|
||||||
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
import info.nightscout.plugins.general.wear.WearPlugin
|
import info.nightscout.plugins.general.wear.WearPlugin
|
||||||
import info.nightscout.plugins.sync.nsclient.NSClientPlugin
|
import info.nightscout.plugins.sync.nsclient.NSClientPlugin
|
||||||
|
|
|
@ -5,6 +5,7 @@ import app.aaps.configuration.di.ConfigurationModule
|
||||||
import app.aaps.core.main.di.CoreModule
|
import app.aaps.core.main.di.CoreModule
|
||||||
import app.aaps.core.validators.di.ValidatorsModule
|
import app.aaps.core.validators.di.ValidatorsModule
|
||||||
import app.aaps.implementation.di.ImplementationModule
|
import app.aaps.implementation.di.ImplementationModule
|
||||||
|
import app.aaps.plugins.aps.di.ApsModule
|
||||||
import app.aaps.shared.impl.di.SharedImplModule
|
import app.aaps.shared.impl.di.SharedImplModule
|
||||||
import dagger.BindsInstance
|
import dagger.BindsInstance
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
|
@ -21,7 +22,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
|
||||||
import info.nightscout.automation.di.AutomationModule
|
import info.nightscout.automation.di.AutomationModule
|
||||||
import info.nightscout.database.impl.DatabaseModule
|
import info.nightscout.database.impl.DatabaseModule
|
||||||
import info.nightscout.insulin.di.InsulinModule
|
import info.nightscout.insulin.di.InsulinModule
|
||||||
import info.nightscout.plugins.aps.di.ApsModule
|
|
||||||
import info.nightscout.plugins.constraints.di.PluginsConstraintsModule
|
import info.nightscout.plugins.constraints.di.PluginsConstraintsModule
|
||||||
import info.nightscout.plugins.di.PluginsModule
|
import info.nightscout.plugins.di.PluginsModule
|
||||||
import info.nightscout.plugins.sync.di.OpenHumansModule
|
import info.nightscout.plugins.sync.di.OpenHumansModule
|
||||||
|
|
|
@ -3,6 +3,11 @@ package app.aaps.di
|
||||||
import app.aaps.configuration.configBuilder.ConfigBuilderPlugin
|
import app.aaps.configuration.configBuilder.ConfigBuilderPlugin
|
||||||
import app.aaps.configuration.maintenance.MaintenancePlugin
|
import app.aaps.configuration.maintenance.MaintenancePlugin
|
||||||
import app.aaps.core.interfaces.plugin.PluginBase
|
import app.aaps.core.interfaces.plugin.PluginBase
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotunePlugin
|
||||||
|
import app.aaps.plugins.aps.loop.LoopPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.multibindings.IntKey
|
import dagger.multibindings.IntKey
|
||||||
|
@ -20,16 +25,11 @@ import info.nightscout.insulin.InsulinLyumjevPlugin
|
||||||
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
||||||
import info.nightscout.insulin.InsulinOrefRapidActingPlugin
|
import info.nightscout.insulin.InsulinOrefRapidActingPlugin
|
||||||
import info.nightscout.insulin.InsulinOrefUltraRapidActingPlugin
|
import info.nightscout.insulin.InsulinOrefUltraRapidActingPlugin
|
||||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
|
||||||
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||||
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
|
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
||||||
import info.nightscout.plugins.general.actions.ActionsPlugin
|
import info.nightscout.plugins.general.actions.ActionsPlugin
|
||||||
import info.nightscout.plugins.general.autotune.AutotunePlugin
|
|
||||||
import info.nightscout.plugins.general.food.FoodPlugin
|
import info.nightscout.plugins.general.food.FoodPlugin
|
||||||
import info.nightscout.plugins.general.overview.OverviewPlugin
|
import info.nightscout.plugins.general.overview.OverviewPlugin
|
||||||
import info.nightscout.plugins.general.persistentNotification.PersistentNotificationPlugin
|
import info.nightscout.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||||
|
|
|
@ -6,9 +6,9 @@ import app.aaps.core.interfaces.objects.Instantiator
|
||||||
import app.aaps.core.interfaces.profile.ProfileStore
|
import app.aaps.core.interfaces.profile.ProfileStore
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.implementation.profile.ProfileStoreObject
|
import app.aaps.implementation.profile.ProfileStoreObject
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
import dagger.Reusable
|
import dagger.Reusable
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject
|
import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -2,11 +2,11 @@ package app.aaps.interfaces.pump
|
||||||
|
|
||||||
import app.aaps.core.interfaces.pump.PumpEnactResult
|
import app.aaps.core.interfaces.pump.PumpEnactResult
|
||||||
import app.aaps.core.main.pump.toHtml
|
import app.aaps.core.main.pump.toHtml
|
||||||
|
import app.aaps.plugins.aps.loop.extensions.json
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.loop.extensions.json
|
|
||||||
import info.nightscout.pump.virtual.extensions.toText
|
import info.nightscout.pump.virtual.extensions.toText
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
|
|
|
@ -10,8 +10,9 @@ apply from: "${project.rootDir}/core/main/android_module_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
|
apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
|
apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
|
apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'info.nightscout.plugins.aps'
|
namespace 'app.aaps.plugins.aps'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package info.nightscout.plugins.aps.di
|
|
||||||
|
|
||||||
import dagger.Module
|
|
||||||
import dagger.android.ContributesAndroidInjector
|
|
||||||
|
|
||||||
@Module
|
|
||||||
@Suppress("unused")
|
|
||||||
abstract class AlgModule {
|
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun loggerCallbackInjector(): info.nightscout.plugins.aps.logger.LoggerCallback
|
|
||||||
@ContributesAndroidInjector abstract fun determineBasalResultSMBInjector(): info.nightscout.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
|
||||||
@ContributesAndroidInjector abstract fun determineBasalResultAMAInjector(): info.nightscout.plugins.aps.openAPSAMA.DetermineBasalResultAMA
|
|
||||||
@ContributesAndroidInjector abstract fun determineBasalAdapterAMAJSInjector(): info.nightscout.plugins.aps.openAPSAMA.DetermineBasalAdapterAMAJS
|
|
||||||
@ContributesAndroidInjector abstract fun determineBasalAdapterSMBJSInjector(): info.nightscout.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
|
|
||||||
@ContributesAndroidInjector abstract fun determineBasalAdapterSMBAutoISFJSInjector(): info.nightscout.plugins.aps.openAPSSMBDynamicISF.DetermineBasalAdapterSMBDynamicISFJS
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps
|
package app.aaps.plugins.aps
|
||||||
|
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import app.aaps.core.interfaces.aps.APSResult
|
import app.aaps.core.interfaces.aps.APSResult
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps
|
package app.aaps.plugins.aps
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -13,7 +13,6 @@ import android.view.ViewGroup
|
||||||
import androidx.core.view.MenuCompat
|
import androidx.core.view.MenuCompat
|
||||||
import androidx.core.view.MenuProvider
|
import androidx.core.view.MenuProvider
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
|
||||||
import app.aaps.core.interfaces.aps.AutosensResult
|
import app.aaps.core.interfaces.aps.AutosensResult
|
||||||
import app.aaps.core.interfaces.logging.AAPSLogger
|
import app.aaps.core.interfaces.logging.AAPSLogger
|
||||||
import app.aaps.core.interfaces.logging.LTag
|
import app.aaps.core.interfaces.logging.LTag
|
||||||
|
@ -22,11 +21,12 @@ import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.rx.AapsSchedulers
|
import app.aaps.core.interfaces.rx.AapsSchedulers
|
||||||
import app.aaps.core.interfaces.rx.bus.RxBus
|
import app.aaps.core.interfaces.rx.bus.RxBus
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
|
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
||||||
|
import app.aaps.plugins.aps.databinding.OpenapsFragmentBinding
|
||||||
|
import app.aaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||||
|
import app.aaps.plugins.aps.events.EventResetOpenAPSGui
|
||||||
|
import app.aaps.plugins.aps.utils.JSONFormatter
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.plugins.aps.databinding.OpenapsFragmentBinding
|
|
||||||
import info.nightscout.plugins.aps.events.EventOpenAPSUpdateGui
|
|
||||||
import info.nightscout.plugins.aps.events.EventResetOpenAPSGui
|
|
||||||
import info.nightscout.plugins.aps.utils.JSONFormatter
|
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.utils.Round
|
import app.aaps.core.interfaces.utils.Round
|
||||||
import app.aaps.core.utils.Percentile
|
import app.aaps.core.utils.Percentile
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
import info.nightscout.plugins.general.autotune.data.LocalInsulin
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.annotations.OpenForTesting
|
import app.aaps.annotations.OpenForTesting
|
||||||
import app.aaps.core.interfaces.logging.LoggerUtils
|
import app.aaps.core.interfaces.logging.LoggerUtils
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import java.io.BufferedInputStream
|
import java.io.BufferedInputStream
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
|
@ -43,13 +43,13 @@ import app.aaps.core.ui.dialogs.OKDialog
|
||||||
import app.aaps.core.ui.elements.WeekDay
|
import app.aaps.core.ui.elements.WeekDay
|
||||||
import app.aaps.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import app.aaps.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
|
import app.aaps.plugins.aps.autotune.events.EventAutotuneUpdateGui
|
||||||
|
import app.aaps.plugins.aps.databinding.AutotuneFragmentBinding
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.databinding.AutotuneFragmentBinding
|
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
|
||||||
import info.nightscout.plugins.general.autotune.data.LocalInsulin
|
|
||||||
import info.nightscout.plugins.general.autotune.events.EventAutotuneUpdateGui
|
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.core.interfaces.configuration.Constants
|
import app.aaps.core.interfaces.configuration.Constants
|
||||||
import app.aaps.core.interfaces.iob.Iob
|
import app.aaps.core.interfaces.iob.Iob
|
||||||
|
@ -24,9 +24,9 @@ import app.aaps.database.entities.GlucoseValue
|
||||||
import app.aaps.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import app.aaps.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import app.aaps.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
|
||||||
import info.nightscout.plugins.general.autotune.data.LocalInsulin
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -1,6 +1,6 @@
|
||||||
@file:Suppress("SpellCheckingInspection")
|
@file:Suppress("SpellCheckingInspection")
|
||||||
|
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import app.aaps.core.interfaces.autotune.Autotune
|
import app.aaps.core.interfaces.autotune.Autotune
|
||||||
|
@ -29,12 +29,12 @@ import app.aaps.core.ui.elements.WeekDay
|
||||||
import app.aaps.core.utils.JsonHelper
|
import app.aaps.core.utils.JsonHelper
|
||||||
import app.aaps.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import app.aaps.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
|
import app.aaps.plugins.aps.autotune.events.EventAutotuneUpdateGui
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
|
||||||
import info.nightscout.plugins.general.autotune.data.LocalInsulin
|
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
|
||||||
import info.nightscout.plugins.general.autotune.events.EventAutotuneUpdateGui
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
|
@ -8,13 +8,13 @@ import app.aaps.core.interfaces.utils.T
|
||||||
import app.aaps.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import app.aaps.database.entities.Carbs
|
import app.aaps.database.entities.Carbs
|
||||||
import app.aaps.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
import info.nightscout.plugins.general.autotune.data.BGDatum
|
import app.aaps.plugins.aps.autotune.data.BGDatum
|
||||||
import info.nightscout.plugins.general.autotune.data.CRDatum
|
import app.aaps.plugins.aps.autotune.data.CRDatum
|
||||||
import info.nightscout.plugins.general.autotune.data.DiaDeviation
|
import app.aaps.plugins.aps.autotune.data.DiaDeviation
|
||||||
import info.nightscout.plugins.general.autotune.data.LocalInsulin
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
import info.nightscout.plugins.general.autotune.data.PeakDeviation
|
import app.aaps.plugins.aps.autotune.data.PeakDeviation
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import app.aaps.core.interfaces.configuration.Config
|
import app.aaps.core.interfaces.configuration.Config
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import app.aaps.core.interfaces.iob.Iob
|
import app.aaps.core.interfaces.iob.Iob
|
||||||
import app.aaps.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.data
|
package app.aaps.plugins.aps.autotune.data
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune.events
|
package app.aaps.plugins.aps.autotune.events
|
||||||
|
|
||||||
import app.aaps.core.interfaces.rx.events.Event
|
import app.aaps.core.interfaces.rx.events.Event
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package app.aaps.plugins.aps.di
|
||||||
|
|
||||||
|
import app.aaps.plugins.aps.logger.LoggerCallback
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.DetermineBasalAdapterAMAJS
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
||||||
|
import app.aaps.plugins.aps.openAPSSMBDynamicISF.DetermineBasalAdapterSMBDynamicISFJS
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@Suppress("unused")
|
||||||
|
abstract class AlgModule {
|
||||||
|
|
||||||
|
@ContributesAndroidInjector abstract fun loggerCallbackInjector(): LoggerCallback
|
||||||
|
@ContributesAndroidInjector abstract fun determineBasalResultSMBInjector(): DetermineBasalResultSMB
|
||||||
|
@ContributesAndroidInjector abstract fun determineBasalResultAMAInjector(): DetermineBasalResultAMA
|
||||||
|
@ContributesAndroidInjector abstract fun determineBasalAdapterAMAJSInjector(): DetermineBasalAdapterAMAJS
|
||||||
|
@ContributesAndroidInjector abstract fun determineBasalAdapterSMBJSInjector(): DetermineBasalAdapterSMBJS
|
||||||
|
@ContributesAndroidInjector abstract fun determineBasalAdapterSMBAutoISFJSInjector(): DetermineBasalAdapterSMBDynamicISFJS
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
package info.nightscout.plugins.aps.di
|
package app.aaps.plugins.aps.di
|
||||||
|
|
||||||
import app.aaps.core.interfaces.aps.Loop
|
import app.aaps.core.interfaces.aps.Loop
|
||||||
import app.aaps.core.interfaces.autotune.Autotune
|
import app.aaps.core.interfaces.autotune.Autotune
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
|
import app.aaps.plugins.aps.OpenAPSFragment
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotunePlugin
|
||||||
|
import app.aaps.plugins.aps.loop.LoopPlugin
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import info.nightscout.plugins.aps.OpenAPSFragment
|
|
||||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
|
||||||
import info.nightscout.plugins.general.autotune.AutotunePlugin
|
|
||||||
|
|
||||||
@Module(
|
@Module(
|
||||||
includes = [
|
includes = [
|
|
@ -1,22 +1,30 @@
|
||||||
package info.nightscout.plugins.aps.di
|
package app.aaps.plugins.aps.di
|
||||||
|
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotuneCore
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotuneFS
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotuneFragment
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotuneIob
|
||||||
|
import app.aaps.plugins.aps.autotune.AutotunePrep
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.BGDatum
|
||||||
|
import app.aaps.plugins.aps.autotune.data.CRDatum
|
||||||
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
abstract class AutotuneModule {
|
abstract class AutotuneModule {
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesAutotuneFragment(): info.nightscout.plugins.general.autotune.AutotuneFragment
|
@ContributesAndroidInjector abstract fun contributesAutotuneFragment(): AutotuneFragment
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun autoTunePrepInjector(): info.nightscout.plugins.general.autotune.AutotunePrep
|
@ContributesAndroidInjector abstract fun autoTunePrepInjector(): AutotunePrep
|
||||||
@ContributesAndroidInjector abstract fun autoTuneIobInjector(): info.nightscout.plugins.general.autotune.AutotuneIob
|
@ContributesAndroidInjector abstract fun autoTuneIobInjector(): AutotuneIob
|
||||||
@ContributesAndroidInjector abstract fun autoTuneCoreInjector(): info.nightscout.plugins.general.autotune.AutotuneCore
|
@ContributesAndroidInjector abstract fun autoTuneCoreInjector(): AutotuneCore
|
||||||
@ContributesAndroidInjector abstract fun autoTuneFSInjector(): info.nightscout.plugins.general.autotune.AutotuneFS
|
@ContributesAndroidInjector abstract fun autoTuneFSInjector(): AutotuneFS
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun autoTuneATProfileInjector(): info.nightscout.plugins.general.autotune.data.ATProfile
|
@ContributesAndroidInjector abstract fun autoTuneATProfileInjector(): ATProfile
|
||||||
@ContributesAndroidInjector abstract fun autoTuneBGDatumInjector(): info.nightscout.plugins.general.autotune.data.BGDatum
|
@ContributesAndroidInjector abstract fun autoTuneBGDatumInjector(): BGDatum
|
||||||
@ContributesAndroidInjector abstract fun autoTuneCRDatumInjector(): info.nightscout.plugins.general.autotune.data.CRDatum
|
@ContributesAndroidInjector abstract fun autoTuneCRDatumInjector(): CRDatum
|
||||||
@ContributesAndroidInjector abstract fun autoTunePreppedGlucoseInjector(): PreppedGlucose
|
@ContributesAndroidInjector abstract fun autoTunePreppedGlucoseInjector(): PreppedGlucose
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.plugins.aps.di
|
package app.aaps.plugins.aps.di
|
||||||
|
|
||||||
|
import app.aaps.plugins.aps.loop.CarbSuggestionReceiver
|
||||||
|
import app.aaps.plugins.aps.loop.LoopFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.plugins.aps.loop.CarbSuggestionReceiver
|
|
||||||
import info.nightscout.plugins.aps.loop.LoopFragment
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.events
|
package app.aaps.plugins.aps.events
|
||||||
|
|
||||||
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.events
|
package app.aaps.plugins.aps.events
|
||||||
|
|
||||||
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.plugins.aps.logger
|
package app.aaps.plugins.aps.logger
|
||||||
|
|
||||||
import app.aaps.core.interfaces.logging.AAPSLogger
|
import app.aaps.core.interfaces.logging.AAPSLogger
|
||||||
import app.aaps.core.interfaces.logging.LTag
|
import app.aaps.core.interfaces.logging.LTag
|
||||||
import info.nightscout.plugins.aps.utils.StaticInjector
|
import app.aaps.plugins.aps.utils.StaticInjector
|
||||||
import org.mozilla.javascript.ScriptableObject
|
import org.mozilla.javascript.ScriptableObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.loop
|
package app.aaps.plugins.aps.loop
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.loop
|
package app.aaps.plugins.aps.loop
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -25,11 +25,11 @@ import app.aaps.core.main.constraints.ConstraintObject
|
||||||
import app.aaps.core.main.pump.toHtml
|
import app.aaps.core.main.pump.toHtml
|
||||||
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
||||||
import app.aaps.core.utils.HtmlHelper
|
import app.aaps.core.utils.HtmlHelper
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.databinding.LoopFragmentBinding
|
||||||
|
import app.aaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.databinding.LoopFragmentBinding
|
|
||||||
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
|
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.loop
|
package app.aaps.plugins.aps.loop
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
|
@ -69,13 +69,13 @@ import app.aaps.database.entities.OfflineEvent
|
||||||
import app.aaps.database.entities.UserEntry.Action
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
import app.aaps.database.entities.UserEntry.Sources
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
import app.aaps.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||||
|
import app.aaps.plugins.aps.loop.extensions.json
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
|
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
|
||||||
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
|
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
|
|
||||||
import info.nightscout.plugins.aps.loop.extensions.json
|
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.loop.events
|
package app.aaps.plugins.aps.loop.events
|
||||||
|
|
||||||
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
import app.aaps.core.interfaces.rx.events.EventUpdateGui
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.loop.extensions
|
package app.aaps.plugins.aps.loop.extensions
|
||||||
|
|
||||||
import app.aaps.core.interfaces.pump.PumpEnactResult
|
import app.aaps.core.interfaces.pump.PumpEnactResult
|
||||||
import app.aaps.core.interfaces.utils.Round
|
import app.aaps.core.interfaces.utils.Round
|
|
@ -1,8 +1,5 @@
|
||||||
package info.nightscout.plugins.aps.openAPSAMA
|
package app.aaps.plugins.aps.openAPSAMA
|
||||||
|
|
||||||
import app.aaps.core.main.extensions.convertedToAbsolute
|
|
||||||
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
|
||||||
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
|
||||||
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
||||||
import app.aaps.core.interfaces.aps.SMBDefaults
|
import app.aaps.core.interfaces.aps.SMBDefaults
|
||||||
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
||||||
|
@ -16,11 +13,14 @@ import app.aaps.core.interfaces.logging.LTag
|
||||||
import app.aaps.core.interfaces.profile.Profile
|
import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.profile.ProfileFunction
|
import app.aaps.core.interfaces.profile.ProfileFunction
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
|
import app.aaps.core.main.extensions.convertedToAbsolute
|
||||||
|
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
||||||
|
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.logger.LoggerCallback
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.logger.LoggerCallback
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.plugins.aps.openAPSAMA
|
package app.aaps.plugins.aps.openAPSAMA
|
||||||
|
|
||||||
import app.aaps.core.interfaces.logging.LTag
|
import app.aaps.core.interfaces.logging.LTag
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.mozilla.javascript.NativeObject
|
import org.mozilla.javascript.NativeObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.openAPSAMA
|
package app.aaps.plugins.aps.openAPSAMA
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import app.aaps.annotations.OpenForTesting
|
import app.aaps.annotations.OpenForTesting
|
||||||
|
@ -30,13 +30,13 @@ import app.aaps.core.main.extensions.target
|
||||||
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
||||||
import app.aaps.core.utils.MidnightUtils
|
import app.aaps.core.utils.MidnightUtils
|
||||||
import app.aaps.database.ValueWrapper
|
import app.aaps.database.ValueWrapper
|
||||||
|
import app.aaps.plugins.aps.OpenAPSFragment
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||||
|
import app.aaps.plugins.aps.events.EventResetOpenAPSGui
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.aps.OpenAPSFragment
|
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.events.EventOpenAPSUpdateGui
|
|
||||||
import info.nightscout.plugins.aps.events.EventResetOpenAPSGui
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
|
@ -1,8 +1,5 @@
|
||||||
package info.nightscout.plugins.aps.openAPSSMB
|
package app.aaps.plugins.aps.openAPSSMB
|
||||||
|
|
||||||
import app.aaps.core.main.extensions.convertedToAbsolute
|
|
||||||
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
|
||||||
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
|
||||||
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
||||||
import app.aaps.core.interfaces.aps.SMBDefaults
|
import app.aaps.core.interfaces.aps.SMBDefaults
|
||||||
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
||||||
|
@ -18,11 +15,14 @@ import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.profile.ProfileFunction
|
import app.aaps.core.interfaces.profile.ProfileFunction
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.utils.SafeParse
|
import app.aaps.core.interfaces.utils.SafeParse
|
||||||
|
import app.aaps.core.main.extensions.convertedToAbsolute
|
||||||
|
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
||||||
|
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.logger.LoggerCallback
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.logger.LoggerCallback
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.plugins.aps.openAPSSMB
|
package app.aaps.plugins.aps.openAPSSMB
|
||||||
|
|
||||||
import app.aaps.core.interfaces.aps.VariableSensitivityResult
|
import app.aaps.core.interfaces.aps.VariableSensitivityResult
|
||||||
import app.aaps.core.interfaces.logging.LTag
|
import app.aaps.core.interfaces.logging.LTag
|
||||||
|
import app.aaps.plugins.aps.APSResultObject
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.APSResultObject
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.openAPSSMB
|
package app.aaps.plugins.aps.openAPSSMB
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
@ -33,11 +33,13 @@ import app.aaps.core.main.constraints.ConstraintObject
|
||||||
import app.aaps.core.main.extensions.target
|
import app.aaps.core.main.extensions.target
|
||||||
import app.aaps.core.utils.MidnightUtils
|
import app.aaps.core.utils.MidnightUtils
|
||||||
import app.aaps.database.ValueWrapper
|
import app.aaps.database.ValueWrapper
|
||||||
|
import app.aaps.plugins.aps.OpenAPSFragment
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||||
|
import app.aaps.plugins.aps.events.EventResetOpenAPSGui
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.events.EventResetOpenAPSGui
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
@ -64,7 +66,7 @@ open class OpenAPSSMBPlugin @Inject constructor(
|
||||||
) : PluginBase(
|
) : PluginBase(
|
||||||
PluginDescription()
|
PluginDescription()
|
||||||
.mainType(PluginType.APS)
|
.mainType(PluginType.APS)
|
||||||
.fragmentClass(info.nightscout.plugins.aps.OpenAPSFragment::class.java.name)
|
.fragmentClass(OpenAPSFragment::class.java.name)
|
||||||
.pluginIcon(app.aaps.core.ui.R.drawable.ic_generic_icon)
|
.pluginIcon(app.aaps.core.ui.R.drawable.ic_generic_icon)
|
||||||
.pluginName(R.string.openapssmb)
|
.pluginName(R.string.openapssmb)
|
||||||
.shortName(app.aaps.core.ui.R.string.smb_shortname)
|
.shortName(app.aaps.core.ui.R.string.smb_shortname)
|
||||||
|
@ -292,7 +294,7 @@ open class OpenAPSSMBPlugin @Inject constructor(
|
||||||
lastAPSRun = now
|
lastAPSRun = now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rxBus.send(info.nightscout.plugins.aps.events.EventOpenAPSUpdateGui())
|
rxBus.send(EventOpenAPSUpdateGui())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
override fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
|
@ -1,8 +1,5 @@
|
||||||
package info.nightscout.plugins.aps.openAPSSMBDynamicISF
|
package app.aaps.plugins.aps.openAPSSMBDynamicISF
|
||||||
|
|
||||||
import app.aaps.core.main.extensions.convertedToAbsolute
|
|
||||||
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
|
||||||
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
|
||||||
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
||||||
import app.aaps.core.interfaces.aps.SMBDefaults
|
import app.aaps.core.interfaces.aps.SMBDefaults
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
|
@ -19,11 +16,14 @@ import app.aaps.core.interfaces.profile.ProfileUtil
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.utils.Round
|
import app.aaps.core.interfaces.utils.Round
|
||||||
import app.aaps.core.interfaces.utils.SafeParse
|
import app.aaps.core.interfaces.utils.SafeParse
|
||||||
|
import app.aaps.core.main.extensions.convertedToAbsolute
|
||||||
|
import app.aaps.core.main.extensions.getPassedDurationToTimeInMinutes
|
||||||
|
import app.aaps.core.main.extensions.plannedRemainingMinutes
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.logger.LoggerCallback
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.logger.LoggerCallback
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.openAPSSMBDynamicISF
|
package app.aaps.plugins.aps.openAPSSMBDynamicISF
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import app.aaps.annotations.OpenForTesting
|
import app.aaps.annotations.OpenForTesting
|
||||||
|
@ -18,12 +18,12 @@ import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.stats.TddCalculator
|
import app.aaps.core.interfaces.stats.TddCalculator
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.HardLimits
|
import app.aaps.core.interfaces.utils.HardLimits
|
||||||
|
import app.aaps.plugins.aps.R
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
|
import app.aaps.plugins.aps.utils.ScriptReader
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.aps.R
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
|
||||||
import info.nightscout.plugins.aps.utils.ScriptReader
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.utils
|
package app.aaps.plugins.aps.utils
|
||||||
|
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import app.aaps.core.interfaces.logging.AAPSLogger
|
import app.aaps.core.interfaces.logging.AAPSLogger
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.utils
|
package app.aaps.plugins.aps.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.aps.utils
|
package app.aaps.plugins.aps.utils
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.plugins.general.autotune.AutotuneFragment">
|
tools:context=".autotune.AutotuneFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.profile.PureProfile
|
import app.aaps.core.interfaces.profile.PureProfile
|
||||||
|
@ -8,10 +8,11 @@ import app.aaps.core.main.profile.ProfileSealed
|
||||||
import app.aaps.core.utils.JsonHelper
|
import app.aaps.core.utils.JsonHelper
|
||||||
import app.aaps.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import app.aaps.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.plugins.general.autotune.data.ATProfile
|
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
|
@ -91,7 +92,7 @@ class AutotuneCoreTest : TestBaseWithProfile() {
|
||||||
val units = GlucoseUnit.fromText(txtUnits)
|
val units = GlucoseUnit.fromText(txtUnits)
|
||||||
val dia = JsonHelper.safeGetDoubleAllowNull(jsonObject, "dia") ?: return null
|
val dia = JsonHelper.safeGetDoubleAllowNull(jsonObject, "dia") ?: return null
|
||||||
val peak = JsonHelper.safeGetIntAllowNull(jsonObject, "insulinPeakTime") ?: return null
|
val peak = JsonHelper.safeGetIntAllowNull(jsonObject, "insulinPeakTime") ?: return null
|
||||||
val localInsulin = info.nightscout.plugins.general.autotune.data.LocalInsulin("insulin", peak, dia)
|
val localInsulin = LocalInsulin("insulin", peak, dia)
|
||||||
val timezone = TimeZone.getTimeZone(JsonHelper.safeGetString(jsonObject, "timezone", "UTC"))
|
val timezone = TimeZone.getTimeZone(JsonHelper.safeGetString(jsonObject, "timezone", "UTC"))
|
||||||
val isfJson = jsonObject.getJSONObject("isfProfile")
|
val isfJson = jsonObject.getJSONObject("isfProfile")
|
||||||
val isfBlocks = ArrayList<Block>(1).also {
|
val isfBlocks = ArrayList<Block>(1).also {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.iob.IobTotal
|
import app.aaps.core.interfaces.iob.IobTotal
|
||||||
|
@ -16,10 +16,12 @@ import app.aaps.database.entities.Carbs
|
||||||
import app.aaps.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import app.aaps.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import app.aaps.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
|
import app.aaps.plugins.aps.autotune.data.ATProfile
|
||||||
|
import app.aaps.plugins.aps.autotune.data.LocalInsulin
|
||||||
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
|
@ -149,7 +151,7 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
||||||
* OpenAPS profile for Autotune only have one ISF value and one IC value
|
* OpenAPS profile for Autotune only have one ISF value and one IC value
|
||||||
*/
|
*/
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
private fun atProfileFromOapsJson(jsonObject: JSONObject, dateUtil: DateUtil, defaultUnits: String? = null): info.nightscout.plugins.general.autotune.data.ATProfile? {
|
private fun atProfileFromOapsJson(jsonObject: JSONObject, dateUtil: DateUtil, defaultUnits: String? = null): ATProfile? {
|
||||||
try {
|
try {
|
||||||
min5mCarbImpact = JsonHelper.safeGetDoubleAllowNull(jsonObject, "min_5m_carbimpact") ?: return null
|
min5mCarbImpact = JsonHelper.safeGetDoubleAllowNull(jsonObject, "min_5m_carbimpact") ?: return null
|
||||||
autotuneMin = JsonHelper.safeGetDoubleAllowNull(jsonObject, "autosens_min") ?: return null
|
autotuneMin = JsonHelper.safeGetDoubleAllowNull(jsonObject, "autosens_min") ?: return null
|
||||||
|
@ -158,7 +160,7 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
||||||
val units = GlucoseUnit.fromText(txtUnits)
|
val units = GlucoseUnit.fromText(txtUnits)
|
||||||
val dia = JsonHelper.safeGetDoubleAllowNull(jsonObject, "dia") ?: return null
|
val dia = JsonHelper.safeGetDoubleAllowNull(jsonObject, "dia") ?: return null
|
||||||
val peak = JsonHelper.safeGetIntAllowNull(jsonObject, "insulinPeakTime") ?: return null
|
val peak = JsonHelper.safeGetIntAllowNull(jsonObject, "insulinPeakTime") ?: return null
|
||||||
val localInsulin = info.nightscout.plugins.general.autotune.data.LocalInsulin("insulin", peak, dia)
|
val localInsulin = LocalInsulin("insulin", peak, dia)
|
||||||
val timezone = TimeZone.getTimeZone(JsonHelper.safeGetString(jsonObject, "timezone", "UTC"))
|
val timezone = TimeZone.getTimeZone(JsonHelper.safeGetString(jsonObject, "timezone", "UTC"))
|
||||||
val isfJson = jsonObject.getJSONObject("isfProfile")
|
val isfJson = jsonObject.getJSONObject("isfProfile")
|
||||||
val isfBlocks = ArrayList<Block>(1).also {
|
val isfBlocks = ArrayList<Block>(1).also {
|
||||||
|
@ -186,7 +188,7 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
||||||
timeZone = timezone,
|
timeZone = timezone,
|
||||||
dia = dia
|
dia = dia
|
||||||
)
|
)
|
||||||
return info.nightscout.plugins.general.autotune.data.ATProfile(ProfileSealed.Pure(pure), localInsulin, profileInjector).also { it.dateUtil = dateUtil }
|
return ATProfile(ProfileSealed.Pure(pure), localInsulin, profileInjector).also { it.dateUtil = dateUtil }
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -296,7 +298,7 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
||||||
autotuneFS
|
autotuneFS
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun getIOB(time: Long, localInsulin: info.nightscout.plugins.general.autotune.data.LocalInsulin): IobTotal {
|
override fun getIOB(time: Long, localInsulin: LocalInsulin): IobTotal {
|
||||||
val bolusIob = IobTotal(time)
|
val bolusIob = IobTotal(time)
|
||||||
iobOapsCalculation.forEach {
|
iobOapsCalculation.forEach {
|
||||||
if (it.time == time)
|
if (it.time == time)
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.plugins.general.autotune
|
package app.aaps.plugins.aps.autotune
|
||||||
|
|
||||||
|
import app.aaps.plugins.aps.autotune.data.BGDatum
|
||||||
|
import app.aaps.plugins.aps.autotune.data.CRDatum
|
||||||
|
import app.aaps.plugins.aps.autotune.data.PreppedGlucose
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.plugins.general.autotune.data.BGDatum
|
|
||||||
import info.nightscout.plugins.general.autotune.data.CRDatum
|
|
||||||
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
|
@ -1,8 +1,7 @@
|
||||||
package info.nightscout.plugins.aps.loop
|
package app.aaps.plugins.aps.loop
|
||||||
|
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
|
||||||
import app.aaps.core.interfaces.aps.ApsMode
|
import app.aaps.core.interfaces.aps.ApsMode
|
||||||
import app.aaps.core.interfaces.configuration.Config
|
import app.aaps.core.interfaces.configuration.Config
|
||||||
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
||||||
|
@ -18,13 +17,14 @@ import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
|
import app.aaps.core.main.utils.fabric.FabricPrivacy
|
||||||
|
import app.aaps.core.nssdk.interfaces.RunningConfiguration
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||||
import app.aaps.core.nssdk.interfaces.RunningConfiguration
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -68,7 +68,7 @@ class LoopPluginTest : TestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun testPluginInterface() {
|
fun testPluginInterface() {
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.loop)).thenReturn("Loop")
|
`when`(rh.gs(app.aaps.core.ui.R.string.loop)).thenReturn("Loop")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.loop_shortname)).thenReturn("LOOP")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.loop_shortname)).thenReturn("LOOP")
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||||
val pumpDescription = PumpDescription()
|
val pumpDescription = PumpDescription()
|
||||||
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
||||||
|
@ -78,7 +78,7 @@ class LoopPluginTest : TestBase() {
|
||||||
assertThat(loopPlugin.nameShort).isEqualTo("LOOP")
|
assertThat(loopPlugin.nameShort).isEqualTo("LOOP")
|
||||||
assertThat(loopPlugin.hasFragment()).isTrue()
|
assertThat(loopPlugin.hasFragment()).isTrue()
|
||||||
assertThat(loopPlugin.showInList(PluginType.LOOP)).isTrue()
|
assertThat(loopPlugin.showInList(PluginType.LOOP)).isTrue()
|
||||||
assertThat(loopPlugin.preferencesId.toLong()).isEqualTo(info.nightscout.plugins.aps.R.xml.pref_loop.toLong())
|
assertThat(loopPlugin.preferencesId.toLong()).isEqualTo(app.aaps.plugins.aps.R.xml.pref_loop.toLong())
|
||||||
|
|
||||||
// Plugin is disabled by default
|
// Plugin is disabled by default
|
||||||
assertThat(loopPlugin.isEnabled()).isFalse()
|
assertThat(loopPlugin.isEnabled()).isFalse()
|
|
@ -18,6 +18,9 @@ import app.aaps.core.interfaces.queue.CommandQueue
|
||||||
import app.aaps.core.interfaces.stats.TddCalculator
|
import app.aaps.core.interfaces.stats.TddCalculator
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.implementation.iob.GlucoseStatusProviderImpl
|
import app.aaps.implementation.iob.GlucoseStatusProviderImpl
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
|
@ -28,9 +31,6 @@ import info.nightscout.androidaps.insight.database.InsightDatabaseDao
|
||||||
import info.nightscout.androidaps.insight.database.InsightDbHelper
|
import info.nightscout.androidaps.insight.database.InsightDbHelper
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
|
||||||
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
|
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective
|
import info.nightscout.plugins.constraints.objectives.objectives.Objective
|
||||||
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.plugins.constraints.safety.SafetyPlugin
|
||||||
|
@ -99,19 +99,19 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump")
|
`when`(rh.gs(app.aaps.core.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit")
|
||||||
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
|
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
||||||
|
@ -291,7 +291,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
fun isSMBModeEnabledTest() {
|
fun isSMBModeEnabledTest() {
|
||||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||||
objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0
|
objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0
|
||||||
`when`(sp.getBoolean(info.nightscout.plugins.aps.R.string.key_use_smb, false)).thenReturn(false)
|
`when`(sp.getBoolean(app.aaps.plugins.aps.R.string.key_use_smb, false)).thenReturn(false)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||||
// `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(true))
|
// `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(true))
|
||||||
val c = constraintChecker.isSMBModeEnabled()
|
val c = constraintChecker.isSMBModeEnabled()
|
||||||
|
@ -316,9 +316,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
// insightPlugin.setStatusResult(result);
|
// insightPlugin.setStatusResult(result);
|
||||||
|
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
|
@ -343,9 +343,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
// insightPlugin.setStatusResult(result);
|
// insightPlugin.setStatusResult(result);
|
||||||
|
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
|
@ -400,7 +400,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
fun iobAMAShouldBeLimited() {
|
fun iobAMAShouldBeLimited() {
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||||
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, true)
|
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, true)
|
||||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, false)
|
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, false)
|
||||||
|
@ -416,7 +416,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
fun iobSMBShouldBeLimited() {
|
fun iobSMBShouldBeLimited() {
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||||
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, false)
|
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, false)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.plugins.constraints.safety
|
package info.nightscout.plugins.constraints.safety
|
||||||
|
|
||||||
import app.aaps.core.main.constraints.ConstraintObject
|
|
||||||
import app.aaps.core.interfaces.aps.ApsMode
|
import app.aaps.core.interfaces.aps.ApsMode
|
||||||
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
||||||
import app.aaps.core.interfaces.constraints.Constraint
|
import app.aaps.core.interfaces.constraints.Constraint
|
||||||
|
@ -12,13 +11,14 @@ import app.aaps.core.interfaces.pump.defs.PumpDescription
|
||||||
import app.aaps.core.interfaces.stats.TddCalculator
|
import app.aaps.core.interfaces.stats.TddCalculator
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.core.interfaces.utils.HardLimits
|
import app.aaps.core.interfaces.utils.HardLimits
|
||||||
|
import app.aaps.core.main.constraints.ConstraintObject
|
||||||
|
import app.aaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
|
import app.aaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
import app.aaps.shared.tests.TestBaseWithProfile
|
import app.aaps.shared.tests.TestBaseWithProfile
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
|
||||||
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
|
||||||
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.source.GlimpPlugin
|
import info.nightscout.source.GlimpPlugin
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
|
@ -54,16 +54,16 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
`when`(rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
`when`(rh.gs(app.aaps.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.increasing_max_basal)).thenReturn("Increasing max basal value because setting is lower than your max basal in profile")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.increasing_max_basal)).thenReturn("Increasing max basal value because setting is lower than your max basal in profile")
|
||||||
`when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
|
`when`(rh.gs(app.aaps.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
|
||||||
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
|
`when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
|
||||||
|
@ -112,7 +112,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun notEnabledSMBInPreferencesDisablesSMB() {
|
fun notEnabledSMBInPreferencesDisablesSMB() {
|
||||||
`when`(sp.getBoolean(info.nightscout.plugins.aps.R.string.key_use_smb, false)).thenReturn(false)
|
`when`(sp.getBoolean(app.aaps.plugins.aps.R.string.key_use_smb, false)).thenReturn(false)
|
||||||
`when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(ConstraintObject(true, aapsLogger))
|
`when`(constraintChecker.isClosedLoopAllowed(anyObject())).thenReturn(ConstraintObject(true, aapsLogger))
|
||||||
val c = openAPSSMBPlugin.isSMBModeEnabled(ConstraintObject(true, aapsLogger))
|
val c = openAPSSMBPlugin.isSMBModeEnabled(ConstraintObject(true, aapsLogger))
|
||||||
assertThat(c.getReasons()).contains("SMB disabled in preferences")
|
assertThat(c.getReasons()).contains("SMB disabled in preferences")
|
||||||
|
@ -121,7 +121,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun openLoopPreventsSMB() {
|
fun openLoopPreventsSMB() {
|
||||||
`when`(sp.getBoolean(info.nightscout.plugins.aps.R.string.key_use_smb, false)).thenReturn(true)
|
`when`(sp.getBoolean(app.aaps.plugins.aps.R.string.key_use_smb, false)).thenReturn(true)
|
||||||
`when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(false, aapsLogger))
|
`when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(false, aapsLogger))
|
||||||
val c = safetyPlugin.isSMBModeEnabled(ConstraintObject(true, aapsLogger))
|
val c = safetyPlugin.isSMBModeEnabled(ConstraintObject(true, aapsLogger))
|
||||||
assertThat(c.getReasons()).contains("SMB not allowed in open loop mode")
|
assertThat(c.getReasons()).contains("SMB not allowed in open loop mode")
|
||||||
|
@ -138,9 +138,9 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun basalRateShouldBeLimited() {
|
fun basalRateShouldBeLimited() {
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||||
val c = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
val c = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
||||||
safetyPlugin.applyBasalConstraints(c, validProfile)
|
safetyPlugin.applyBasalConstraints(c, validProfile)
|
||||||
|
@ -167,9 +167,9 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
||||||
@Test
|
@Test
|
||||||
fun percentBasalRateShouldBeLimited() {
|
fun percentBasalRateShouldBeLimited() {
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||||
val i = ConstraintObject(Int.MAX_VALUE, aapsLogger)
|
val i = ConstraintObject(Int.MAX_VALUE, aapsLogger)
|
||||||
safetyPlugin.applyBasalPercentConstraints(i, validProfile)
|
safetyPlugin.applyBasalPercentConstraints(i, validProfile)
|
||||||
|
@ -190,9 +190,9 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
||||||
@Test
|
@Test
|
||||||
fun percentBasalShouldBeLimitedBySMB() {
|
fun percentBasalShouldBeLimitedBySMB() {
|
||||||
// No limit by default
|
// No limit by default
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||||
val i = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
val i = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
||||||
|
@ -273,8 +273,8 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
||||||
//`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true)
|
//`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true)
|
||||||
//`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false)
|
//`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
||||||
`when`(sp.getDouble(info.nightscout.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
|
|
Loading…
Reference in a new issue