move LoopPlugin

This commit is contained in:
Milos Kozak 2022-12-01 18:50:19 +01:00
parent 1ac1345797
commit becce286d9
24 changed files with 64 additions and 70 deletions

View file

@ -0,0 +1,6 @@
package info.nightscout.rx.events
/**
* Created by mike on 05.08.2016.
*/
class EventLoopUpdateGui : EventUpdateGui()

View file

@ -0,0 +1,3 @@
package info.nightscout.rx.events
class EventNewOpenLoopNotification : Event()

View file

@ -2,4 +2,5 @@ package info.nightscout.interfaces.pump
interface VirtualPump {
var fakeDataDetected: Boolean
fun isEnabled(): Boolean
}

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -46,6 +46,8 @@
<string name="mute">Mute</string>
<string name="success">Success</string>
<string name="advancedsettings_title">Advanced Settings</string>
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="aps_mode_title">APS Mode</string>
<!-- Protection-->
<string name="unlock_settings">Unlock settings</string>

View file

@ -143,5 +143,7 @@
<string name="key_application_protection" translatable="false">application_protection</string>
<string name="key_bolus_protection" translatable="false">bolus_protection</string>
<string name="key_protection_timeout" translatable="false">protection_timeout</string>
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
<string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string>
</resources>

View file

@ -3,15 +3,17 @@ package info.nightscout.plugins.aps.di
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.autotune.Autotune
import info.nightscout.plugins.aps.OpenAPSFragment
import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.general.autotune.AutotunePlugin
@Module(
includes = [
AutotuneModule::class,
AlgModule::class,
LoopModule::class,
ApsModule.Bindings::class
]
)
@ -24,6 +26,7 @@ abstract class ApsModule {
@Module
interface Bindings {
@Binds fun bindAutotuneInterface(autotunePlugin: AutotunePlugin): Autotune
@Binds fun bindLoop(loopPlugin: LoopPlugin): Loop
@Binds fun bindAutotune(autotunePlugin: AutotunePlugin): Autotune
}
}

View file

@ -1,13 +1,11 @@
package info.nightscout.plugins.di
package info.nightscout.plugins.aps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.aps.loop.CarbSuggestionReceiver
import info.nightscout.plugins.aps.loop.LoopFragment
@Module
@Suppress("unused")
abstract class LoopModule {
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
@ContributesAndroidInjector abstract fun contributesCarbSuggestionReceiver(): CarbSuggestionReceiver
@ContributesAndroidInjector abstract fun contributesLoopFragment(): info.nightscout.plugins.aps.loop.LoopFragment
@ContributesAndroidInjector abstract fun contributesCarbSuggestionReceiver(): info.nightscout.plugins.aps.loop.CarbSuggestionReceiver
}

View file

@ -17,10 +17,10 @@ import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.R
import info.nightscout.plugins.aps.databinding.LoopFragmentBinding
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.plugins.databinding.LoopFragmentBinding
import info.nightscout.rx.events.EventLoopUpdateGui
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger

View file

@ -50,18 +50,18 @@ import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.VirtualPump
import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.queue.Callback
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.R
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
import info.nightscout.rx.events.EventLoopUpdateGui
import info.nightscout.rx.events.EventNewOpenLoopNotification
import info.nightscout.plugins.aps.loop.extensions.json
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAcceptOpenLoopChange
@ -97,7 +97,7 @@ class LoopPlugin @Inject constructor(
private val context: Context,
private val commandQueue: CommandQueue,
private val activePlugin: ActivePlugin,
private val virtualPumpPlugin: VirtualPumpPlugin,
private val virtualPump: VirtualPump,
private val iobCobCalculator: IobCobCalculator,
private val receiverStatusStore: ReceiverStatusStore,
private val fabricPrivacy: FabricPrivacy,
@ -668,7 +668,7 @@ class LoopPlugin @Inject constructor(
}
private fun allowPercentage(): Boolean {
return virtualPumpPlugin.isEnabled()
return virtualPump.isEnabled()
}
override fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason) {

View file

@ -3,7 +3,7 @@
android:id="@+id/swipeRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".aps.loop.LoopFragment">
tools:context=".loop.LoopFragment">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"

View file

@ -121,4 +121,33 @@
<!-- Autotune -->
<string name="insulin_peak">Peak</string>
<!-- Loop -->
<string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string>
<string name="run_now">Run now</string>
<string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
<string name="pump_not_initialized">Pump not initialized!</string>
<string name="loop_shortname">LOOP</string>
<string name="description_loop">Activate or deactivate the implementation triggering the loop.</string>
<string name="no_aps_selected">NO APS SELECTED OR PROVIDED RESULT</string>
<string name="ignore5m">Ignore 5m</string>
<string name="ignore15m">Ignore 15m</string>
<string name="ignore30m">Ignore 30m</string>
<string name="carbs_suggestion">Carbs Suggestion</string>
<string name="open_loop_new_suggestion">New suggestion available</string>
<string name="basal_set_correctly">Basal set correctly</string>
<string name="last_run_label">Last run</string>
<string name="loop_aps_label">APS</string>
<string name="request_label">Request</string>
<string name="loop_constraints_processed_label">After processed constraints</string>
<string name="loop_tbr_request_time_label">Temp basal request time</string>
<string name="loop_tbr_execution_time_label">Temp basal execution time</string>
<string name="loop_tbr_set_by_pump_label">Temp basal set by pump</string>
<string name="loop_smb_request_time_label">SMB request time</string>
<string name="loop_smb_execution_time_label">SMB execution time</string>
<string name="loop_smb_set_by_pump_label">SMB set by pump</string>
<string name="loop_open_mode_min_change">Minimal request change [%]</string>
<string name="loop_open_mode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
</resources>

View file

@ -1,8 +0,0 @@
package info.nightscout.plugins.aps.loop.events
import info.nightscout.rx.events.EventUpdateGui
/**
* Created by mike on 05.08.2016.
*/
class EventLoopUpdateGui : EventUpdateGui()

View file

@ -1,5 +0,0 @@
package info.nightscout.plugins.aps.loop.events
import info.nightscout.rx.events.Event
class EventNewOpenLoopNotification : Event()

View file

@ -3,10 +3,8 @@ package info.nightscout.plugins.di
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.general.wear.WearFragment
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
@ -23,7 +21,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
ObjectivesModule::class,
SkinsModule::class,
SkinsUiModule::class,
LoopModule::class,
ActionsModule::class,
WearModule::class,
OverviewModule::class
@ -40,6 +37,5 @@ abstract class PluginsModule {
@Binds fun bindSmsCommunicator(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
@Binds fun bindIobCobCalculator(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator
@Binds fun bindLoop(loopPlugin: LoopPlugin): Loop
}
}

View file

@ -22,12 +22,12 @@ import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.receivers.Intents
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.Event
import info.nightscout.rx.events.EventAutosensCalculationFinished
import info.nightscout.rx.events.EventLoopUpdateGui
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag

View file

@ -68,7 +68,6 @@ import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.interfaces.utils.TrendCalculator
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
import info.nightscout.plugins.databinding.OverviewFragmentBinding
import info.nightscout.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.plugins.general.overview.graphData.GraphData
@ -85,6 +84,7 @@ import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
import info.nightscout.rx.events.EventExtendedBolusChange
import info.nightscout.rx.events.EventMobileToWear
import info.nightscout.rx.events.EventNewBG
import info.nightscout.rx.events.EventNewOpenLoopNotification
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventPumpStatusChanged
import info.nightscout.rx.events.EventRefreshOverview

View file

@ -7,13 +7,13 @@ import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.plugins.general.wear.wearintegration.DataHandlerMobile
import info.nightscout.plugins.general.wear.wearintegration.DataLayerListenerServiceMobileHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAutosensCalculationFinished
import info.nightscout.rx.events.EventDismissBolusProgressIfRunning
import info.nightscout.rx.events.EventLoopUpdateGui
import info.nightscout.rx.events.EventMobileToWear
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange

View file

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="key_objectiveuseactions" translatable="false">ObjectivesActionsUsed</string>
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
<string name="key_objectiveusescale" translatable="false">ObjectivesScaleUsed</string>
<string name="key_objectives_request_code" translatable="false">objectives_request_code</string>
<string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string>
<string name="objectives_button_start">Start</string>
<string name="objectives_button_verify">Verify</string>

View file

@ -229,7 +229,6 @@
<string name="pb_label">Pump battery</string>
<string name="cannula">Cannula</string>
<string name="ebstopsloop">Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?</string>
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="statuslights_cannula_age">cannula age</string>
<string name="statuslights_patch_pump_age">patch pump age</string>
<string name="patch_pump">Patch pump</string>
@ -290,7 +289,6 @@
<string name="a11y_bg_quality">blood glucose quality</string>
<string name="a11y_blood_glucose">blood glucose</string>
<string name="a11y_bg_outdated">outdated</string>
<string name="aps_mode_title">APS Mode</string>
<string name="set_basal_question">Accept new temp basal:</string>
<string name="overview_cgm">CGM</string>
<string name="quickwizard">QuickWizard</string>
@ -461,35 +459,6 @@
<string name="largedisplay_description">Large display</string>
<string name="skin">Skin</string>
<!-- Loop -->
<string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string>
<string name="executing">Executing</string>
<string name="run_now">Run now</string>
<string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
<string name="pump_not_initialized">Pump not initialized!</string>
<string name="loop_shortname">LOOP</string>
<string name="description_loop">Activate or deactivate the implementation triggering the loop.</string>
<string name="no_aps_selected">NO APS SELECTED OR PROVIDED RESULT</string>
<string name="ignore5m">Ignore 5m</string>
<string name="ignore15m">Ignore 15m</string>
<string name="ignore30m">Ignore 30m</string>
<string name="carbs_suggestion">Carbs Suggestion</string>
<string name="open_loop_new_suggestion">New suggestion available</string>
<string name="basal_set_correctly">Basal set correctly</string>
<string name="last_run_label">Last run</string>
<string name="loop_aps_label">APS</string>
<string name="request_label">Request</string>
<string name="loop_constraints_processed_label">After processed constraints</string>
<string name="loop_tbr_request_time_label">Temp basal request time</string>
<string name="loop_tbr_execution_time_label">Temp basal execution time</string>
<string name="loop_tbr_set_by_pump_label">Temp basal set by pump</string>
<string name="loop_smb_request_time_label">SMB request time</string>
<string name="loop_smb_execution_time_label">SMB execution time</string>
<string name="loop_smb_set_by_pump_label">SMB set by pump</string>
<string name="loop_open_mode_min_change">Minimal request change [%]</string>
<string name="loop_open_mode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
<!-- DataBroadcast-->
<string name="data_broadcaster" translatable="false">Data Broadcaster</string>
<string name="cannula_usage">usage:</string>