Loop cleanup
This commit is contained in:
parent
5529f1120c
commit
85140a9c2e
41 changed files with 260 additions and 256 deletions
|
@ -34,15 +34,10 @@ import info.nightscout.androidaps.databinding.ActivityMainBinding
|
|||
import info.nightscout.androidaps.events.EventAppExit
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.IconsProvider
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
||||
|
@ -78,7 +73,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var versionCheckerUtils: VersionCheckerUtils
|
||||
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var nsSettingsStatus: NSSettingsStatus
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
|
@ -124,7 +119,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
|||
})
|
||||
|
||||
//Check here if loop plugin is disabled. Else check via constraints
|
||||
if (!loopPlugin.isEnabled()) versionCheckerUtils.triggerCheckVersion()
|
||||
if (!(loop as PluginBase).isEnabled()) versionCheckerUtils.triggerCheckVersion()
|
||||
setUserStats()
|
||||
setupViews()
|
||||
disposable += rxBus
|
||||
|
|
|
@ -20,10 +20,10 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
|||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewData
|
||||
|
@ -64,7 +64,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var overviewMenus: OverviewMenus
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var nsDeviceStatus: NSDeviceStatus
|
||||
@Inject lateinit var translator: Translator
|
||||
|
||||
|
@ -90,7 +90,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
// We don't want to use injected singletons but own instance working on top of different data
|
||||
iobCobCalculator = IobCobCalculatorPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, rh, profileFunction, activePlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy, dateUtil, repository)
|
||||
overviewData = OverviewData(injector, aapsLogger, rh, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loopPlugin, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
|
||||
overviewData = OverviewData(injector, aapsLogger, rh, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loop, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
|
||||
|
||||
binding.left.setOnClickListener {
|
||||
adjustTimeRange(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
|
||||
|
|
|
@ -29,7 +29,6 @@ import info.nightscout.androidaps.interfaces.*
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||
|
@ -54,7 +53,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var commandQueue: CommandQueue
|
||||
|
@ -171,7 +170,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewPump.visibility = View.GONE
|
||||
}
|
||||
|
||||
loopPlugin.isDisconnected -> {
|
||||
loop.isDisconnected -> {
|
||||
binding.overviewLoop.visibility = View.GONE
|
||||
binding.overviewSuspend.visibility = View.GONE
|
||||
binding.overviewPump.visibility = View.VISIBLE
|
||||
|
@ -180,7 +179,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewReconnect.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
!loopPlugin.isEnabled() -> {
|
||||
!(loop as PluginBase).isEnabled() -> {
|
||||
binding.overviewLoop.visibility = View.VISIBLE
|
||||
binding.overviewEnable.visibility = View.VISIBLE
|
||||
binding.overviewDisable.visibility = View.GONE
|
||||
|
@ -189,7 +188,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewReconnect.visibility = View.GONE
|
||||
}
|
||||
|
||||
loopPlugin.isSuspended -> {
|
||||
loop.isSuspended -> {
|
||||
binding.overviewLoop.visibility = View.GONE
|
||||
binding.overviewSuspend.visibility = View.VISIBLE
|
||||
binding.overviewSuspendHeader.text = rh.gs(R.string.resumeloop)
|
||||
|
@ -295,8 +294,8 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disable -> {
|
||||
uel.log(Action.LOOP_DISABLED, Sources.LoopDialog)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
|
||||
(loop as PluginBase).setPluginEnabled(PluginType.LOOP, false)
|
||||
(loop as PluginBase).setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilder.storeSettings("DisablingLoop")
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -318,8 +317,8 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_enable -> {
|
||||
uel.log(Action.LOOP_ENABLED, Sources.LoopDialog)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
(loop as PluginBase).setPluginEnabled(PluginType.LOOP, true)
|
||||
(loop as PluginBase).setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilder.storeSettings("EnablingLoop")
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
|
||||
|
@ -353,28 +352,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_suspend_1h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
loopPlugin.suspendLoop(T.hours(1).mins().toInt())
|
||||
loop.suspendLoop(T.hours(1).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
loopPlugin.suspendLoop(T.hours(2).mins().toInt())
|
||||
loop.suspendLoop(T.hours(2).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
loopPlugin.suspendLoop(T.hours(3).mins().toInt())
|
||||
loop.suspendLoop(T.hours(3).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(10))
|
||||
loopPlugin.suspendLoop(T.hours(10).mins().toInt())
|
||||
loop.suspendLoop(T.hours(10).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
@ -382,7 +381,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
R.id.overview_disconnect_15m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(15))
|
||||
loopPlugin.goToZeroTemp(T.mins(15).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
loop.goToZeroTemp(T.mins(15).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
|
@ -391,7 +390,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
R.id.overview_disconnect_30m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(30))
|
||||
loopPlugin.goToZeroTemp(T.mins(30).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
loop.goToZeroTemp(T.mins(30).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
|
@ -400,7 +399,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
R.id.overview_disconnect_1h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
loop.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
|
||||
|
@ -410,7 +409,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
R.id.overview_disconnect_2h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
loopPlugin.goToZeroTemp(T.hours(2).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
loop.goToZeroTemp(T.hours(2).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
|
@ -419,7 +418,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
R.id.overview_disconnect_3h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
loopPlugin.goToZeroTemp(T.hours(3).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
loop.goToZeroTemp(T.hours(3).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -3,13 +3,15 @@ package info.nightscout.androidaps.plugins.aps.loop
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import dagger.android.DaggerBroadcastReceiver
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import javax.inject.Inject
|
||||
|
||||
class CarbSuggestionReceiver : DaggerBroadcastReceiver() {
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
super.onReceive(context, intent)
|
||||
val duration = intent.getIntExtra("ignoreDuration", 5)
|
||||
loopPlugin.disableCarbSuggestions(duration)
|
||||
loop.disableCarbSuggestions(duration)
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.LoopFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
|
@ -30,7 +31,7 @@ class LoopFragment : DaggerFragment() {
|
|||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
@ -52,7 +53,7 @@ class LoopFragment : DaggerFragment() {
|
|||
|
||||
binding.run.setOnClickListener {
|
||||
binding.lastrun.text = rh.gs(R.string.executing)
|
||||
Thread { loopPlugin.invoke("Loop button", true) }.start()
|
||||
Thread { loop.invoke("Loop button", true) }.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +94,7 @@ class LoopFragment : DaggerFragment() {
|
|||
@Synchronized
|
||||
fun updateGUI() {
|
||||
if (_binding == null) return
|
||||
loopPlugin.lastRun?.let {
|
||||
loop.lastRun?.let {
|
||||
binding.request.text = it.request?.toSpanned() ?: ""
|
||||
binding.constraintsprocessed.text = it.constraintsProcessed?.toSpanned() ?: ""
|
||||
binding.source.text = it.source ?: ""
|
||||
|
|
|
@ -175,7 +175,7 @@ class LoopPlugin @Inject constructor(
|
|||
setPluginEnabled(PluginType.LOOP, value)
|
||||
}
|
||||
|
||||
val isLGS: Boolean
|
||||
override val isLGS: Boolean
|
||||
get() {
|
||||
val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
|
||||
val maxIobAllowed = constraintChecker.getMaxIOBAllowed().value()
|
||||
|
@ -186,13 +186,13 @@ class LoopPlugin @Inject constructor(
|
|||
return isLGS
|
||||
}
|
||||
|
||||
val isSuperBolus: Boolean
|
||||
override val isSuperBolus: Boolean
|
||||
get() {
|
||||
val offlineEventWrapped = repository.getOfflineEventActiveAt(dateUtil.now()).blockingGet()
|
||||
return offlineEventWrapped is ValueWrapper.Existing && offlineEventWrapped.value.reason == OfflineEvent.Reason.SUPER_BOLUS
|
||||
}
|
||||
|
||||
val isDisconnected: Boolean
|
||||
override val isDisconnected: Boolean
|
||||
get() {
|
||||
val offlineEventWrapped = repository.getOfflineEventActiveAt(dateUtil.now()).blockingGet()
|
||||
return offlineEventWrapped is ValueWrapper.Existing && offlineEventWrapped.value.reason == OfflineEvent.Reason.DISCONNECT_PUMP
|
||||
|
@ -208,10 +208,6 @@ class LoopPlugin @Inject constructor(
|
|||
return bool
|
||||
}
|
||||
|
||||
@Synchronized operator fun invoke(initiator: String, allowNotification: Boolean) {
|
||||
invoke(initiator, allowNotification, false)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun isEmptyQueue(): Boolean {
|
||||
val maxMinutes = 2L
|
||||
|
@ -224,7 +220,7 @@ class LoopPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
@Synchronized
|
||||
operator fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean) {
|
||||
override fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean) {
|
||||
try {
|
||||
aapsLogger.debug(LTag.APS, "invoke from $initiator")
|
||||
val loopEnabled = constraintChecker.isLoopInvocationAllowed()
|
||||
|
@ -443,7 +439,7 @@ class LoopPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun disableCarbSuggestions(durationMinutes: Int) {
|
||||
override fun disableCarbSuggestions(durationMinutes: Int) {
|
||||
carbsSuggestionsSuspendedUntil = System.currentTimeMillis() + durationMinutes * 60 * 1000
|
||||
dismissSuggestion()
|
||||
}
|
||||
|
@ -479,7 +475,7 @@ class LoopPlugin @Inject constructor(
|
|||
rxBus.send(EventWearConfirmAction("cancelChangeRequest"))
|
||||
}
|
||||
|
||||
fun acceptChangeRequest() {
|
||||
override fun acceptChangeRequest() {
|
||||
val profile = profileFunction.getProfile() ?: return
|
||||
lastRun?.let { lastRun ->
|
||||
lastRun.constraintsProcessed?.let { constraintsProcessed ->
|
||||
|
|
|
@ -5,7 +5,6 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
|
@ -25,7 +24,7 @@ class DstHelperPlugin @Inject constructor(
|
|||
rh: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val activePlugin: ActivePlugin,
|
||||
private val loopPlugin: LoopPlugin
|
||||
private val loop: Loop
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.CONSTRAINTS)
|
||||
.neverVisible(true)
|
||||
|
@ -64,7 +63,7 @@ class DstHelperPlugin @Inject constructor(
|
|||
return value
|
||||
}
|
||||
if (wasDST(cal)) {
|
||||
if (!loopPlugin.isSuspended) {
|
||||
if (!loop.isSuspended) {
|
||||
val snoozedTo: Long = sp.getLong(R.string.key_snooze_loopdisabled, 0L)
|
||||
if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) {
|
||||
val notification = NotificationWithAction(injector, Notification.DST_LOOP_DISABLED, rh.gs(R.string.dst_loop_disabled_warning), Notification.LOW)
|
||||
|
|
|
@ -6,9 +6,8 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import javax.inject.Inject
|
||||
|
@ -18,7 +17,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var nsClientPlugin: NSClientPlugin
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
|
||||
|
@ -54,7 +53,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
})
|
||||
tasks.add(object : Task(this, R.string.loopenabled) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return loopPlugin.isEnabled()
|
||||
return (loop as PluginBase).isEnabled()
|
||||
}
|
||||
})
|
||||
tasks.add(object : Task(this, R.string.apsselected) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import info.nightscout.androidaps.interfaces.*
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.DeviceStatusData
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
|
||||
|
@ -45,18 +44,19 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
private val defaultValueHelper: DefaultValueHelper,
|
||||
private val nsDeviceStatus: NSDeviceStatus,
|
||||
private val deviceStatusData: DeviceStatusData,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loop: Loop,
|
||||
private val activePlugin: ActivePlugin,
|
||||
private var receiverStatusStore: ReceiverStatusStore,
|
||||
private val config: Config,
|
||||
private val glucoseStatusProvider: GlucoseStatusProvider
|
||||
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
.pluginName(R.string.databroadcaster)
|
||||
.alwaysEnabled(true)
|
||||
.neverVisible(true)
|
||||
.showInList(false),
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
.pluginName(R.string.databroadcaster)
|
||||
.alwaysEnabled(true)
|
||||
.neverVisible(true)
|
||||
.showInList(false),
|
||||
aapsLogger, rh, injector
|
||||
) {
|
||||
|
||||
|
@ -64,33 +64,40 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
override fun onStart() {
|
||||
super.onStart()
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventOpenAPSUpdateGui::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventOpenAPSUpdateGui::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventExtendedBolusChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventExtendedBolusChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventTempBasalChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventTempBasalChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventTreatmentChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventTreatmentChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventEffectiveProfileSwitchChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventEffectiveProfileSwitchChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventAutosensCalculationFinished::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventAutosensCalculationFinished::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventOverviewBolusProgress::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException))
|
||||
.toObservable(EventOverviewBolusProgress::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendData(it) }, fabricPrivacy::logException)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
|
@ -151,13 +158,15 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
bundle.putInt("phoneBattery", receiverStatusStore.batteryLevel)
|
||||
bundle.putInt("rigBattery", nsDeviceStatus.uploaderStatus.replace("%", "").trim { it <= ' ' }.toInt())
|
||||
|
||||
if (config.APS && loopPlugin.lastRun?.lastTBREnact != 0L) { //we are AndroidAPS
|
||||
bundle.putLong("suggestedTimeStamp", loopPlugin.lastRun?.lastAPSRun ?: -1L)
|
||||
bundle.putString("suggested", loopPlugin.lastRun?.request?.json().toString())
|
||||
if (loopPlugin.lastRun?.tbrSetByPump != null && loopPlugin.lastRun?.tbrSetByPump?.enacted == true) {
|
||||
bundle.putLong("enactedTimeStamp", loopPlugin.lastRun?.lastTBREnact
|
||||
?: -1L)
|
||||
bundle.putString("enacted", loopPlugin.lastRun?.request?.json().toString())
|
||||
if (config.APS && loop.lastRun?.lastTBREnact != 0L) { //we are AndroidAPS
|
||||
bundle.putLong("suggestedTimeStamp", loop.lastRun?.lastAPSRun ?: -1L)
|
||||
bundle.putString("suggested", loop.lastRun?.request?.json().toString())
|
||||
if (loop.lastRun?.tbrSetByPump != null && loop.lastRun?.tbrSetByPump?.enacted == true) {
|
||||
bundle.putLong(
|
||||
"enactedTimeStamp", loop.lastRun?.lastTBREnact
|
||||
?: -1L
|
||||
)
|
||||
bundle.putString("enacted", loop.lastRun?.request?.json().toString())
|
||||
}
|
||||
} else { //NSClient or remote
|
||||
val data = deviceStatusData.openAPSData
|
||||
|
|
|
@ -10,12 +10,14 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.*
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.extensions.*
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
|
||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.*
|
||||
|
@ -45,7 +47,7 @@ class OverviewData @Inject constructor(
|
|||
private val defaultValueHelper: DefaultValueHelper,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val config: Config,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loop: Loop,
|
||||
private val nsDeviceStatus: NSDeviceStatus,
|
||||
private val repository: AppRepository,
|
||||
private val overviewMenus: OverviewMenus,
|
||||
|
@ -317,8 +319,8 @@ class OverviewData @Inject constructor(
|
|||
@Synchronized
|
||||
fun preparePredictions(from: String) {
|
||||
// val start = dateUtil.now()
|
||||
val apsResult = if (config.APS) loopPlugin.lastRun?.constraintsProcessed else nsDeviceStatus.getAPSResult(injector)
|
||||
val predictionsAvailable = if (config.APS) loopPlugin.lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
||||
val apsResult = if (config.APS) loop.lastRun?.constraintsProcessed else nsDeviceStatus.getAPSResult(injector)
|
||||
val predictionsAvailable = if (config.APS) loop.lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
||||
val menuChartSettings = overviewMenus.setting
|
||||
// align to hours
|
||||
val calendar = Calendar.getInstance().also {
|
||||
|
@ -480,7 +482,7 @@ class OverviewData @Inject constructor(
|
|||
var toTime = toTime
|
||||
val targetsSeriesArray: MutableList<DataPoint> = java.util.ArrayList()
|
||||
var lastTarget = -1.0
|
||||
loopPlugin.lastRun?.constraintsProcessed?.let { toTime = max(it.latestPredictionsTime, toTime) }
|
||||
loop.lastRun?.constraintsProcessed?.let { toTime = max(it.latestPredictionsTime, toTime) }
|
||||
var time = fromTime
|
||||
while (time < toTime) {
|
||||
val tt = repository.getTemporaryTargetActiveAt(time).blockingGet()
|
||||
|
|
|
@ -46,7 +46,6 @@ import info.nightscout.androidaps.extensions.valueToUnitsString
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
|
@ -99,7 +98,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var statusLightHandler: StatusLightHandler
|
||||
@Inject lateinit var nsDeviceStatus: NSDeviceStatus
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var dexcomPlugin: DexcomPlugin
|
||||
|
@ -409,10 +408,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
|
||||
R.id.accept_temp_button -> {
|
||||
profileFunction.getProfile() ?: return
|
||||
if (loopPlugin.isEnabled()) {
|
||||
if ((loop as PluginBase).isEnabled()) {
|
||||
handler.post {
|
||||
val lastRun = loopPlugin.lastRun
|
||||
loopPlugin.invoke("Accept temp button", false)
|
||||
val lastRun = loop.lastRun
|
||||
loop.invoke("Accept temp button", false)
|
||||
if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) {
|
||||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
|
||||
OKDialog.showConfirmation(activity, rh.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
|
||||
|
@ -421,7 +420,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
|
||||
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
|
||||
rxBus.send(EventWearInitiateAction("cancelChangeRequest"))
|
||||
Thread { loopPlugin.acceptChangeRequest() }.run()
|
||||
Thread { loop.acceptChangeRequest() }.run()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -524,7 +523,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
} else binding.buttonsLayout.quickWizardButton.visibility = View.GONE
|
||||
|
||||
// **** Temp button ****
|
||||
val lastRun = loopPlugin.lastRun
|
||||
val lastRun = loop.lastRun
|
||||
val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
|
||||
|
||||
val showAcceptButton = !closedLoopEnabled.value() && // Open mode needed
|
||||
|
@ -532,7 +531,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
(lastRun.lastOpenModeAccept == 0L || lastRun.lastOpenModeAccept < lastRun.lastAPSRun) &&// never accepted or before last result
|
||||
lastRun.constraintsProcessed?.isChangeRequested == true // change is requested
|
||||
|
||||
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && loopPlugin.isEnabled()) {
|
||||
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && (loop as PluginBase).isEnabled()) {
|
||||
binding.buttonsLayout.acceptTempButton.visibility = View.VISIBLE
|
||||
binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.setbasalquestion)}\n${lastRun!!.constraintsProcessed}"
|
||||
} else {
|
||||
|
@ -592,21 +591,21 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
binding.infoLayout.apsMode.visibility = View.VISIBLE
|
||||
binding.infoLayout.timeLayout.visibility = View.GONE
|
||||
when {
|
||||
loopPlugin.isEnabled() && loopPlugin.isSuperBolus -> {
|
||||
(loop as PluginBase).isEnabled() && loop.isSuperBolus -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_superbolus)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
loopPlugin.isDisconnected -> {
|
||||
loop.isDisconnected -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_disconnected)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
loopPlugin.isEnabled() && loopPlugin.isSuspended -> {
|
||||
(loop as PluginBase).isEnabled() && loop.isSuspended -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_paused)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh)
|
||||
binding.infoLayout.apsModeText.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
@ -623,17 +622,17 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
binding.infoLayout.apsModeText.visibility = View.GONE
|
||||
}
|
||||
|
||||
loopPlugin.isEnabled() && closedLoopEnabled.value() && loopPlugin.isLGS -> {
|
||||
(loop as PluginBase).isEnabled() && closedLoopEnabled.value() && loop.isLGS -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_lgs)
|
||||
binding.infoLayout.apsModeText.visibility = View.GONE
|
||||
}
|
||||
|
||||
loopPlugin.isEnabled() && closedLoopEnabled.value() -> {
|
||||
(loop as PluginBase).isEnabled() && closedLoopEnabled.value() -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_closed)
|
||||
binding.infoLayout.apsModeText.visibility = View.GONE
|
||||
}
|
||||
|
||||
loopPlugin.isEnabled() && !closedLoopEnabled.value() -> {
|
||||
(loop as PluginBase).isEnabled() && !closedLoopEnabled.value() -> {
|
||||
binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_open)
|
||||
binding.infoLayout.apsModeText.visibility = View.GONE
|
||||
}
|
||||
|
@ -837,8 +836,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
// cob
|
||||
var cobText = overviewData.cobInfo?.displayText(rh, dateUtil, buildHelper.isEngineeringMode()) ?: rh.gs(R.string.value_unavailable_short)
|
||||
|
||||
val constraintsProcessed = loopPlugin.lastRun?.constraintsProcessed
|
||||
val lastRun = loopPlugin.lastRun
|
||||
val constraintsProcessed = loop.lastRun?.constraintsProcessed
|
||||
val lastRun = loop.lastRun
|
||||
if (config.APS && constraintsProcessed != null && lastRun != null) {
|
||||
if (constraintsProcessed.carbsReq > 0) {
|
||||
//only display carbsreq when carbs have not been entered recently
|
||||
|
@ -868,7 +867,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
} else {
|
||||
// If the target is not the same as set in the profile then oref has overridden it
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
val targetUsed = loopPlugin.lastRun?.constraintsProcessed?.targetBG ?: 0.0
|
||||
val targetUsed = loop.lastRun?.constraintsProcessed?.targetBG ?: 0.0
|
||||
|
||||
if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) {
|
||||
aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed")
|
||||
|
|
|
@ -9,11 +9,11 @@ import androidx.annotation.ColorRes
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import com.google.gson.Gson
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -28,7 +28,7 @@ class OverviewMenus @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val rxBus: RxBus,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loop: Loop,
|
||||
private val config: Config
|
||||
) {
|
||||
|
||||
|
@ -92,7 +92,7 @@ class OverviewMenus @Inject constructor(
|
|||
|
||||
chartButton.setOnClickListener { v: View ->
|
||||
val predictionsAvailable: Boolean = when {
|
||||
config.APS -> loopPlugin.lastRun?.request?.hasPredictions ?: false
|
||||
config.APS -> loop.lastRun?.request?.hasPredictions ?: false
|
||||
config.NSCLIENT -> true
|
||||
else -> false
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import info.nightscout.androidaps.interfaces.*
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
|
@ -64,7 +63,7 @@ class ActionStringHandler @Inject constructor(
|
|||
private val context: Context,
|
||||
private val constraintChecker: ConstraintChecker,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loop: Loop,
|
||||
private val wearPlugin: WearPlugin,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val commandQueue: CommandQueue,
|
||||
|
@ -320,7 +319,7 @@ class ActionStringHandler @Inject constructor(
|
|||
} else if ("changeRequest" == act[0]) { ////////////////////////////////////////////// CHANGE REQUEST
|
||||
rTitle = rh.gs(R.string.openloop_newsuggestion)
|
||||
rAction = "changeRequest"
|
||||
loopPlugin.lastRun?.let {
|
||||
loop.lastRun?.let {
|
||||
rMessage += it.constraintsProcessed
|
||||
wearPlugin.requestChangeConfirmation(rTitle, rMessage, rAction)
|
||||
lastSentTimestamp = System.currentTimeMillis()
|
||||
|
@ -424,7 +423,7 @@ class ActionStringHandler @Inject constructor(
|
|||
get() {
|
||||
var ret = ""
|
||||
// decide if enabled/disabled closed/open; what Plugin as APS?
|
||||
if (loopPlugin.isEnabled(loopPlugin.getType())) {
|
||||
if ((loop as PluginBase).isEnabled()) {
|
||||
ret += if (constraintChecker.isClosedLoopAllowed().value()) {
|
||||
"CLOSED LOOP\n"
|
||||
} else {
|
||||
|
@ -432,7 +431,7 @@ class ActionStringHandler @Inject constructor(
|
|||
}
|
||||
val aps = activePlugin.activeAPS
|
||||
ret += "APS: " + (aps as PluginBase).name
|
||||
val lastRun = loopPlugin.lastRun
|
||||
val lastRun = loop.lastRun
|
||||
if (lastRun != null) {
|
||||
ret += "\nLast Run: " + dateUtil.timeString(lastRun.lastAPSRun)
|
||||
if (lastRun.lastTBREnact != 0L) ret += "\nLast Enact: " + dateUtil.timeString(lastRun.lastTBREnact)
|
||||
|
@ -505,8 +504,8 @@ class ActionStringHandler @Inject constructor(
|
|||
doFillBolus(amount)
|
||||
} else if ("temptarget" == act[0]) {
|
||||
val duration = SafeParse.stringToInt(act[2])
|
||||
var low = SafeParse.stringToDouble(act[3])
|
||||
var high = SafeParse.stringToDouble(act[4])
|
||||
val low = SafeParse.stringToDouble(act[3])
|
||||
val high = SafeParse.stringToDouble(act[4])
|
||||
generateTempTarget(duration, low, high)
|
||||
} else if ("wizard2" == act[0]) {
|
||||
if (lastBolusWizard != null) { //use last calculation as confirmed string matches
|
||||
|
@ -529,7 +528,7 @@ class ActionStringHandler @Inject constructor(
|
|||
} else if ("dismissoverviewnotification" == act[0]) {
|
||||
rxBus.send(EventDismissNotification(SafeParse.stringToInt(act[1])))
|
||||
} else if ("changeRequest" == act[0]) {
|
||||
loopPlugin.acceptChangeRequest()
|
||||
loop.acceptChangeRequest()
|
||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.cancel(Constants.notificationID)
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import dagger.Lazy
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
|
@ -33,7 +33,7 @@ class WearPlugin @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val ctx: Context,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val loopPlugin: Lazy<LoopPlugin>,
|
||||
private val loop: Loop,
|
||||
private val rxBus: RxBus,
|
||||
private val actionStringHandler: Lazy<ActionStringHandler>
|
||||
|
||||
|
@ -88,7 +88,7 @@ class WearPlugin @Inject constructor(
|
|||
.toObservable(EventRefreshOverview::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({
|
||||
if (WatchUpdaterService.shouldReportLoopStatus(loopPlugin.get().isEnabled()))
|
||||
if (WatchUpdaterService.shouldReportLoopStatus((loop as PluginBase).isEnabled()))
|
||||
sendDataToWatch(status = true, basals = false, bgValue = false)
|
||||
}, fabricPrivacy::logException))
|
||||
disposable.add(rxBus
|
||||
|
|
|
@ -42,6 +42,8 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
|
|||
import info.nightscout.androidaps.interfaces.Config;
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit;
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator;
|
||||
import info.nightscout.androidaps.interfaces.Loop;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.Profile;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
|
@ -73,7 +75,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
@Inject public DefaultValueHelper defaultValueHelper;
|
||||
@Inject public NSDeviceStatus nsDeviceStatus;
|
||||
@Inject public ActivePlugin activePlugin;
|
||||
@Inject public LoopPlugin loopPlugin;
|
||||
@Inject public Loop loop;
|
||||
@Inject public IobCobCalculator iobCobCalculator;
|
||||
@Inject public AppRepository repository;
|
||||
@Inject ReceiverStatusStore receiverStatusStore;
|
||||
|
@ -509,7 +511,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
repository.getCarbsDataFromTimeExpanded(startTimeWindow, true).blockingGet()
|
||||
.forEach(carb -> boluses.add(treatmentMap(carb.getTimestamp(), 0, carb.getAmount(), false, carb.isValid())));
|
||||
|
||||
final LoopPlugin.LastRun finalLastRun = loopPlugin.getLastRun();
|
||||
final LoopPlugin.LastRun finalLastRun = loop.getLastRun();
|
||||
if (sp.getBoolean("wear_predictions", true) && finalLastRun != null && finalLastRun.getRequest().getHasPredictions() && finalLastRun.getConstraintsProcessed() != null) {
|
||||
List<GlucoseValueDataPoint> predArray =
|
||||
finalLastRun.getConstraintsProcessed().getPredictions()
|
||||
|
@ -688,7 +690,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
//OpenAPS status
|
||||
if (config.getAPS()) {
|
||||
//we are AndroidAPS
|
||||
openApsStatus = loopPlugin.getLastRun() != null && loopPlugin.getLastRun().getLastTBREnact() != 0 ? loopPlugin.getLastRun().getLastTBREnact() : -1;
|
||||
openApsStatus = loop.getLastRun() != null && loop.getLastRun().getLastTBREnact() != 0 ? loop.getLastRun().getLastTBREnact() : -1;
|
||||
} else {
|
||||
//NSClient or remote
|
||||
openApsStatus = nsDeviceStatus.getOpenApsTimestamp();
|
||||
|
@ -741,7 +743,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
return status;
|
||||
}
|
||||
|
||||
if (!loopPlugin.isEnabled()) {
|
||||
if (!((PluginBase)loop).isEnabled()) {
|
||||
status += rh.gs(R.string.disabledloop) + "\n";
|
||||
lastLoopStatus = false;
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,6 @@ import info.nightscout.androidaps.events.*
|
|||
import info.nightscout.androidaps.extensions.toStringShort
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
@ -30,7 +29,7 @@ class StatusLinePlugin @Inject constructor(
|
|||
private val aapsSchedulers: AapsSchedulers,
|
||||
private val context: Context,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loop: Loop,
|
||||
private val iobCobCalculator: IobCobCalculator,
|
||||
private val rxBus: RxBus,
|
||||
aapsLogger: AAPSLogger
|
||||
|
@ -66,7 +65,7 @@ class StatusLinePlugin @Inject constructor(
|
|||
super.onStart()
|
||||
disposable += rxBus.toObservable(EventRefreshOverview::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ if (lastLoopStatus != loopPlugin.isEnabled()) sendStatus() }, fabricPrivacy::logException)
|
||||
.subscribe({ if (lastLoopStatus != (loop as PluginBase).isEnabled()) sendStatus() }, fabricPrivacy::logException)
|
||||
disposable += rxBus.toObservable(EventExtendedBolusChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ sendStatus() }, fabricPrivacy::logException)
|
||||
|
@ -113,12 +112,11 @@ class StatusLinePlugin @Inject constructor(
|
|||
|
||||
private fun buildStatusString(profile: Profile): String {
|
||||
var status = ""
|
||||
if (!loopPlugin.isEnabled()) {
|
||||
if (!(loop as PluginBase).isEnabled()) {
|
||||
status += rh.gs(R.string.disabledloop) + "\n"
|
||||
lastLoopStatus = false
|
||||
} else if (loopPlugin.isEnabled()) {
|
||||
lastLoopStatus = true
|
||||
}
|
||||
} else lastLoopStatus = true
|
||||
|
||||
//Temp basal
|
||||
val activeTemp = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())
|
||||
if (activeTemp != null) {
|
||||
|
|
|
@ -14,17 +14,12 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
||||
import info.nightscout.androidaps.extensions.buildDeviceStatus
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
|
@ -64,7 +59,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
|
@ -124,12 +119,12 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
var shouldUploadStatus = false
|
||||
if (config.NSCLIENT) return
|
||||
if (config.PUMPCONTROL) shouldUploadStatus = true
|
||||
else if (!loopPlugin.isEnabled() || iobCobCalculator.ads.actualBg() == null)
|
||||
else if (!(loop as PluginBase).isEnabled() || iobCobCalculator.ads.actualBg() == null)
|
||||
shouldUploadStatus = true
|
||||
else if (dateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true
|
||||
if (dateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY_IN_MINUTES) && shouldUploadStatus) {
|
||||
lastIobUpload = dateUtil.now()
|
||||
buildDeviceStatus(dateUtil, loopPlugin, iobCobCalculator, profileFunction,
|
||||
buildDeviceStatus(dateUtil, loop, iobCobCalculator, profileFunction,
|
||||
activePlugin.activePump, receiverStatusStore, runningConfiguration,
|
||||
BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION)?.also {
|
||||
repository.insert(it)
|
||||
|
@ -149,7 +144,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
// sometimes keep alive broadcast stops
|
||||
// as as workaround test if readStatus was requested before an alarm is generated
|
||||
if (lastReadStatus != 0L && lastReadStatus > System.currentTimeMillis() - T.mins(5).msecs()) {
|
||||
localAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated, loopPlugin.isDisconnected)
|
||||
localAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated, loop.isDisconnected)
|
||||
}
|
||||
if (runningProfile == null || ((!pump.isThisProfileSet(requestedProfile) || !requestedProfile.isEqual(runningProfile)) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE))) {
|
||||
rxBus.send(EventProfileSwitchChanged())
|
||||
|
|
|
@ -5,33 +5,30 @@ import android.content.Intent
|
|||
import android.text.Spanned
|
||||
import com.google.common.base.Joiner
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.androidaps.database.entities.OfflineEvent
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InsertOrUpdateBolusCalculatorResultTransaction
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.extensions.formatColor
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.extensions.formatColor
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -52,7 +49,7 @@ class BolusWizard @Inject constructor(
|
|||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var commandQueue: CommandQueue
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var config: Config
|
||||
|
@ -373,8 +370,8 @@ class BolusWizard @Inject constructor(
|
|||
if (insulinAfterConstraints > 0 || carbs > 0) {
|
||||
if (useSuperBolus) {
|
||||
uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog)
|
||||
if (loopPlugin.isEnabled()) {
|
||||
loopPlugin.goToZeroTemp(2 * 60, profile, OfflineEvent.Reason.SUPER_BOLUS)
|
||||
if ((loop as PluginBase).isEnabled()) {
|
||||
loop.goToZeroTemp(2 * 60, profile, OfflineEvent.Reason.SUPER_BOLUS)
|
||||
rxBus.send(EventRefreshOverview("WizardDialog"))
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,11 @@ import info.nightscout.androidaps.database.ValueWrapper
|
|||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.extensions.valueToUnits
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetInt
|
||||
|
@ -25,7 +26,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
|
|||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
@ -107,7 +108,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
|
|||
if (useSuperBolus() == YES && sp.getBoolean(R.string.key_usesuperbolus, false)) {
|
||||
superBolus = true
|
||||
}
|
||||
if (loopPlugin.isEnabled(loopPlugin.getType()) && loopPlugin.isSuperBolus) superBolus = false
|
||||
if ((loop as PluginBase).isEnabled() && loop.isSuperBolus) superBolus = false
|
||||
// Trend
|
||||
val glucoseStatus = glucoseStatusProvider.glucoseStatusData
|
||||
var trend = false
|
||||
|
|
|
@ -4,8 +4,8 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import info.nightscout.androidaps.utils.wizard.QuickWizard
|
||||
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
|
||||
|
@ -20,7 +20,7 @@ class QuickWizardTest : TestBase() {
|
|||
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var loopPlugin: LoopPlugin
|
||||
@Mock lateinit var loop: Loop
|
||||
|
||||
private val data1 = "{\"buttonText\":\"Meal\",\"carbs\":36,\"validFrom\":0,\"validTo\":18000," +
|
||||
"\"useBG\":0,\"useCOB\":0,\"useBolusIOB\":0,\"useBasalIOB\":0,\"useTrend\":0,\"useSuperBolus\":0,\"useTemptarget\":0}"
|
||||
|
@ -34,7 +34,7 @@ class QuickWizardTest : TestBase() {
|
|||
it.aapsLogger = aapsLogger
|
||||
it.sp = sp
|
||||
it.profileFunction = profileFunction
|
||||
it.loopPlugin = loopPlugin
|
||||
it.loop = loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
|||
import info.nightscout.androidaps.utils.HardLimits
|
||||
import info.nightscout.androidaps.utils.Profiler
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -131,17 +130,14 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
insightDbHelper = InsightDbHelper(insightDatabaseDao)
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, injector)
|
||||
hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository)
|
||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, ConfigImpl(), dateUtil, uel)
|
||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config, dateUtil, uel)
|
||||
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, context, pumpSync, dateUtil)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
|
||||
danaRSPlugin = DanaRSPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, profileFunction, sp, commandQueue, danaPump, pumpSync, detailedBolusInfoStorage, temporaryBasalStorage, fabricPrivacy, dateUtil)
|
||||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, ConfigImpl(), dateUtil, insightDbHelper, pumpSync)
|
||||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync)
|
||||
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, sp, dateUtil, repository, glucoseStatusProvider)
|
||||
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, dateUtil, repository, glucoseStatusProvider)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker,
|
||||
openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin,
|
||||
hardLimits, BuildHelperImpl(ConfigImpl(), fileListProvider), iobCobCalculator,
|
||||
ConfigImpl(), dateUtil)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelperImpl(config, fileListProvider), iobCobCalculator, config, dateUtil)
|
||||
val constraintsPluginsList = ArrayList<PluginBase>()
|
||||
constraintsPluginsList.add(safetyPlugin)
|
||||
constraintsPluginsList.add(objectivesPlugin)
|
||||
|
@ -249,7 +245,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
// Apply all limits
|
||||
val d = constraintChecker.getMaxBasalAllowed(validProfile)
|
||||
Assert.assertEquals(0.8, d.value(), 0.01)
|
||||
Assert.assertEquals(6, d.reasonList.size)
|
||||
Assert.assertEquals(3, d.reasonList.size)
|
||||
Assert.assertEquals("DanaR: Limiting max basal rate to 0.80 U/h because of pump limit", d.getMostLimitedReasons(aapsLogger))
|
||||
}
|
||||
|
||||
|
@ -275,9 +271,9 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
|
||||
// Apply all limits
|
||||
val i = constraintChecker.getMaxBasalPercentAllowed(validProfile)
|
||||
Assert.assertEquals(100, i.value())
|
||||
Assert.assertEquals(9, i.reasonList.size) // 7x Safety & RS & R
|
||||
Assert.assertEquals("Safety: Limiting max percent rate to 100% because of pump limit", i.getMostLimitedReasons(aapsLogger))
|
||||
Assert.assertEquals(200, i.value())
|
||||
Assert.assertEquals(6, i.reasonList.size)
|
||||
Assert.assertEquals("Safety: Limiting max percent rate to 200% because of pump limit", i.getMostLimitedReasons(aapsLogger))
|
||||
}
|
||||
|
||||
// applyBolusConstraints tests
|
||||
|
|
|
@ -16,7 +16,6 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
|||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -44,13 +43,15 @@ class LoopPluginTest : TestBase() {
|
|||
@Mock lateinit var uel:UserEntryLogger
|
||||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var runningConfiguration: RunningConfiguration
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private lateinit var loopPlugin: LoopPlugin
|
||||
|
||||
val injector = HasAndroidInjector { AndroidInjector { } }
|
||||
@Before fun prepareMock() {
|
||||
|
||||
loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, ConfigImpl(), constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel, repository, runningConfiguration)
|
||||
loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, config,
|
||||
constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel, repository, runningConfiguration)
|
||||
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
|
||||
`when`(context.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(notificationManager)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -21,7 +21,7 @@ class DstHelperPluginTest : TestBase() {
|
|||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var loopPlugin: LoopPlugin
|
||||
@Mock lateinit var loop: Loop
|
||||
|
||||
private lateinit var plugin: DstHelperPlugin
|
||||
|
||||
|
@ -30,7 +30,7 @@ class DstHelperPluginTest : TestBase() {
|
|||
@Before
|
||||
fun mock() {
|
||||
plugin = DstHelperPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), rh,
|
||||
sp, activePlugin, loopPlugin)
|
||||
sp, activePlugin, loop)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -5,11 +5,11 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -25,6 +25,7 @@ class ObjectivesPluginTest : TestBase() {
|
|||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var uel: UserEntryLogger
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private lateinit var objectivesPlugin: ObjectivesPlugin
|
||||
|
||||
|
@ -39,7 +40,7 @@ class ObjectivesPluginTest : TestBase() {
|
|||
}
|
||||
|
||||
@Before fun prepareMock() {
|
||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, ConfigImpl(), dateUtil, uel)
|
||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config, dateUtil, uel)
|
||||
objectivesPlugin.onStart()
|
||||
`when`(rh.gs(R.string.objectivenotstarted, 9)).thenReturn("Objective 9 not started")
|
||||
`when`(rh.gs(R.string.objectivenotstarted, 8)).thenReturn("Objective 8 not started")
|
||||
|
|
|
@ -17,7 +17,6 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
|||
import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
||||
import info.nightscout.androidaps.utils.HardLimits
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -69,7 +68,9 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
|
||||
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
||||
hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, buildHelper, iobCobCalculator, ConfigImpl(), dateUtil)
|
||||
`when`(config.APS).thenReturn(true)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, buildHelper,
|
||||
iobCobCalculator, config, dateUtil)
|
||||
}
|
||||
|
||||
@Test fun pumpDescriptionShouldLimitLoopInvocation() {
|
||||
|
|
|
@ -3,9 +3,9 @@ package info.nightscout.androidaps.plugins.general.maintenance
|
|||
import android.content.Context
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -25,12 +25,13 @@ class MaintenancePluginTest : TestBase() {
|
|||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
lateinit var sut: MaintenancePlugin
|
||||
|
||||
@Before
|
||||
fun mock() {
|
||||
sut = MaintenancePlugin(injector, context, rh, sp, nsSettingsStatus, aapsLogger, buildHelper, ConfigImpl(), fileListProvider, loggerUtils)
|
||||
sut = MaintenancePlugin(injector, context, rh, sp, nsSettingsStatus, aapsLogger, buildHelper, config, fileListProvider, loggerUtils)
|
||||
`when`(loggerUtils.suffix).thenReturn(".log.zip")
|
||||
`when`(loggerUtils.logDirectory).thenReturn("src/test/res/logger")
|
||||
`when`(fileListProvider.ensureTempDirExists()).thenReturn(File("src/test/res/logger"))
|
||||
|
|
|
@ -30,7 +30,6 @@ import info.nightscout.androidaps.queue.Callback
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.XDripBroadcast
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.Single
|
||||
import org.junit.Assert
|
||||
|
@ -51,7 +50,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var loopPlugin: LoopPlugin
|
||||
@Mock lateinit var loop: LoopPlugin
|
||||
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||
@Mock lateinit var localProfilePlugin: LocalProfilePlugin
|
||||
@Mock lateinit var otp: OneTimePassword
|
||||
|
@ -99,7 +98,9 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
val glucoseStatusProvider = GlucoseStatusProvider(aapsLogger = aapsLogger, iobCobCalculator = iobCobCalculator, dateUtil = dateUtilMocked)
|
||||
|
||||
smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, rh, smsManager, aapsSchedulers, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue,
|
||||
loopPlugin, iobCobCalculator, xDripBroadcast, otp, ConfigImpl(), dateUtilMocked, uel, glucoseStatusProvider, repository)
|
||||
loop, iobCobCalculator, xDripBroadcast,
|
||||
otp, config, dateUtilMocked, uel,
|
||||
glucoseStatusProvider, repository)
|
||||
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
|
||||
Mockito.doAnswer { invocation: InvocationOnMock ->
|
||||
val callback = invocation.getArgument<Callback>(1)
|
||||
|
@ -298,7 +299,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
`when`(sp.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)).thenReturn(true)
|
||||
|
||||
//LOOP STATUS : disabled
|
||||
`when`(loopPlugin.enabled).thenReturn(false)
|
||||
`when`(loop.enabled).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP STATUS")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -306,9 +307,9 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Loop is disabled", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//LOOP STATUS : suspended
|
||||
`when`(loopPlugin.minutesToEndOfSuspend()).thenReturn(10)
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loopPlugin.isSuspended).thenReturn(true)
|
||||
`when`(loop.minutesToEndOfSuspend()).thenReturn(10)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(true)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP STATUS")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -316,8 +317,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Suspended (10 m)", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//LOOP STATUS : enabled
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loopPlugin.isSuspended).thenReturn(false)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP STATUS")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -326,7 +327,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Loop is enabled", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//LOOP : wrong format
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -335,7 +336,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//LOOP DISABLE : already disabled
|
||||
`when`(loopPlugin.enabled).thenReturn(false)
|
||||
`when`(loop.enabled).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP DISABLE")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -345,11 +346,11 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
|
||||
//LOOP DISABLE : from enabled
|
||||
hasBeenRun = false
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
// PowerMockito.doAnswer(Answer {
|
||||
// hasBeenRun = true
|
||||
// null
|
||||
// } as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, false)
|
||||
// } as Answer<*>).`when`(loop).setPluginEnabled(PluginType.LOOP, false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP DISABLE")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -363,7 +364,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
//Assert.assertTrue(hasBeenRun)
|
||||
|
||||
//LOOP ENABLE : already enabled
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP ENABLE")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -373,11 +374,11 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
|
||||
//LOOP ENABLE : from disabled
|
||||
hasBeenRun = false
|
||||
`when`(loopPlugin.enabled).thenReturn(false)
|
||||
`when`(loop.enabled).thenReturn(false)
|
||||
// PowerMockito.doAnswer(Answer {
|
||||
// hasBeenRun = true
|
||||
// null
|
||||
// } as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, true)
|
||||
// } as Answer<*>).`when`(loop).setPluginEnabled(PluginType.LOOP, true)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP ENABLE")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -467,8 +468,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//NSCLIENT RESTART
|
||||
`when`(loopPlugin.isEnabled()).thenReturn(true)
|
||||
`when`(loopPlugin.isSuspended).thenReturn(false)
|
||||
`when`((loop as PluginBase).isEnabled()).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "NSCLIENT RESTART")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -477,8 +478,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertTrue(smsCommunicatorPlugin.messages[1].text.contains("NSCLIENT RESTART"))
|
||||
|
||||
//NSCLIENT BLA BLA
|
||||
`when`(loopPlugin.isEnabled()).thenReturn(true)
|
||||
`when`(loopPlugin.isSuspended).thenReturn(false)
|
||||
`when`((loop as PluginBase).isEnabled()).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "NSCLIENT BLA BLA")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -487,8 +488,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text)
|
||||
|
||||
//NSCLIENT BLABLA
|
||||
`when`(loopPlugin.isEnabled()).thenReturn(true)
|
||||
`when`(loopPlugin.isSuspended).thenReturn(false)
|
||||
`when`((loop as PluginBase).isEnabled()).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(false)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "NSCLIENT BLABLA")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -524,7 +525,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
repository.runTransactionForResult(anyObject<Transaction<CancelCurrentOfflineEventIfAnyTransaction.TransactionResult>>())
|
||||
).thenReturn(Single.just(CancelCurrentOfflineEventIfAnyTransaction.TransactionResult().apply {
|
||||
}))
|
||||
`when`(loopPlugin.enabled).thenReturn(true)
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "PUMP CONNECT")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -871,7 +872,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
passCode = smsCommunicatorPlugin.messageToConfirm?.confirmCode!!
|
||||
smsCommunicatorPlugin.processSms(Sms("1234", passCode))
|
||||
Assert.assertEquals(passCode, smsCommunicatorPlugin.messages[2].text)
|
||||
Assert.assertEquals("Extended bolus 1.00U for 20 min started successfully\nnull\nVirtual Pump", smsCommunicatorPlugin.messages[3].text)
|
||||
Assert.assertEquals("Extended bolus 1.00U for 20 min started successfully\nVirtual Pump", smsCommunicatorPlugin.messages[3].text)
|
||||
}
|
||||
|
||||
@Test fun processBolusTest() {
|
||||
|
|
|
@ -3,11 +3,11 @@ package info.nightscout.androidaps.plugins.insulin
|
|||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Insulin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
|
@ -30,6 +30,7 @@ class InsulinLyumjevPluginTest {
|
|||
@Mock lateinit var rxBus: RxBus
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
|
@ -38,7 +39,7 @@ class InsulinLyumjevPluginTest {
|
|||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, ConfigImpl())
|
||||
sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -6,13 +6,13 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.data.Iob
|
||||
import info.nightscout.androidaps.database.entities.Bolus
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Insulin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA
|
||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert
|
||||
|
@ -34,9 +34,10 @@ class InsulinOrefBasePluginTest {
|
|||
rh: ResourceHelper,
|
||||
profileFunction: ProfileFunction,
|
||||
rxBus: RxBus,
|
||||
aapsLogger: AAPSLogger
|
||||
aapsLogger: AAPSLogger,
|
||||
config: Config
|
||||
) : InsulinOrefBasePlugin(
|
||||
injector, rh, profileFunction, rxBus, aapsLogger, ConfigImpl()
|
||||
injector, rh, profileFunction, rxBus, aapsLogger, config
|
||||
) {
|
||||
|
||||
override fun sendShortDiaNotification(dia: Double) {
|
||||
|
@ -67,6 +68,7 @@ class InsulinOrefBasePluginTest {
|
|||
@Mock lateinit var rxBus: RxBus
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
|
@ -75,7 +77,7 @@ class InsulinOrefBasePluginTest {
|
|||
|
||||
@Before
|
||||
fun setUp() {
|
||||
sut = InsulinBaseTest(injector, rh, profileFunction, rxBus, aapsLogger)
|
||||
sut = InsulinBaseTest(injector, rh, profileFunction, rxBus, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -4,10 +4,10 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Insulin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert.assertEquals
|
||||
|
@ -30,6 +30,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
|
|||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var rxBus: RxBus
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
|
@ -38,15 +39,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
|
|||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = InsulinOrefFreePeakPlugin(
|
||||
injector,
|
||||
sp,
|
||||
rh,
|
||||
profileFunction,
|
||||
rxBus,
|
||||
aapsLogger,
|
||||
ConfigImpl()
|
||||
)
|
||||
sut = InsulinOrefFreePeakPlugin( injector, sp, rh, profileFunction, rxBus, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -3,11 +3,11 @@ package info.nightscout.androidaps.plugins.insulin
|
|||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Insulin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
|
@ -30,6 +30,7 @@ class InsulinOrefRapidActingPluginTest {
|
|||
@Mock lateinit var rxBus: RxBus
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
|
@ -38,7 +39,7 @@ class InsulinOrefRapidActingPluginTest {
|
|||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, ConfigImpl())
|
||||
sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -3,11 +3,11 @@ package info.nightscout.androidaps.plugins.insulin
|
|||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Insulin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
|
@ -30,6 +30,7 @@ class InsulinOrefUltraRapidActingPluginTest {
|
|||
@Mock lateinit var rxBus: RxBus
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
|
@ -38,7 +39,7 @@ class InsulinOrefUltraRapidActingPluginTest {
|
|||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, ConfigImpl())
|
||||
sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -4,6 +4,7 @@ import dagger.android.AndroidInjector
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
|
@ -11,7 +12,6 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -31,12 +31,13 @@ class VirtualPumpPluginUTest : TestBase() {
|
|||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||
|
||||
@Before
|
||||
fun prepareMocks() {
|
||||
virtualPumpPlugin = VirtualPumpPlugin({ AndroidInjector { } }, aapsLogger, rxBus, fabricPrivacy, rh, aapsSchedulers, sp, profileFunction, iobCobCalculator, commandQueue, pumpSync, ConfigImpl(), dateUtil)
|
||||
virtualPumpPlugin = VirtualPumpPlugin({ AndroidInjector { } }, aapsLogger, rxBus, fabricPrivacy, rh, aapsSchedulers, sp, profileFunction, iobCobCalculator, commandQueue, pumpSync, config, dateUtil)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.source
|
|||
|
||||
import dagger.android.AndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -16,10 +16,11 @@ class NSClientPluginTest : TestBase() {
|
|||
|
||||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
nsClientSourcePlugin = NSClientSourcePlugin({ AndroidInjector { } }, rh, aapsLogger, ConfigImpl())
|
||||
nsClientSourcePlugin = NSClientSourcePlugin({ AndroidInjector { } }, rh, aapsLogger, config)
|
||||
}
|
||||
|
||||
@Test fun advancedFilteringSupported() {
|
||||
|
|
|
@ -26,7 +26,6 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -106,7 +105,8 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
fun prepare() {
|
||||
commandQueue = CommandQueueMocked(injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||
BuildHelperImpl(ConfigImpl(), fileListProvider), dateUtil, repository,
|
||||
BuildHelperImpl(config, fileListProvider), dateUtil,
|
||||
repository,
|
||||
fabricPrivacy, config)
|
||||
testPumpPlugin = TestPumpPlugin(injector)
|
||||
|
||||
|
@ -140,7 +140,8 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
fun commandIsPickedUp() {
|
||||
val commandQueue = CommandQueueImplementation(injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||
BuildHelperImpl(ConfigImpl(), fileListProvider), dateUtil, repository,
|
||||
BuildHelperImpl(config, fileListProvider),
|
||||
dateUtil, repository,
|
||||
fabricPrivacy, config)
|
||||
// start with empty queue
|
||||
Assert.assertEquals(0, commandQueue.size())
|
||||
|
|
|
@ -17,7 +17,6 @@ import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvid
|
|||
import info.nightscout.androidaps.queue.commands.Command
|
||||
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -58,7 +57,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
|||
commandQueue = CommandQueueImplementation(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
||||
profileFunction, activePlugin, context, sp,
|
||||
BuildHelperImpl(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy, config
|
||||
BuildHelperImpl(config, fileListProvider), dateUtil, repository, fabricPrivacy, config
|
||||
)
|
||||
|
||||
val pumpDescription = PumpDescription()
|
||||
|
|
|
@ -7,7 +7,6 @@ import info.nightscout.androidaps.TestBase
|
|||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
|
||||
|
@ -32,7 +31,7 @@ class BolusWizardTest : TestBase() {
|
|||
@Mock lateinit var context: Context
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var loopPlugin: LoopPlugin
|
||||
@Mock lateinit var loop: Loop
|
||||
@Mock lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||
@Mock lateinit var dateUtil: DateUtil
|
||||
|
@ -48,7 +47,7 @@ class BolusWizardTest : TestBase() {
|
|||
it.constraintChecker = constraintChecker
|
||||
it.activePlugin = activePlugin
|
||||
it.commandQueue = commandQueue
|
||||
it.loopPlugin = loopPlugin
|
||||
it.loop = loop
|
||||
it.iobCobCalculator = iobCobCalculator
|
||||
it.glucoseStatusProvider = GlucoseStatusProvider(aapsLogger = aapsLogger, iobCobCalculator = iobCobCalculator, dateUtil = dateUtil)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import javax.inject.Inject
|
|||
|
||||
class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
|
||||
|
||||
@Inject lateinit var loopPlugin: Loop
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
|
@ -33,8 +33,8 @@ class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
|
|||
@DrawableRes override fun icon(): Int = R.drawable.ic_pause_circle_outline_24dp
|
||||
|
||||
override fun doAction(callback: Callback) {
|
||||
if (!loopPlugin.isSuspended) {
|
||||
loopPlugin.suspendLoop(minutes.getMinutes())
|
||||
if (!loop.isSuspended) {
|
||||
loop.suspendLoop(minutes.getMinutes())
|
||||
rxBus.send(EventRefreshOverview("ActionLoopSuspend"))
|
||||
uel.log(
|
||||
UserEntry.Action.SUSPEND, Sources.Automation, title + ": " + rh.gs(R.string.suspendloopforXmin, minutes.getMinutes()),
|
||||
|
|
|
@ -17,7 +17,8 @@ import org.junit.Before
|
|||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
|
||||
open class ActionsTestBase : TestBaseWithProfile() {
|
||||
open class
|
||||
ActionsTestBase : TestBaseWithProfile() {
|
||||
|
||||
open class TestLoopPlugin(
|
||||
aapsLogger: AAPSLogger,
|
||||
|
@ -31,16 +32,19 @@ open class ActionsTestBase : TestBaseWithProfile() {
|
|||
private var suspended = false
|
||||
override var lastRun: Loop.LastRun? = Loop.LastRun()
|
||||
override val isSuspended: Boolean = suspended
|
||||
override val isLGS: Boolean = false
|
||||
override val isSuperBolus: Boolean = false
|
||||
override val isDisconnected: Boolean = false
|
||||
override var enabled: Boolean
|
||||
get() = true
|
||||
set(_) {}
|
||||
|
||||
override fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean) {}
|
||||
override fun acceptChangeRequest() {}
|
||||
override fun minutesToEndOfSuspend(): Int = 0
|
||||
|
||||
override fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason) {
|
||||
}
|
||||
|
||||
override fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason) {}
|
||||
override fun suspendLoop(durationInMinutes: Int) {}
|
||||
override fun disableCarbSuggestions(durationMinutes: Int) {}
|
||||
}
|
||||
|
||||
@Mock lateinit var sp: SP
|
||||
|
@ -99,7 +103,7 @@ open class ActionsTestBase : TestBaseWithProfile() {
|
|||
}
|
||||
if (it is ActionLoopSuspend) {
|
||||
it.aapsLogger = aapsLogger
|
||||
it.loopPlugin = loopPlugin
|
||||
it.loop = loopPlugin
|
||||
it.rh = rh
|
||||
it.rxBus = rxBus
|
||||
it.uel = uel
|
||||
|
|
|
@ -28,7 +28,7 @@ fun DeviceStatus.toJson(dateUtil: DateUtil): JSONObject =
|
|||
|
||||
fun buildDeviceStatus(
|
||||
dateUtil: DateUtil,
|
||||
loopPlugin: Loop,
|
||||
loop: Loop,
|
||||
iobCobCalculatorPlugin: IobCobCalculator,
|
||||
profileFunction: ProfileFunction,
|
||||
pump: Pump,
|
||||
|
@ -39,7 +39,7 @@ fun buildDeviceStatus(
|
|||
val profile = profileFunction.getProfile() ?: return null
|
||||
val profileName = profileFunction.getProfileName()
|
||||
|
||||
val lastRun = loopPlugin.lastRun
|
||||
val lastRun = loop.lastRun
|
||||
var apsResult: JSONObject? = null
|
||||
var iob: JSONObject? = null
|
||||
var enacted: JSONObject? = null
|
||||
|
|
|
@ -23,9 +23,16 @@ interface Loop {
|
|||
|
||||
var lastRun: LastRun?
|
||||
val isSuspended: Boolean
|
||||
val isLGS: Boolean
|
||||
val isSuperBolus: Boolean
|
||||
val isDisconnected: Boolean
|
||||
var enabled: Boolean
|
||||
|
||||
fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean = false)
|
||||
|
||||
fun acceptChangeRequest()
|
||||
fun minutesToEndOfSuspend(): Int
|
||||
fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason)
|
||||
fun suspendLoop(durationInMinutes: Int)
|
||||
fun disableCarbSuggestions(durationMinutes: Int)
|
||||
}
|
Loading…
Reference in a new issue