From c04993ddadae21ff956f0c67e6e25b9d550694a1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 14 Apr 2021 00:45:30 +0200 Subject: [PATCH] rename interfaces, cleanup --- .../nightscout/androidaps/MainActivity.kt | 4 +- .../activities/ProfileHelperActivity.kt | 4 +- .../androidaps/activities/SurveyActivity.kt | 4 +- .../androidaps/db/DatabaseHelper.java | 4 +- .../dependencyInjection/AppModule.kt | 2 +- .../androidaps/dialogs/ExtendedBolusDialog.kt | 4 +- .../androidaps/dialogs/FillDialog.kt | 4 +- .../androidaps/dialogs/InsulinDialog.kt | 4 +- .../androidaps/dialogs/LoopDialog.kt | 2 +- .../androidaps/dialogs/ProfileSwitchDialog.kt | 4 +- .../androidaps/dialogs/TempBasalDialog.kt | 2 +- .../androidaps/dialogs/TreatmentDialog.kt | 4 +- .../androidaps/dialogs/WizardDialog.kt | 4 +- .../historyBrowser/HistoryBrowseActivity.kt | 4 +- .../IobCobCalculatorPluginHistory.kt | 4 +- .../historyBrowser/TreatmentsPluginHistory.kt | 4 +- .../androidaps/plugins/aps/loop/LoopPlugin.kt | 2 +- .../aps/openAPSAMA/OpenAPSAMAPlugin.kt | 4 +- .../openAPSSMB/DetermineBasalAdapterSMBJS.kt | 7 +- .../aps/openAPSSMB/OpenAPSSMBPlugin.kt | 4 +- .../configBuilder/ConfigBuilderFragment.kt | 12 +- .../configBuilder/ConfigBuilderPlugin.kt | 10 +- .../plugins/configBuilder/PluginStore.kt | 109 +++++---------- .../constraints/dstHelper/DstHelperPlugin.kt | 2 +- .../objectives/ObjectivesPlugin.kt | 2 +- .../objectives/objectives/Objective0.kt | 4 +- .../constraints/safety/SafetyPlugin.kt | 2 +- .../general/actions/ActionsFragment.kt | 4 +- .../dataBroadcaster/DataBroadcastPlugin.kt | 2 +- .../DataSyncSelectorImplementation.kt | 6 +- .../general/overview/OverviewFragment.kt | 2 +- .../general/overview/OverviewPlugin.kt | 5 +- .../general/overview/StatusLightHandler.kt | 4 +- .../general/overview/graphData/GraphData.kt | 2 +- .../graphExtensions/BolusDataPoint.kt | 4 +- .../PersistentNotificationPlugin.kt | 2 +- .../smsCommunicator/SmsCommunicatorPlugin.kt | 2 +- .../general/tidepool/comm/TidepoolUploader.kt | 4 +- .../general/tidepool/comm/UploadChunk.kt | 4 +- .../general/wear/ActionStringHandler.kt | 2 +- .../wearintegration/WatchUpdaterService.java | 4 +- .../xdripStatusline/StatusLinePlugin.kt | 2 +- .../plugins/insulin/ActivityGraph.kt | 4 +- .../plugins/insulin/InsulinFragment.kt | 4 +- .../plugins/insulin/InsulinLyumjevPlugin.kt | 4 +- .../plugins/insulin/InsulinOrefBasePlugin.kt | 25 +--- .../insulin/InsulinOrefFreePeakPlugin.kt | 4 +- .../insulin/InsulinOrefRapidActingPlugin.kt | 4 +- .../InsulinOrefUltraRapidActingPlugin.kt | 4 +- .../IobCobCalculatorPlugin.kt | 2 +- .../iob/iobCobCalculator/IobCobOref1Thread.kt | 4 +- .../iob/iobCobCalculator/IobCobThread.kt | 4 +- .../profile/local/LocalProfileFragment.kt | 4 +- .../sensitivity/AbstractSensitivityPlugin.kt | 10 +- .../sensitivity/SensitivityAAPSPlugin.kt | 2 +- .../sensitivity/SensitivityOref1Plugin.kt | 2 +- .../SensitivityWeightedAveragePlugin.kt | 2 +- .../plugins/source/BGSourceFragment.kt | 4 +- .../androidaps/plugins/source/DexcomPlugin.kt | 6 +- .../plugins/source/EversensePlugin.kt | 6 +- .../androidaps/plugins/source/GlimpPlugin.kt | 6 +- .../androidaps/plugins/source/MM640gPlugin.kt | 6 +- .../plugins/source/NSClientSourcePlugin.kt | 6 +- .../plugins/source/PoctechPlugin.kt | 6 +- .../plugins/source/RandomBgPlugin.kt | 6 +- .../androidaps/plugins/source/TomatoPlugin.kt | 6 +- .../androidaps/plugins/source/XdripPlugin.kt | 6 +- .../plugins/treatments/TreatmentsFragment.kt | 4 +- .../plugins/treatments/TreatmentsPlugin.java | 6 +- .../fragments/TreatmentsBolusCarbsFragment.kt | 4 +- .../TreatmentsExtendedBolusesFragment.kt | 4 +- .../TreatmentsTemporaryBasalsFragment.kt | 4 +- .../androidaps/queue/CommandQueue.kt | 4 +- .../androidaps/queue/QueueThread.kt | 4 +- .../androidaps/queue/commands/CommandBolus.kt | 4 +- .../commands/CommandCancelExtendedBolus.kt | 4 +- .../queue/commands/CommandCancelTempBasal.kt | 4 +- .../queue/commands/CommandCustomCommand.kt | 4 +- .../queue/commands/CommandExtendedBolus.kt | 4 +- .../CommandInsightSetTBROverNotification.kt | 4 +- .../queue/commands/CommandLoadEvents.kt | 4 +- .../queue/commands/CommandLoadHistory.kt | 4 +- .../queue/commands/CommandLoadTDDs.kt | 4 +- .../queue/commands/CommandReadStatus.kt | 4 +- .../queue/commands/CommandSMBBolus.kt | 4 +- .../queue/commands/CommandSetProfile.kt | 4 +- .../queue/commands/CommandSetUserSettings.kt | 4 +- .../queue/commands/CommandStartPump.kt | 4 +- .../queue/commands/CommandStopPump.kt | 4 +- .../commands/CommandTempBasalAbsolute.kt | 4 +- .../queue/commands/CommandTempBasalPercent.kt | 4 +- .../androidaps/receivers/KeepAliveReceiver.kt | 4 +- .../receivers/TimeDateOrTZChangeReceiver.kt | 4 +- .../androidaps/setupwizard/SWDefinition.kt | 6 +- .../androidaps/utils/LocalAlertUtils.kt | 4 +- .../androidaps/utils/stats/TddCalculator.kt | 4 +- .../androidaps/utils/wizard/BolusWizard.kt | 2 +- .../androidaps/TestBaseWithProfile.kt | 3 +- .../interfaces/ConstraintsCheckerTest.kt | 2 +- .../plugins/aps/loop/LoopPluginTest.kt | 3 +- .../configBuilder/ConfigBuilderPluginTest.kt | 4 +- .../dstHelper/DstHelperPluginTest.kt | 4 +- .../objectives/ObjectivesPluginTest.kt | 4 +- .../constraints/safety/SafetyPluginTest.kt | 4 +- .../SmsCommunicatorPluginTest.kt | 4 +- .../insulin/InsulinLyumjevPluginTest.kt | 4 +- .../insulin/InsulinOrefBasePluginTest.kt | 8 +- .../insulin/InsulinOrefFreePeakPluginTest.kt | 4 +- .../InsulinOrefRapidActingPluginTest.kt | 4 +- .../InsulinOrefUltraRapidActingPluginTest.kt | 4 +- .../AbstractSensitivityPluginTest.kt | 6 +- .../androidaps/queue/CommandQueueTest.kt | 8 +- .../androidaps/queue/QueueThreadTest.kt | 6 +- .../utils/wizard/BolusWizardTest.kt | 2 +- .../automation/actions/ActionProfileSwitch.kt | 4 +- .../actions/ActionProfileSwitchPercent.kt | 4 +- .../actions/ActionStartTempTarget.kt | 4 +- .../automation/elements/InputProfileName.kt | 4 +- .../general/automation/triggers/Trigger.kt | 4 +- .../general/automation/TestBaseWithProfile.kt | 4 +- .../automation/actions/ActionsTestBase.kt | 2 +- .../automation/triggers/TriggerTestBase.kt | 4 +- .../plugins/pump/combo/ComboPluginTest.kt | 2 +- .../androidaps/activities/TDDStatsActivity.kt | 4 +- .../androidaps/core/di/CoreModule.kt | 4 +- .../nightscout/androidaps/data/Profile.java | 4 +- .../androidaps/db/ExtendedBolus.java | 96 +------------ .../androidaps/db/TemporaryBasal.java | 131 +----------------- .../nightscout/androidaps/db/Treatment.java | 9 +- .../androidaps/dialogs/ProfileViewerDialog.kt | 4 +- .../androidaps/extensions/BolusExtension.kt | 8 +- .../extensions/ExtendedBolusExtension.kt | 6 +- .../extensions/TemporaryBasalExtension.kt | 6 +- .../interfaces/{APSInterface.kt => APS.kt} | 2 +- .../androidaps/interfaces/ActivePlugin.kt | 74 ++++++++++ .../interfaces/ActivePluginProvider.kt | 22 --- .../androidaps/interfaces/BgSource.kt | 29 ++++ .../interfaces/BgSourceInterface.kt | 14 -- ...portInterface.kt => ConfigExportImport.kt} | 2 +- .../{InsulinInterface.kt => Insulin.kt} | 11 +- .../androidaps/interfaces/Overview.kt | 3 + .../interfaces/OverviewInterface.kt | 3 - .../androidaps/interfaces/PluginBase.kt | 6 +- ...SensitivityInterface.kt => Sensitivity.kt} | 2 +- .../androidaps/plugins/aps/loop/APSResult.kt | 4 +- .../configBuilder/ConstraintChecker.kt | 4 +- .../ProfileFunctionImplementation.kt | 4 +- .../configBuilder/RunningConfiguration.kt | 20 +-- .../androidaps/TestBaseWithProfile.kt | 4 +- .../androidaps/dana/DanaFragment.kt | 4 +- .../dana/activities/DanaHistoryActivity.kt | 4 +- .../activities/DanaUserOptionsActivity.kt | 4 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../danaRKorean/DanaRKoreanPlugin.kt | 4 +- .../services/DanaRKoreanExecutionService.java | 4 +- .../androidaps/danaRv2/DanaRv2Plugin.java | 4 +- .../services/DanaRv2ExecutionService.java | 4 +- .../androidaps/danar/AbstractDanaRPlugin.java | 6 +- .../androidaps/danar/DanaRPlugin.java | 4 +- .../androidaps/danar/comm/MessageBase.java | 4 +- .../AbstractDanaRExecutionService.java | 4 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 6 +- .../danars/services/DanaRSService.kt | 4 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../DanaRSPacketNotifyDeliveryCompleteTest.kt | 4 +- .../danars/comm/DanaRsMessageHashTableTest.kt | 4 +- .../comm/DanaRsPacketApsHistoryEventsTest.kt | 4 +- .../DanaRsPacketBolusSetStepBolusStopTest.kt | 4 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 4 +- .../pump/common/PumpPluginAbstract.java | 6 +- .../pump/medtronic/MedtronicFragment.kt | 4 +- .../pump/medtronic/MedtronicPumpPlugin.java | 4 +- .../medtronic/data/MedtronicHistoryData.java | 6 +- .../MedtronicPumpHistoryDecoderUTest.java | 4 +- .../omnipod/eros/OmnipodErosPumpPlugin.java | 6 +- .../eros/manager/AapsOmnipodErosManager.java | 6 +- .../eros/ui/OmnipodErosOverviewFragment.kt | 4 +- .../eros/OmnipodErosPumpPluginTest.java | 6 +- .../dialog/RileyLinkBLEConfigActivity.java | 4 +- .../RileyLinkCommunicationManager.java | 6 +- .../RileyLinkStatusGeneralFragment.java | 4 +- .../RileyLinkBluetoothStateReceiver.kt | 4 +- .../service/RileyLinkBroadcastReceiver.java | 4 +- .../rileylink/service/RileyLinkService.java | 4 +- .../service/RileyLinkServiceData.java | 4 +- .../tasks/DiscoverGattServicesTask.java | 1 - .../ResetRileyLinkConfigurationTask.java | 4 +- .../rileylink/service/tasks/ServiceTask.java | 4 +- .../service/tasks/WakeAndTuneTask.java | 1 - 190 files changed, 528 insertions(+), 752 deletions(-) rename core/src/main/java/info/nightscout/androidaps/interfaces/{APSInterface.kt => APS.kt} (90%) create mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt delete mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt create mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt delete mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/BgSourceInterface.kt rename core/src/main/java/info/nightscout/androidaps/interfaces/{ConfigExportImportInterface.kt => ConfigExportImport.kt} (80%) rename core/src/main/java/info/nightscout/androidaps/interfaces/{InsulinInterface.kt => Insulin.kt} (64%) create mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt delete mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt rename core/src/main/java/info/nightscout/androidaps/interfaces/{SensitivityInterface.kt => Sensitivity.kt} (92%) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index 893e4c87cc..3abfe284f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -39,7 +39,7 @@ import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IconsProvider import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger @@ -83,7 +83,7 @@ class MainActivity : NoSplashAppCompatActivity() { @Inject lateinit var loopPlugin: LoopPlugin @Inject lateinit var nsSettingsStatus: NSSettingsStatus @Inject lateinit var buildHelper: BuildHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var iconsProvider: IconsProvider diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt index 03e6cf9a7c..406e4cb730 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.data.defaultProfile.DefaultProfileDPV import info.nightscout.androidaps.databinding.ActivityProfilehelperBinding import info.nightscout.androidaps.db.ProfileSwitch import info.nightscout.androidaps.dialogs.ProfileViewerDialog -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -39,7 +39,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { @Inject lateinit var localProfilePlugin: LocalProfilePlugin @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var dateUtil: DateUtil - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var databaseHelper: DatabaseHelperInterface enum class ProfileType { diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt index 6a06bf36e0..97d70548ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.data.defaultProfile.DefaultProfile import info.nightscout.androidaps.databinding.ActivitySurveyBinding import info.nightscout.androidaps.dialogs.ProfileViewerDialog -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -24,7 +24,7 @@ import javax.inject.Inject class SurveyActivity : NoSplashAppCompatActivity() { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var tddCalculator: TddCalculator @Inject lateinit var tirCalculator: TirCalculator @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index bc97a25b54..fc21a77edd 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -37,7 +37,7 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.events.EventProfileNeedsUpdate; import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.events.EventReloadProfileSwitchData; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileStore; @@ -63,7 +63,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { @Inject RxBusWrapper rxBus; @Inject VirtualPumpPlugin virtualPumpPlugin; @Inject OpenHumansUploader openHumansUploader; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject NSUpload nsUpload; @Inject DateUtil dateUtil; diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt index e467f4f9bb..8afe2ddf75 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt @@ -75,7 +75,7 @@ open class AppModule { interface AppBindings { @Binds fun bindContext(mainApp: MainApp): Context @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector - @Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider + @Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePlugin @Binds fun bindCommandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider @Binds fun bindConfigInterface(config: Config): ConfigInterface @Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt index b539a78b68..e3ed95451c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.UserEntryLogger @@ -34,7 +34,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger private var _binding: DialogExtendedbolusBinding? = null diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt index 5282ee0ca6..f9cf203e5e 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt @@ -16,7 +16,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.androidaps.databinding.DialogFillBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.LTag @@ -41,7 +41,7 @@ class FillDialog : DialogFragmentWithDate() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var ctx: Context @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger @Inject lateinit var repository: AppRepository diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt index b2ab0b7443..6539928ed8 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -21,7 +21,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction import info.nightscout.androidaps.databinding.DialogInsulinBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ProfileFunction @@ -51,7 +51,7 @@ class InsulinDialog : DialogFragmentWithDate() { @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var ctx: Context @Inject lateinit var repository: AppRepository @Inject lateinit var config: Config diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt index 3973b03491..1941da62c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt @@ -43,7 +43,7 @@ class LoopDialog : DaggerDialogFragment() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var loopPlugin: LoopPlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var configBuilder: ConfigBuilder diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index 08d470d442..6f1d5c0b8f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.databinding.DialogProfileswitchBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin @@ -28,7 +28,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var treatmentsPlugin: TreatmentsPlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger private var profileIndex: Int? = null diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index e577fe0dd1..03f7bc4aa7 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -31,7 +31,7 @@ class TempBasalDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var ctx: Context @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt index 9fd4dbb89b..021d0039c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt @@ -17,7 +17,7 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.databinding.DialogTreatmentBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.LTag @@ -42,7 +42,7 @@ class TreatmentDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var ctx: Context @Inject lateinit var config: Config diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index 776298b402..77b277fea7 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.ValueWrapper import info.nightscout.androidaps.databinding.DialogWizardBinding import info.nightscout.androidaps.events.EventAutosensCalculationFinished -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction @@ -60,7 +60,7 @@ class WizardDialog : DaggerDialogFragment() { @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var repository: AppRepository @Inject lateinit var dateUtil: DateUtil diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt index dfe6d65980..144b62f6fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt @@ -16,7 +16,7 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity import info.nightscout.androidaps.databinding.ActivityHistorybrowseBinding import info.nightscout.androidaps.events.EventCustomCalculationFinished import info.nightscout.androidaps.events.EventRefreshOverview -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -51,7 +51,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var iobCobCalculatorPluginHistory: IobCobCalculatorPluginHistory @Inject lateinit var treatmentsPluginHistory: TreatmentsPluginHistory - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var buildHelper: BuildHelper @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var overviewMenus: OverviewMenus diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/IobCobCalculatorPluginHistory.kt b/app/src/main/java/info/nightscout/androidaps/historyBrowser/IobCobCalculatorPluginHistory.kt index 65df3b28e8..1dfc35f70a 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/IobCobCalculatorPluginHistory.kt +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/IobCobCalculatorPluginHistory.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.historyBrowser import dagger.android.HasAndroidInjector import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -27,7 +27,7 @@ class IobCobCalculatorPluginHistory @Inject constructor( sp: SP, resourceHelper: ResourceHelper, profileFunction: ProfileFunction, - activePlugin: ActivePluginProvider, + activePlugin: ActivePlugin, sensitivityOref1Plugin: SensitivityOref1Plugin, sensitivityAAPSPlugin: SensitivityAAPSPlugin, sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin, diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/TreatmentsPluginHistory.kt b/app/src/main/java/info/nightscout/androidaps/historyBrowser/TreatmentsPluginHistory.kt index 1fb1652bfb..c1fe715abe 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/TreatmentsPluginHistory.kt +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/TreatmentsPluginHistory.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.historyBrowser import android.content.Context import dagger.android.HasAndroidInjector import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -29,7 +29,7 @@ class TreatmentsPluginHistory @Inject constructor( context: Context, sp: SP, profileFunction: ProfileFunction, - activePlugin: ActivePluginProvider, + activePlugin: ActivePlugin, nsUpload: NSUpload, fabricPrivacy: FabricPrivacy, dateUtil: DateUtil, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt index b44aa7f975..6c7e8a3ac5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt @@ -76,7 +76,7 @@ open class LoopPlugin @Inject constructor( private val profileFunction: ProfileFunction, private val context: Context, private val commandQueue: CommandQueueProvider, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val virtualPumpPlugin: VirtualPumpPlugin, private val iobCobCalculator: IobCobCalculator, private val receiverStatusStore: ReceiverStatusStore, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt index ccb16a6665..42af7bf765 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt @@ -36,7 +36,7 @@ open class OpenAPSAMAPlugin @Inject constructor( resourceHelper: ResourceHelper, private val profileFunction: ProfileFunction, private val context: Context, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val iobCobCalculator: IobCobCalculator, private val hardLimits: HardLimits, private val profiler: Profiler, @@ -53,7 +53,7 @@ open class OpenAPSAMAPlugin @Inject constructor( .preferencesId(R.xml.pref_openapsama) .description(R.string.description_ama), aapsLogger, resourceHelper, injector -), APSInterface { +), APS { // last values override var lastAPSRun: Long = 0 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt index 355848150e..6f00336ed0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.data.IobTotal import info.nightscout.androidaps.data.MealData import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -16,7 +16,6 @@ import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.utils.SafeParse import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.getPassedDurationToTimeInMinutes @@ -41,7 +40,7 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader: @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var iobCobCalculator: IobCobCalculator - @Inject lateinit var activePluginProvider: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var openHumansUploader: OpenHumansUploader private var profile = JSONObject() @@ -176,7 +175,7 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader: advancedFiltering: Boolean, isSaveCgmSource: Boolean ) { - val pump = activePluginProvider.activePump + val pump = activePlugin.activePump val pumpBolusStep = pump.pumpDescription.bolusStep this.profile.put("max_iob", maxIob) //mProfile.put("dia", profile.getDia()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt index 7aafe2883f..c71f170416 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt @@ -37,7 +37,7 @@ open class OpenAPSSMBPlugin @Inject constructor( resourceHelper: ResourceHelper, private val profileFunction: ProfileFunction, private val context: Context, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val iobCobCalculator: IobCobCalculator, private val hardLimits: HardLimits, private val profiler: Profiler, @@ -55,7 +55,7 @@ open class OpenAPSSMBPlugin @Inject constructor( .description(R.string.description_smb) .setDefault(), aapsLogger, resourceHelper, injector -), APSInterface, ConstraintsInterface { +), APS, ConstraintsInterface { // last values override var lastAPSRun: Long = 0 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt index 207384ac30..4db406e9e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt @@ -34,7 +34,7 @@ class ConfigBuilderFragment : DaggerFragment() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var configBuilderPlugin: ConfigBuilderPlugin @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var config: Config @@ -101,18 +101,18 @@ class ConfigBuilderFragment : DaggerFragment() { private fun updateGUI() { binding.categories.removeAllViews() if (!config.NSCLIENT) { - createViewsForPlugins(R.string.configbuilder_profile, R.string.configbuilder_profile_description, PluginType.PROFILE, activePlugin.getSpecificPluginsVisibleInListByInterface(ProfileInterface::class.java, PluginType.PROFILE)) + createViewsForPlugins(R.string.configbuilder_profile, R.string.configbuilder_profile_description, PluginType.PROFILE, activePlugin.getSpecificPluginsVisibleInList(PluginType.PROFILE)) } - createViewsForPlugins(R.string.configbuilder_insulin, R.string.configbuilder_insulin_description, PluginType.INSULIN, activePlugin.getSpecificPluginsVisibleInListByInterface(InsulinInterface::class.java, PluginType.INSULIN)) + createViewsForPlugins(R.string.configbuilder_insulin, R.string.configbuilder_insulin_description, PluginType.INSULIN, activePlugin.getSpecificPluginsVisibleInList(PluginType.INSULIN)) if (!config.NSCLIENT) { - createViewsForPlugins(R.string.configbuilder_bgsource, R.string.configbuilder_bgsource_description, PluginType.BGSOURCE, activePlugin.getSpecificPluginsVisibleInListByInterface(BgSourceInterface::class.java, PluginType.BGSOURCE)) + createViewsForPlugins(R.string.configbuilder_bgsource, R.string.configbuilder_bgsource_description, PluginType.BGSOURCE, activePlugin.getSpecificPluginsVisibleInList(PluginType.BGSOURCE)) createViewsForPlugins(R.string.configbuilder_pump, R.string.configbuilder_pump_description, PluginType.PUMP, activePlugin.getSpecificPluginsVisibleInList(PluginType.PUMP)) } - createViewsForPlugins(R.string.configbuilder_sensitivity, R.string.configbuilder_sensitivity_description, PluginType.SENSITIVITY, activePlugin.getSpecificPluginsVisibleInListByInterface(SensitivityInterface::class.java, PluginType.SENSITIVITY)) + createViewsForPlugins(R.string.configbuilder_sensitivity, R.string.configbuilder_sensitivity_description, PluginType.SENSITIVITY, activePlugin.getSpecificPluginsVisibleInList(PluginType.SENSITIVITY)) if (config.APS) { createViewsForPlugins(R.string.configbuilder_aps, R.string.configbuilder_aps_description, PluginType.APS, activePlugin.getSpecificPluginsVisibleInList(PluginType.APS)) createViewsForPlugins(R.string.configbuilder_loop, R.string.configbuilder_loop_description, PluginType.LOOP, activePlugin.getSpecificPluginsVisibleInList(PluginType.LOOP)) - createViewsForPlugins(R.string.constraints, R.string.configbuilder_constraints_description, PluginType.CONSTRAINTS, activePlugin.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface::class.java, PluginType.CONSTRAINTS)) + createViewsForPlugins(R.string.constraints, R.string.configbuilder_constraints_description, PluginType.CONSTRAINTS, activePlugin.getSpecificPluginsVisibleInList(PluginType.CONSTRAINTS)) } createViewsForPlugins(R.string.configbuilder_treatments, R.string.configbuilder_treatments_description, PluginType.TREATMENT, activePlugin.getSpecificPluginsVisibleInList(PluginType.TREATMENT)) createViewsForPlugins(R.string.configbuilder_general, R.string.configbuilder_general_description, PluginType.GENERAL, activePlugin.getSpecificPluginsVisibleInList(PluginType.GENERAL)) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt index ef26bbdc56..ccf362643e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt @@ -29,7 +29,7 @@ class ConfigBuilderPlugin @Inject constructor( resourceHelper: ResourceHelper, private val sp: SP, private val rxBus: RxBusWrapper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val uel: UserEntryLogger, private val pumpSync: PumpSync ) : PluginBase(PluginDescription() @@ -180,11 +180,11 @@ class ConfigBuilderPlugin @Inject constructor( fun processOnEnabledCategoryChanged(changedPlugin: PluginBase, type: PluginType?) { var pluginsInCategory: ArrayList? = null when (type) { - PluginType.INSULIN -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(InsulinInterface::class.java) - PluginType.SENSITIVITY -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(SensitivityInterface::class.java) - PluginType.APS -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(APSInterface::class.java) + PluginType.INSULIN -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Insulin::class.java) + PluginType.SENSITIVITY -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Sensitivity::class.java) + PluginType.APS -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(APS::class.java) PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileInterface::class.java) - PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSourceInterface::class.java) + PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java) PluginType.TREATMENT -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(TreatmentsInterface::class.java) PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(PumpInterface::class.java) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt index 05b020fac4..e3c56686be 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt @@ -11,23 +11,23 @@ import javax.inject.Singleton class PluginStore @Inject constructor( private val aapsLogger: AAPSLogger, private val config: Config -) : ActivePluginProvider { +) : ActivePlugin { lateinit var plugins: List<@JvmSuppressWildcards PluginBase> - private var activeBgSourceStore: BgSourceInterface? = null + private var activeBgSourceStore: BgSource? = null private var activePumpStore: PumpInterface? = null private var activeProfile: ProfileInterface? = null - private var activeAPSStore: APSInterface? = null - private var activeInsulinStore: InsulinInterface? = null - private var activeSensitivityStore: SensitivityInterface? = null + private var activeAPSStore: APS? = null + private var activeInsulinStore: Insulin? = null + private var activeSensitivityStore: Sensitivity? = null private var activeTreatmentsStore: TreatmentsInterface? = null fun loadDefaults() { verifySelectionInCategories() } - fun getDefaultPlugin(type: PluginType): PluginBase { + private fun getDefaultPlugin(type: PluginType): PluginBase { for (p in plugins) if (p.getType() == type && p.isDefault()) return p throw IllegalStateException("Default plugin not found") @@ -41,14 +41,6 @@ class PluginStore @Inject constructor( return newList } - override fun getSpecificPluginsVisibleInList(type: PluginType): ArrayList { - val newList = ArrayList() - for (p in plugins) { - if (p.getType() == type) if (p.showInList(type)) newList.add(p) - } - return newList - } - override fun getSpecificPluginsListByInterface(interfaceClass: Class<*>): ArrayList { val newList = ArrayList() for (p in plugins) { @@ -57,10 +49,10 @@ class PluginStore @Inject constructor( return newList } - override fun getSpecificPluginsVisibleInListByInterface(interfaceClass: Class<*>, type: PluginType): ArrayList { + override fun getSpecificPluginsVisibleInList(type: PluginType): ArrayList { val newList = ArrayList() for (p in plugins) { - if (p.javaClass != ConfigBuilderPlugin::class.java && interfaceClass.isAssignableFrom(p.javaClass)) if (p.showInList(type)) newList.add(p) + if (p.getType() == type) if (p.showInList(type)) newList.add(p) } return newList } @@ -71,34 +63,34 @@ class PluginStore @Inject constructor( // PluginType.APS if (!config.NSCLIENT && !config.PUMPCONTROL) { pluginsInCategory = getSpecificPluginsList(PluginType.APS) - activeAPSStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? + activeAPSStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APS? if (activeAPSStore == null) { - activeAPSStore = getDefaultPlugin(PluginType.APS) as APSInterface + activeAPSStore = getDefaultPlugin(PluginType.APS) as APS (activeAPSStore as PluginBase).setPluginEnabled(PluginType.APS, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface") } - setFragmentVisiblities((activeAPSStore as PluginBase).name, pluginsInCategory, PluginType.APS) + setFragmentVisibilities((activeAPSStore as PluginBase).name, pluginsInCategory, PluginType.APS) } // PluginType.INSULIN pluginsInCategory = getSpecificPluginsList(PluginType.INSULIN) - activeInsulinStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.INSULIN) as InsulinInterface? + activeInsulinStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.INSULIN) as Insulin? if (activeInsulinStore == null) { - activeInsulinStore = getDefaultPlugin(PluginType.INSULIN) as InsulinInterface + activeInsulinStore = getDefaultPlugin(PluginType.INSULIN) as Insulin (activeInsulinStore as PluginBase).setPluginEnabled(PluginType.INSULIN, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting InsulinInterface") } - setFragmentVisiblities((activeInsulinStore as PluginBase).name, pluginsInCategory, PluginType.INSULIN) + setFragmentVisibilities((activeInsulinStore as PluginBase).name, pluginsInCategory, PluginType.INSULIN) // PluginType.SENSITIVITY pluginsInCategory = getSpecificPluginsList(PluginType.SENSITIVITY) - activeSensitivityStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.SENSITIVITY) as SensitivityInterface? + activeSensitivityStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.SENSITIVITY) as Sensitivity? if (activeSensitivityStore == null) { - activeSensitivityStore = getDefaultPlugin(PluginType.SENSITIVITY) as SensitivityInterface + activeSensitivityStore = getDefaultPlugin(PluginType.SENSITIVITY) as Sensitivity (activeSensitivityStore as PluginBase).setPluginEnabled(PluginType.SENSITIVITY, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting SensitivityInterface") } - setFragmentVisiblities((activeSensitivityStore as PluginBase).name, pluginsInCategory, PluginType.SENSITIVITY) + setFragmentVisibilities((activeSensitivityStore as PluginBase).name, pluginsInCategory, PluginType.SENSITIVITY) // PluginType.PROFILE pluginsInCategory = getSpecificPluginsList(PluginType.PROFILE) @@ -108,17 +100,17 @@ class PluginStore @Inject constructor( (activeProfile as PluginBase).setPluginEnabled(PluginType.PROFILE, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting ProfileInterface") } - setFragmentVisiblities((activeProfile as PluginBase).name, pluginsInCategory, PluginType.PROFILE) + setFragmentVisibilities((activeProfile as PluginBase).name, pluginsInCategory, PluginType.PROFILE) // PluginType.BGSOURCE pluginsInCategory = getSpecificPluginsList(PluginType.BGSOURCE) - activeBgSourceStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.BGSOURCE) as BgSourceInterface? + activeBgSourceStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.BGSOURCE) as BgSource? if (activeBgSourceStore == null) { - activeBgSourceStore = getDefaultPlugin(PluginType.BGSOURCE) as BgSourceInterface + activeBgSourceStore = getDefaultPlugin(PluginType.BGSOURCE) as BgSource (activeBgSourceStore as PluginBase).setPluginEnabled(PluginType.BGSOURCE, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting BgInterface") } - setFragmentVisiblities((activeBgSourceStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) + setFragmentVisibilities((activeBgSourceStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) // PluginType.PUMP pluginsInCategory = getSpecificPluginsList(PluginType.PUMP) @@ -128,7 +120,7 @@ class PluginStore @Inject constructor( (activePumpStore as PluginBase).setPluginEnabled(PluginType.PUMP, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface") } - setFragmentVisiblities((activePumpStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) + setFragmentVisibilities((activePumpStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) // PluginType.TREATMENT pluginsInCategory = getSpecificPluginsList(PluginType.TREATMENT) @@ -138,50 +130,11 @@ class PluginStore @Inject constructor( (activeTreatmentsStore as PluginBase).setPluginEnabled(PluginType.TREATMENT, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface") } - setFragmentVisiblities((activeTreatmentsStore as PluginBase).name, pluginsInCategory, PluginType.TREATMENT) + setFragmentVisibilities((activeTreatmentsStore as PluginBase).name, pluginsInCategory, PluginType.TREATMENT) } - /** - * disables the visibility for all fragments of Plugins with the given PluginType - * which are not equally named to the Plugin implementing the given Plugin Interface. - * - * @param pluginInterface - * @param pluginType - * @param - * @return - */ - private fun determineActivePlugin(pluginInterface: Class, pluginType: PluginType): T? { - val pluginsInCategory: ArrayList = getSpecificPluginsListByInterface(pluginInterface) - return determineActivePlugin(pluginsInCategory, pluginType) - } - - /** - * disables the visibility for all fragments of Plugins in the given pluginsInCategory - * with the given PluginType which are not equally named to the Plugin implementing the - * given Plugin Interface. - * - * - * TODO we are casting an interface to PluginBase, which seems to be rather odd, since - * TODO the interface is not implementing PluginBase (this is just avoiding errors through - * TODO conventions. - * - * @param pluginsInCategory - * @param pluginType - * @param - * @return - */ - private fun determineActivePlugin(pluginsInCategory: ArrayList, - pluginType: PluginType): T? { - @Suppress("UNCHECKED_CAST") - val activePlugin = getTheOneEnabledInArray(pluginsInCategory, pluginType) as T? - if (activePlugin != null) { - setFragmentVisiblities((activePlugin as PluginBase).name, pluginsInCategory, pluginType) - } - return activePlugin - } - - private fun setFragmentVisiblities(activePluginName: String, pluginsInCategory: ArrayList, - pluginType: PluginType) { + private fun setFragmentVisibilities(activePluginName: String, pluginsInCategory: ArrayList, + pluginType: PluginType) { aapsLogger.debug(LTag.CONFIGBUILDER, "Selected interface: $activePluginName") for (p in pluginsInCategory) if (p.name != activePluginName) @@ -203,22 +156,22 @@ class PluginStore @Inject constructor( // ***** Interface ***** - override val activeBgSource: BgSourceInterface + override val activeBgSource: BgSource get() = activeBgSourceStore ?: checkNotNull(activeBgSourceStore) { "No bg source selected" } override val activeProfileInterface: ProfileInterface get() = activeProfile ?: checkNotNull(activeProfile) { "No profile selected" } - override val activeInsulin: InsulinInterface + override val activeInsulin: Insulin get() = activeInsulinStore ?: checkNotNull(activeInsulinStore) { "No insulin selected" } - override val activeAPS: APSInterface + override val activeAPS: APS get() = activeAPSStore ?: checkNotNull(activeAPSStore) { "No APS selected" } override val activePump: PumpInterface get() = activePumpStore ?: checkNotNull(activePumpStore) { "No pump selected" } - override val activeSensitivity: SensitivityInterface + override val activeSensitivity: Sensitivity get() = activeSensitivityStore ?: checkNotNull(activeSensitivityStore) { "No sensitivity selected" } @@ -226,8 +179,8 @@ class PluginStore @Inject constructor( get() = activeTreatmentsStore ?: checkNotNull(activeTreatmentsStore) { "No treatments selected" } - override val activeOverview: OverviewInterface - get() = getSpecificPluginsListByInterface(OverviewInterface::class.java).first() as OverviewInterface + override val activeOverview: Overview + get() = getSpecificPluginsListByInterface(Overview::class.java).first() as Overview override fun getPluginsList(): ArrayList = ArrayList(plugins) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.kt index 8292346a11..ba0c03fe02 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.kt @@ -24,7 +24,7 @@ class DstHelperPlugin @Inject constructor( private var rxBus: RxBusWrapper, resourceHelper: ResourceHelper, private var sp: SP, - private var activePlugin: ActivePluginProvider, + private var activePlugin: ActivePlugin, private var loopPlugin: LoopPlugin ) : PluginBase(PluginDescription() .mainType(PluginType.CONSTRAINTS) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt index f101ee7037..707b444f8b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt @@ -26,7 +26,7 @@ class ObjectivesPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, resourceHelper: ResourceHelper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val sp: SP, config: Config, private val dateUtil: DateUtil, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt index 43619ffc2f..172d88c024 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginType @@ -14,7 +14,7 @@ import javax.inject.Inject class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R.string.objectives_0_objective, R.string.objectives_0_gate) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin @Inject lateinit var treatmentsPlugin: TreatmentsPlugin @Inject lateinit var loopPlugin: LoopPlugin diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt index 1c1407c500..e3ed6843bc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt @@ -35,7 +35,7 @@ class SafetyPlugin @Inject constructor( private val openAPSAMAPlugin: OpenAPSAMAPlugin, private val openAPSSMBPlugin: OpenAPSSMBPlugin, private val sensitivityOref1Plugin: SensitivityOref1Plugin, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val hardLimits: HardLimits, private val buildHelper: BuildHelper, private val iobCobCalculator: IobCobCalculator, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 473aa35f6c..b6bd0b4fb0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -26,7 +26,7 @@ import info.nightscout.androidaps.extensions.toStringMedium import info.nightscout.androidaps.extensions.toStringShort import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction @@ -65,7 +65,7 @@ class ActionsFragment : DaggerFragment() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var statusLightHandler: StatusLightHandler @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var buildHelper: BuildHelper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt index 69f64f60ba..d06fefc03a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt @@ -45,7 +45,7 @@ class DataBroadcastPlugin @Inject constructor( private val defaultValueHelper: DefaultValueHelper, private val nsDeviceStatus: NSDeviceStatus, private val loopPlugin: LoopPlugin, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private var receiverStatusStore: ReceiverStatusStore, private val config: Config, private val glucoseStatusProvider: GlucoseStatusProvider diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt index c27b948d62..8776dceef0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.DeviceStatus import info.nightscout.androidaps.database.entities.* -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DataSyncSelector import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -20,7 +20,7 @@ class DataSyncSelectorImplementation @Inject constructor( private val dateUtil: DateUtil, private val profileFunction: ProfileFunction, private val nsClientPlugin: NSClientPlugin, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val appRepository: AppRepository ) : DataSyncSelector { @@ -244,7 +244,7 @@ class DataSyncSelectorImplementation @Inject constructor( val startId = sp.getLong(R.string.key_ns_glucose_value_last_synced_id, 0) appRepository.getNextSyncElementGlucoseValue(startId).blockingGet()?.let { gv -> aapsLogger.info(LTag.DATABASE, "Loading GlucoseValue data Start: $startId ID: ${gv.first.id} HistoryID: ${gv.second} ") - if (activePlugin.activeBgSource.uploadToNs(gv.first)) { + if (activePlugin.activeBgSource.shouldUploadToNs(gv.first)) { when { // removed and not uploaded yet = ignore !gv.first.isValid && gv.first.interfaceIDs.nightscoutId == null -> Any() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index d298ca7e06..1d696225e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -95,7 +95,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList @Inject lateinit var statusLightHandler: StatusLightHandler @Inject lateinit var nsDeviceStatus: NSDeviceStatus @Inject lateinit var loopPlugin: LoopPlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var treatmentsPlugin: TreatmentsPlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var dexcomPlugin: DexcomPlugin diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt index d313ea81cf..6721fe1952 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.R import info.nightscout.androidaps.events.EventRefreshOverview import info.nightscout.androidaps.extensions.* -import info.nightscout.androidaps.interfaces.OverviewInterface +import info.nightscout.androidaps.interfaces.Overview import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -17,7 +17,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNo import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.extensions.* import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.sharedPreferences.SP @@ -49,7 +48,7 @@ class OverviewPlugin @Inject constructor( .preferencesId(R.xml.pref_overview) .description(R.string.description_overview), aapsLogger, resourceHelper, injector -), OverviewInterface { +), Overview { private var disposable: CompositeDisposable = CompositeDisposable() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index b4c2754a15..4ed152a8b8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.ValueWrapper import info.nightscout.androidaps.database.entities.TherapyEvent -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants @@ -26,7 +26,7 @@ class StatusLightHandler @Inject constructor( private val resourceHelper: ResourceHelper, private val sp: SP, private val dateUtil: DateUtil, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val warnColors: WarnColors, private val config: Config, private val repository: AppRepository diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt index a2f480234d..99d8d57a03 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt @@ -43,7 +43,7 @@ class GraphData( @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var databaseHelper: DatabaseHelperInterface @Inject lateinit var repository: AppRepository @Inject lateinit var dateUtil: DateUtil diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt index f144ebd881..89136b5b69 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions import android.graphics.Color import info.nightscout.androidaps.core.R import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -12,7 +12,7 @@ import javax.inject.Inject class BolusDataPoint @Inject constructor( val data: Bolus, private val resourceHelper: ResourceHelper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val defaultValueHelper: DefaultValueHelper ) : DataPointWithLabelInterface { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt index a7156ba647..a761503fd8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt @@ -35,7 +35,7 @@ class PersistentNotificationPlugin @Inject constructor( private val aapsSchedulers: AapsSchedulers, private val profileFunction: ProfileFunction, private val fabricPrivacy: FabricPrivacy, - private val activePlugins: ActivePluginProvider, + private val activePlugins: ActivePlugin, private val iobCobCalculator: IobCobCalculator, private val rxBus: RxBusWrapper, private val context: Context, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 5ac9151473..e09dc00ab8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -70,7 +70,7 @@ class SmsCommunicatorPlugin @Inject constructor( private val rxBus: RxBusWrapper, private val profileFunction: ProfileFunction, private val fabricPrivacy: FabricPrivacy, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val commandQueue: CommandQueueProvider, private val loopPlugin: LoopPlugin, private val iobCobCalculator: IobCobCalculator, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt index cd15fac40d..c7bb146343 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt @@ -5,7 +5,7 @@ import android.os.PowerManager import android.os.SystemClock import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -37,7 +37,7 @@ class TidepoolUploader @Inject constructor( private val resourceHelper: ResourceHelper, private val sp: SP, private val uploadChunk: UploadChunk, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val dateUtil: DateUtil ) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt index 573147c14c..be7ab19a02 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.TemporaryBasal import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -28,7 +28,7 @@ class UploadChunk @Inject constructor( private val rxBus: RxBusWrapper, private val aapsLogger: AAPSLogger, private val profileFunction: ProfileFunction, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val databaseHelper: DatabaseHelperInterface, private val repository: AppRepository, private val dateUtil: DateUtil diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt index 9ea6108f75..3caa1226a4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt @@ -69,7 +69,7 @@ class ActionStringHandler @Inject constructor( private val wearPlugin: WearPlugin, private val fabricPrivacy: FabricPrivacy, private val commandQueue: CommandQueueProvider, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val iobCobCalculator: IobCobCalculator, private val localInsightPlugin: LocalInsightPlugin, private val danaRPlugin: DanaRPlugin, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java index 811898b09c..ef594be70d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java @@ -40,7 +40,7 @@ import info.nightscout.androidaps.database.entities.GlucoseValue; import info.nightscout.androidaps.database.entities.TemporaryBasal; import info.nightscout.androidaps.extensions.GlucoseValueExtensionKt; import info.nightscout.androidaps.extensions.TemporaryBasalExtensionKt; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.IobCobCalculator; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.ProfileFunction; @@ -72,7 +72,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog @Inject public ProfileFunction profileFunction; @Inject public DefaultValueHelper defaultValueHelper; @Inject public NSDeviceStatus nsDeviceStatus; - @Inject public ActivePluginProvider activePlugin; + @Inject public ActivePlugin activePlugin; @Inject public LoopPlugin loopPlugin; @Inject public IobCobCalculator iobCobCalculator; @Inject public AppRepository repository; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt index 81722b70c3..2359789f69 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt @@ -31,7 +31,7 @@ class StatusLinePlugin @Inject constructor( private val aapsSchedulers: AapsSchedulers, private val context: Context, private val fabricPrivacy: FabricPrivacy, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val loopPlugin: LoopPlugin, private val iobCobCalculator: IobCobCalculator, private val rxBus: RxBusWrapper, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt index 04f58c299e..93932d5633 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt @@ -7,7 +7,7 @@ import com.jjoe64.graphview.GraphView import com.jjoe64.graphview.series.DataPoint import com.jjoe64.graphview.series.LineGraphSeries import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.utils.T import java.util.* import kotlin.math.floor @@ -18,7 +18,7 @@ class ActivityGraph : GraphView { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - fun show(insulin: InsulinInterface) { + fun show(insulin: Insulin) { removeAllSeries() mSecondScale = null val hours = floor(insulin.dia + 1).toLong() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt index 6d5f2c6df8..640a0b80be 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt @@ -7,13 +7,13 @@ import android.view.ViewGroup import dagger.android.support.DaggerFragment import info.nightscout.androidaps.R import info.nightscout.androidaps.databinding.InsulinFragmentBinding -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.utils.resources.ResourceHelper import javax.inject.Inject class InsulinFragment : DaggerFragment() { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var resourceHelper: ResourceHelper private var _binding: InsulinFragmentBinding? = null diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt index 717429eb44..9c40a7bcdc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -19,7 +19,7 @@ class InsulinLyumjevPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { - override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_LYUMJEV + override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_LYUMJEV override val friendlyName get(): String = resourceHelper.gs(R.string.lyumjev) override fun configuration(): JSONObject = JSONObject() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt index dd37e15c74..fd41873cf2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt @@ -4,8 +4,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.db.Treatment -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -36,7 +35,7 @@ abstract class InsulinOrefBasePlugin( .shortName(R.string.insulin_shortname) .visibleByDefault(false), aapsLogger, resourceHelper, injector -), InsulinInterface { +), Insulin { private var lastWarned: Long = 0 override val dia @@ -67,26 +66,6 @@ abstract class InsulinOrefBasePlugin( return profile?.dia ?: MIN_DIA } - override fun iobCalcForTreatment(treatment: Treatment, time: Long, dia: Double): Iob { - val result = Iob() - val peak = peak - if (treatment.insulin != 0.0) { - val bolusTime = treatment.date - val t = (time - bolusTime) / 1000.0 / 60.0 - val td = dia * 60 //getDIA() always >= MIN_DIA - val tp = peak.toDouble() - // force the IOB to 0 if over DIA hours have passed - if (t < td) { - val tau = tp * (1 - tp / td) / (1 - 2 * tp / td) - val a = 2 * tau / td - val S = 1 / (1 - a + (1 + a) * Math.exp(-td / tau)) - result.activityContrib = treatment.insulin * (S / Math.pow(tau, 2.0)) * t * (1 - t / td) * Math.exp(-t / tau) - result.iobContrib = treatment.insulin * (1 - S * (1 - a) * ((Math.pow(t, 2.0) / (tau * td * (1 - a)) - t / tau - 1) * Math.exp(-t / tau) + 1)) - } - } - return result - } - override fun iobCalcForTreatment(bolus: Bolus, time: Long, dia: Double): Iob { val result = Iob() val peak = peak diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt index 1c27f8246c..d80ac43481 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -26,7 +26,7 @@ class InsulinOrefFreePeakPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { - override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_FREE_PEAK + override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_FREE_PEAK override val friendlyName get(): String = resourceHelper.gs(R.string.free_peak_oref) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt index bcf526253c..c18313a405 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -22,7 +22,7 @@ class InsulinOrefRapidActingPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { - override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_RAPID_ACTING + override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_RAPID_ACTING override val friendlyName get(): String = resourceHelper.gs(R.string.rapid_acting_oref) override fun configuration(): JSONObject = JSONObject() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt index 257ae10ffe..7a32408984 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -22,7 +22,7 @@ class InsulinOrefUltraRapidActingPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { - override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_ULTRA_RAPID_ACTING + override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING override val friendlyName get(): String = resourceHelper.gs(R.string.ultrarapid_oref) override fun configuration(): JSONObject = JSONObject() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index 15ae6af8dd..b93a772a0f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -52,7 +52,7 @@ open class IobCobCalculatorPlugin @Inject constructor( private val sp: SP, resourceHelper: ResourceHelper, private val profileFunction: ProfileFunction, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val sensitivityOref1Plugin: SensitivityOref1Plugin, private val sensitivityAAPSPlugin: SensitivityAAPSPlugin, private val sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.kt index c2c3d3d56a..88c9291f86 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.database.ValueWrapper import info.nightscout.androidaps.events.Event import info.nightscout.androidaps.events.EventAutosensCalculationFinished import info.nightscout.androidaps.extensions.target -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -56,7 +56,7 @@ class IobCobOref1Thread internal constructor( @Inject lateinit var context: Context @Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin @Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var buildHelper: BuildHelper @Inject lateinit var profiler: Profiler @Inject lateinit var fabricPrivacy: FabricPrivacy diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.kt index 961caffc0d..b7a04cde7d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.events.Event import info.nightscout.androidaps.events.EventAutosensCalculationFinished -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -55,7 +55,7 @@ class IobCobThread @Inject internal constructor( @Inject lateinit var context: Context @Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin @Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var buildHelper: BuildHelper @Inject lateinit var profiler: Profiler @Inject lateinit var fabricPrivacy: FabricPrivacy diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt index 77cc9e37e2..0e5068e419 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt @@ -17,7 +17,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding import info.nightscout.androidaps.dialogs.ProfileSwitchDialog -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -36,7 +36,7 @@ class LocalProfileFragment : DaggerFragment() { @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var localProfilePlugin: LocalProfilePlugin @Inject lateinit var hardLimits: HardLimits diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt index 7ee032c57c..66b070075d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt @@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.SensitivityInterface +import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore @@ -22,7 +22,7 @@ abstract class AbstractSensitivityPlugin( aapsLogger: AAPSLogger, resourceHelper: ResourceHelper, val sp: SP -) : PluginBase(pluginDescription, aapsLogger, resourceHelper, injector), SensitivityInterface { +) : PluginBase(pluginDescription, aapsLogger, resourceHelper, injector), Sensitivity { abstract override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult @@ -46,11 +46,11 @@ abstract class AbstractSensitivityPlugin( //If not-excluded data <= MIN_HOURS -> don't do Autosens //If not-excluded data >= MIN_HOURS_FULL_AUTOSENS -> full Autosens //Between MIN_HOURS and MIN_HOURS_FULL_AUTOSENS: gradually increase autosens - val autosensContrib = (min(max(SensitivityInterface.MIN_HOURS, deviationsArraySize / 12.0), - SensitivityInterface.MIN_HOURS_FULL_AUTOSENS) - SensitivityInterface.MIN_HOURS) / (SensitivityInterface.MIN_HOURS_FULL_AUTOSENS - SensitivityInterface.MIN_HOURS) + val autosensContrib = (min(max(Sensitivity.MIN_HOURS, deviationsArraySize / 12.0), + Sensitivity.MIN_HOURS_FULL_AUTOSENS) - Sensitivity.MIN_HOURS) / (Sensitivity.MIN_HOURS_FULL_AUTOSENS - Sensitivity.MIN_HOURS) ratio = autosensContrib * (ratio - 1) + 1 if (autosensContrib != 1.0) { - ratioLimit += "(" + deviationsArraySize + " of " + SensitivityInterface.MIN_HOURS_FULL_AUTOSENS * 12 + " values) " + ratioLimit += "(" + deviationsArraySize + " of " + Sensitivity.MIN_HOURS_FULL_AUTOSENS * 12 + " values) " } if (ratio != rawRatio) { ratioLimit += "Ratio limited from $rawRatio to $ratio" diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt index c9d50df35e..9eee2864e0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.SensitivityInterface.SensitivityType +import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt index cd7b2836ba..828646c354 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.SensitivityInterface.SensitivityType +import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt index 69630b7bd3..8da207dd06 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.SensitivityInterface.SensitivityType +import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt index 6ec4d20525..b4d334206e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt @@ -29,7 +29,7 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.extensions.directionToIcon import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.extensions.valueToUnitsString -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers @@ -49,7 +49,7 @@ class BGSourceFragment : DaggerFragment() { @Inject lateinit var repository: AppRepository @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var uel: UserEntryLogger - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin private val disposable = CompositeDisposable() private val millsToThePast = T.hours(12).msecs() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt index 44046a3258..d32a0ffd61 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt @@ -18,7 +18,7 @@ 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.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -51,7 +51,7 @@ class DexcomPlugin @Inject constructor( .preferencesId(R.xml.pref_bgsourcedexcom) .description(R.string.description_source_dexcom), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { init { if (!config.NSCLIENT) { @@ -63,7 +63,7 @@ class DexcomPlugin @Inject constructor( return true } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = (glucoseValue.sourceSensor == GlucoseValue.SourceSensor.DEXCOM_G6_NATIVE || glucoseValue.sourceSensor == GlucoseValue.SourceSensor.DEXCOM_G5_NATIVE || glucoseValue.sourceSensor == GlucoseValue.SourceSensor.DEXCOM_NATIVE_UNKNOWN) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt index 876fe8d0db..c6d0467c78 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.entities.TherapyEvent import info.nightscout.androidaps.database.transactions.CgmSourceTransaction import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -41,11 +41,11 @@ class EversensePlugin @Inject constructor( .preferencesId(R.xml.pref_bgsource) .description(R.string.description_source_eversense), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { override var sensorBatteryLevel = -1 - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.EVERSENSE && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) // cannot be inner class because of needed injection diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt index e6e6fa9c7c..dcd6690163 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -35,7 +35,7 @@ class GlimpPlugin @Inject constructor( .preferencesId(R.xml.pref_bgsource) .description(R.string.description_source_glimp), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { // cannot be inner class because of needed injection class GlimpWorker( @@ -83,7 +83,7 @@ class GlimpPlugin @Inject constructor( } } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.GLIMP && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt index bf0c30e899..41d4defeeb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -38,7 +38,7 @@ class MM640gPlugin @Inject constructor( .pluginName(R.string.MM640g) .description(R.string.description_source_mm640g), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { // cannot be inner class because of needed injection class MM640gWorker( @@ -107,7 +107,7 @@ class MM640gPlugin @Inject constructor( } } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.MM_600_SERIES && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt index ad9fc19c72..74f9f7110a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt @@ -10,7 +10,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -44,7 +44,7 @@ class NSClientSourcePlugin @Inject constructor( .pluginName(R.string.nsclientbg) .description(R.string.description_source_ns_client), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { private var lastBGTimeStamp: Long = 0 private var isAdvancedFilteringEnabled = false @@ -61,7 +61,7 @@ class NSClientSourcePlugin @Inject constructor( return isAdvancedFilteringEnabled } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = false + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = false private fun detectSource(glucoseValue: GlucoseValue) { if (glucoseValue.timestamp > lastBGTimeStamp) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt index b003adc13e..bcec10bd5d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt @@ -10,7 +10,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -39,7 +39,7 @@ class PoctechPlugin @Inject constructor( .preferencesId(R.xml.pref_bgsource) .description(R.string.description_source_poctech), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { // cannot be inner class because of needed injection class PoctechWorker( @@ -98,7 +98,7 @@ class PoctechPlugin @Inject constructor( } } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.POCTECH_NATIVE && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt index ba174ff046..06c7822036 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -48,7 +48,7 @@ class RandomBgPlugin @Inject constructor( .preferencesId(R.xml.pref_bgsource) .description(R.string.description_source_randombg), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { private val loopHandler: Handler = Handler(HandlerThread(RandomBgPlugin::class.java.simpleName + "Handler").also { it.start() }.looper) private lateinit var refreshLoop: Runnable @@ -74,7 +74,7 @@ class RandomBgPlugin @Inject constructor( return true } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.RANDOM && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) override fun onStart() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt index 831770f3d5..bbcc7ccc49 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -36,7 +36,7 @@ class TomatoPlugin @Inject constructor( .shortName(R.string.tomato_short) .description(R.string.description_source_tomato), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { // cannot be inner class because of needed injection class TomatoWorker( @@ -85,7 +85,7 @@ class TomatoPlugin @Inject constructor( } } - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = glucoseValue.sourceSensor == GlucoseValue.SourceSensor.LIBRE_1_TOMATO && sp.getBoolean(R.string.key_dexcomg5_nsupload, false) } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt index bf5aa0b1d6..be7df833e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -33,12 +33,12 @@ class XdripPlugin @Inject constructor( .pluginName(R.string.xdrip) .description(R.string.description_source_xdrip), aapsLogger, resourceHelper, injector -), BgSourceInterface { +), BgSource { private var advancedFiltering = false override var sensorBatteryLevel = -1 - override fun uploadToNs(glucoseValue: GlucoseValue): Boolean = false + override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = false override fun advancedFilteringSupported(): Boolean { return advancedFiltering diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt index 8d9951c490..9de459f622 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt @@ -10,7 +10,7 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.R import info.nightscout.androidaps.databinding.TreatmentsFragmentBinding import info.nightscout.androidaps.events.EventExtendedBolusChange -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.treatments.fragments.* @@ -29,7 +29,7 @@ class TreatmentsFragment : DaggerFragment() { @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var buildHelper: BuildHelper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java index a665e53368..7fcfb69d3d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java @@ -23,7 +23,7 @@ import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventReloadProfileSwitchData; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; @@ -54,7 +54,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface private final RxBusWrapper rxBus; private final ResourceHelper resourceHelper; private final ProfileFunction profileFunction; - private final ActivePluginProvider activePlugin; + private final ActivePlugin activePlugin; private final NSUpload nsUpload; private final FabricPrivacy fabricPrivacy; private final DateUtil dateUtil; @@ -77,7 +77,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface Context context, SP sp, ProfileFunction profileFunction, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, NSUpload nsUpload, FabricPrivacy fabricPrivacy, DateUtil dateUtil, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt index 0b5496ce19..4af296892d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt @@ -24,7 +24,7 @@ import info.nightscout.androidaps.databinding.TreatmentsBolusCarbsItemBinding import info.nightscout.androidaps.dialogs.WizardInfoDialog import info.nightscout.androidaps.events.EventAutosensCalculationFinished import info.nightscout.androidaps.events.EventTreatmentChange -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -63,7 +63,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() { @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var uel: UserEntryLogger @Inject lateinit var repository: AppRepository - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin class MealLink( val bolus: Bolus? = null, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt index 320429bbf8..5e52467f5e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.events.EventExtendedBolusChange import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.isInProgress import info.nightscout.androidaps.extensions.toVisibility -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -47,7 +47,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() { private val millsToThePast = T.days(30).msecs() - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var aapsLogger: AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt index c1dee0908d..d0ee9dcd5b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -27,7 +27,7 @@ import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.toStringFull import info.nightscout.androidaps.extensions.toTemporaryBasal import info.nightscout.androidaps.extensions.toVisibility -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -53,7 +53,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() { @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var dateUtil: DateUtil @Inject lateinit var aapsSchedulers: AapsSchedulers diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt index 2db33b17d4..3dc312fd79 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.dialogs.BolusProgressDialog import info.nightscout.androidaps.events.EventBolusRequested import info.nightscout.androidaps.events.EventNewBasalProfile import info.nightscout.androidaps.events.EventProfileNeedsUpdate -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ProfileFunction @@ -56,7 +56,7 @@ open class CommandQueue @Inject constructor( private val resourceHelper: ResourceHelper, private val constraintChecker: ConstraintChecker, private val profileFunction: ProfileFunction, - private val activePlugin: Lazy, + private val activePlugin: Lazy, private val context: Context, private val sp: SP, private val buildHelper: BuildHelper, diff --git a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt index c1b4fa7aa5..34b64b8501 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt @@ -7,7 +7,7 @@ import android.os.SystemClock import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -22,7 +22,7 @@ class QueueThread internal constructor( context: Context, private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val resourceHelper: ResourceHelper, private val sp: SP ) : Thread() { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt index 084eb12609..e8d779634e 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt @@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.dialogs.BolusProgressDialog -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning @@ -19,7 +19,7 @@ class CommandBolus( ) : Command(injector, type, callback) { @Inject lateinit var rxBus: RxBusWrapper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.deliverTreatment(detailedBolusInfo) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt index 40f9dfb972..c15d0e7914 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -11,7 +11,7 @@ class CommandCancelExtendedBolus constructor( callback: Callback? ) : Command(injector, CommandType.EXTENDEDBOLUS, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.cancelExtendedBolus() diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt index ff7182df9a..79835a9ecd 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -12,7 +12,7 @@ class CommandCancelTempBasal( callback: Callback? ) : Command(injector, CommandType.TEMPBASAL, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.cancelTempBasal(enforceNew) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt index f0df2754d3..e9f058ece9 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -12,7 +12,7 @@ class CommandCustomCommand( callback: Callback? ) : Command(injector, CommandType.CUSTOM_COMMAND, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val result = activePlugin.activePump.executeCustomCommand(customCommand) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt index 2e81520ee4..c1c67bfac4 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -13,7 +13,7 @@ class CommandExtendedBolus constructor( callback: Callback? ) : Command(injector, CommandType.EXTENDEDBOLUS, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.setExtendedBolus(insulin, durationInMinutes) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt index 7cf02fed74..ab8b8bd3e2 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -12,7 +12,7 @@ class CommandInsightSetTBROverNotification constructor( callback: Callback? ) : Command(injector, CommandType.INSIGHT_SET_TBR_OVER_ALARM, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt index 7f09441ecc..22217ab614 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DanaRInterface import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback @@ -12,7 +12,7 @@ class CommandLoadEvents( callback: Callback? ) : Command(injector, CommandType.LOAD_EVENTS, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt index fb7f455ed4..d6980d70c4 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DanaRInterface import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback @@ -13,7 +13,7 @@ class CommandLoadHistory( callback: Callback? ) : Command(injector, CommandType.LOAD_HISTORY, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt index 9bf4a1ab7d..a38ab32962 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -11,7 +11,7 @@ class CommandLoadTDDs( callback: Callback? ) : Command(injector, CommandType.LOAD_TDD, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt index 052ad8a515..096178b06e 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResult -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.LocalAlertUtils @@ -15,7 +15,7 @@ class CommandReadStatus( callback: Callback? ) : Command(injector, CommandType.READSTATUS, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var localAlertUtils: LocalAlertUtils override fun execute() { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt index 4e425da52b..d43493059b 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt @@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.data.PumpEnactResult -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.DateUtil @@ -18,7 +18,7 @@ class CommandSMBBolus( ) : Command(injector, CommandType.SMB_BOLUS, callback) { @Inject lateinit var dateUtil: DateUtil - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r: PumpEnactResult diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt index 89521346fe..d7798782ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt @@ -5,7 +5,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.db.Source -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.LTag @@ -20,7 +20,7 @@ class CommandSetProfile constructor( ) : Command(injector, CommandType.BASAL_PROFILE, callback) { @Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider override fun execute() { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt index c63d32fc1c..4b2fc760e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DanaRInterface import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback @@ -12,7 +12,7 @@ class CommandSetUserSettings( callback: Callback? ) : Command(injector, CommandType.SET_USER_SETTINGS, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt index da911775bf..8987208bab 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -11,7 +11,7 @@ class CommandStartPump( callback: Callback? ) : Command(injector, CommandType.START_PUMP, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt index 1f0390e97f..894573f435 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -11,7 +11,7 @@ class CommandStopPump( callback: Callback? ) : Command(injector, CommandType.STOP_PUMP, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val pump = activePlugin.activePump diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt index 21c70509f1..316acb74bc 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback @@ -18,7 +18,7 @@ class CommandTempBasalAbsolute( callback: Callback? ) : Command(injector, CommandType.TEMPBASAL, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.setTempBasalAbsolute(absoluteRate, durationInMinutes, profile, enforceNew, tbrType) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt index 1a00c8910e..215886b35a 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback @@ -18,7 +18,7 @@ class CommandTempBasalPercent( callback: Callback? ) : Command(injector, CommandType.TEMPBASAL, callback) { - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin override fun execute() { val r = activePlugin.activePump.setTempBasalPercent(percent, durationInMinutes, profile, enforceNew, tbrType) diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt index 22aa41e4fe..944fa1255b 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.events.EventProfileNeedsUpdate import info.nightscout.androidaps.extensions.buildDeviceStatus -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction @@ -64,7 +64,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() { @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var loopPlugin: LoopPlugin @Inject lateinit var dateUtil: DateUtil - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var runningConfiguration: RunningConfiguration @Inject lateinit var receiverStatusStore: ReceiverStatusStore diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt index bcf3091c86..24136399f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt @@ -4,7 +4,7 @@ import android.content.Context import android.content.Intent import com.google.gson.Gson import dagger.android.DaggerBroadcastReceiver -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.BundleLogger @@ -15,7 +15,7 @@ import javax.inject.Inject class TimeDateOrTZChangeReceiver : DaggerBroadcastReceiver() { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin val gson: Gson = Gson() private var isDST = false diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt index f694754bd3..26102a2d5e 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt @@ -47,7 +47,7 @@ class SWDefinition @Inject constructor( private val sp: SP, private val profileFunction: ProfileFunction, private val localProfilePlugin: LocalProfilePlugin, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val commandQueue: CommandQueueProvider, private val objectivesPlugin: ObjectivesPlugin, private val configBuilder: ConfigBuilder, @@ -269,13 +269,13 @@ class SWDefinition @Inject constructor( .add(SWFragment(injector, this) .add(NSProfileFragment())) .validator { nsProfilePlugin.profile != null && nsProfilePlugin.profile!!.getDefaultProfile() != null && nsProfilePlugin.profile!!.getDefaultProfile()!!.isValid("StartupWizard") } - .visibility { nsProfilePlugin.isEnabled(PluginType.PROFILE) } + .visibility { nsProfilePlugin.isEnabled() } private val screenLocalProfile = SWScreen(injector, R.string.localprofile) .skippable(false) .add(SWFragment(injector, this) .add(LocalProfileFragment())) .validator { localProfilePlugin.profile?.getDefaultProfile()?.isValid("StartupWizard") == true } - .visibility { localProfilePlugin.isEnabled(PluginType.PROFILE) } + .visibility { localProfilePlugin.isEnabled() } private val screenProfileSwitch = SWScreen(injector, R.string.careportal_profileswitch) .skippable(false) .add(SWInfoText(injector) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt index ce78a54e48..9bb3bfdc02 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt @@ -5,7 +5,7 @@ import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -32,7 +32,7 @@ class LocalAlertUtils @Inject constructor( private val sp: SP, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val profileFunction: ProfileFunction, private val iobCobCalculator: IobCobCalculator, private val smsCommunicatorPlugin: SmsCommunicatorPlugin, diff --git a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt index d20e0c0cbd..80ffb03bad 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.db.TDD -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -22,7 +22,7 @@ import javax.inject.Inject class TddCalculator @Inject constructor( private val aapsLogger: AAPSLogger, private val resourceHelper: ResourceHelper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val profileFunction: ProfileFunction, private val dateUtil: DateUtil, private val iobCobCalculator: IobCobCalculator, diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt index 53a97730fb..9660d7dc6a 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt @@ -53,7 +53,7 @@ class BolusWizard @Inject constructor( @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var constraintChecker: ConstraintChecker - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var loopPlugin: LoopPlugin @Inject lateinit var iobCobCalculator: IobCobCalculator diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index aaa049d04c..45d612d983 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.db.ProfileSwitch import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.resources.ResourceHelper import org.json.JSONObject @@ -20,7 +19,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var iobCobCalculator: IobCobCalculator diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index 02acb99121..30291fb6e7 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -55,7 +55,7 @@ import java.util.* UserEntryLogger::class, LoggerUtils::class, AppRepository::class) class ConstraintsCheckerTest : TestBaseWithProfile() { - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueueProvider diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt index a940f09a5a..9617bfe4db 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt @@ -13,7 +13,6 @@ import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.receivers.ReceiverStatusStore @@ -41,7 +40,7 @@ class LoopPluginTest : TestBase() { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var context: Context @Mock lateinit var commandQueue: CommandQueueProvider - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var treatmentsPlugin: TreatmentsPlugin @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var iobCobCalculator: IobCobCalculator diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt index 5309c4d05b..fa4d5196a2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.configBuilder import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -22,7 +22,7 @@ class ConfigBuilderPluginTest : TestBase() { @Mock lateinit var sp: SP @Mock lateinit var resourceHelper: ResourceHelper - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var uel: UserEntryLogger @Mock lateinit var pumpSync: PumpSync diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt index 16acf0592e..da4192d33d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.constraints.dstHelper import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -23,7 +23,7 @@ class DstHelperPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var sp: SP - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var loopPlugin: LoopPlugin private lateinit var plugin: DstHelperPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt index 81c12437cf..e1fea4634e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Config import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective @@ -26,7 +26,7 @@ import org.powermock.modules.junit4.PowerMockRunner class ObjectivesPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var sp: SP @Mock lateinit var dateUtil: DateUtil @Mock lateinit var uel: UserEntryLogger diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt index ccb9721bb5..c03550ed40 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin @@ -37,7 +37,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Mock lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin @Mock lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin @Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var buildHelper: BuildHelper @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var glimpPlugin: GlimpPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt index f9cfa60794..e0b09f41bb 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -14,7 +14,7 @@ import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType @@ -65,7 +65,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var constraintChecker: ConstraintChecker - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var loopPlugin: LoopPlugin @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt index 6bfea57ff9..3c2edb886f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.interfaces.ProfileFunction @@ -47,7 +47,7 @@ class InsulinLyumjevPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.InsulinType.OREF_LYUMJEV, sut.id) + assertEquals(Insulin.InsulinType.OREF_LYUMJEV, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt index a7a5fe01fe..112585e8e0 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -5,8 +5,8 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.interfaces.ActivePluginProvider -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -49,7 +49,7 @@ class InsulinOrefBasePluginTest { get() = testPeak override fun commentStandardText(): String = "" - override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.UNKNOWN + override val id get(): Insulin.InsulinType = Insulin.InsulinType.UNKNOWN override val friendlyName get(): String = "" override fun configuration(): JSONObject = JSONObject() override fun applyConfiguration(configuration: JSONObject) {} @@ -65,7 +65,7 @@ class InsulinOrefBasePluginTest { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var rxBus: RxBusWrapper @Mock lateinit var aapsLogger: AAPSLogger - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index a172e98116..3f6e828b34 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -54,7 +54,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Test fun getIdTest() { - assertEquals(InsulinInterface.InsulinType.OREF_FREE_PEAK, sut.id) + assertEquals(Insulin.InsulinType.OREF_FREE_PEAK, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt index e4a1b7a650..aa4990808a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.interfaces.ProfileFunction @@ -47,7 +47,7 @@ class InsulinOrefRapidActingPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.InsulinType.OREF_RAPID_ACTING, sut.id) + assertEquals(Insulin.InsulinType.OREF_RAPID_ACTING, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt index 2690a826aa..7739049063 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.interfaces.ProfileFunction @@ -47,7 +47,7 @@ class InsulinOrefUltraRapidActingPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id) + assertEquals(Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt index 08fd33b7f6..40b5520720 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.SensitivityInterface +import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult @@ -30,8 +30,8 @@ class AbstractSensitivityPluginTest : TestBase() { return AutosensResult() } - override val id: SensitivityInterface.SensitivityType - get() = SensitivityInterface.SensitivityType.UNKNOWN + override val id: Sensitivity.SensitivityType + get() = Sensitivity.SensitivityType.UNKNOWN override fun configuration(): JSONObject = JSONObject() diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt index 1149eb380a..053bf37455 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.core.R import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync @@ -48,8 +48,8 @@ import java.util.* class CommandQueueTest : TestBaseWithProfile() { @Mock lateinit var constraintChecker: ConstraintChecker - @Mock lateinit var lazyActivePlugin: Lazy - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var lazyActivePlugin: Lazy + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var sp: SP @Mock lateinit var loggerUtils: LoggerUtils @Mock lateinit var powerManager: PowerManager @@ -63,7 +63,7 @@ class CommandQueueTest : TestBaseWithProfile() { resourceHelper: ResourceHelper, constraintChecker: ConstraintChecker, profileFunction: ProfileFunction, - activePlugin: Lazy, + activePlugin: Lazy, context: Context, sp: SP, buildHelper: BuildHelper, diff --git a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt index 7199418902..f87691dabb 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpSync @@ -39,8 +39,8 @@ import org.powermock.modules.junit4.PowerMockRunner class QueueThreadTest : TestBaseWithProfile() { @Mock lateinit var constraintChecker: ConstraintChecker - @Mock lateinit var lazyActivePlugin: Lazy - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var lazyActivePlugin: Lazy + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var sp: SP @Mock lateinit var loggerUtils: LoggerUtils @Mock lateinit var powerManager: PowerManager diff --git a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt index fbba0235e8..b27156eaea 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt @@ -37,7 +37,7 @@ class BolusWizardTest : TestBase() { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var context: Context - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var loopPlugin: LoopPlugin @Mock lateinit var iobCobCalculator: IobCobCalculator diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt index 5c2dadb9ca..2ed9002b06 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.ValueWithUnit -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger @@ -24,7 +24,7 @@ import javax.inject.Inject class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) { @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var dateUtil: DateUtil @Inject lateinit var uel: UserEntryLogger diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt index 3e07559032..de2cff70de 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.ValueWithUnit -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration @@ -24,7 +24,7 @@ import javax.inject.Inject class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector) { @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger var pct = InputPercent() diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt index 4512a16034..92123b9a9d 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.UserEntryLogger @@ -38,7 +38,7 @@ import javax.inject.Inject class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) { @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var repository: AppRepository @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var dateUtil: DateUtil diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileName.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileName.kt index 36e9e5e763..e6422e60aa 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileName.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileName.kt @@ -7,10 +7,10 @@ import android.widget.ArrayAdapter import android.widget.LinearLayout import android.widget.Spinner import info.nightscout.androidaps.automation.R -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.utils.resources.ResourceHelper -class InputProfileName(private val resourceHelper: ResourceHelper, private val activePlugin: ActivePluginProvider, val name: String = "") : Element() { +class InputProfileName(private val resourceHelper: ResourceHelper, private val activePlugin: ActivePlugin, val name: String = "") : Element() { var value: String = name diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt index 41a898f06d..c67c10bb75 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt @@ -11,7 +11,7 @@ import com.google.common.base.Optional import dagger.android.HasAndroidInjector import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -37,7 +37,7 @@ abstract class Trigger(val injector: HasAndroidInjector) { @Inject lateinit var sp: SP @Inject lateinit var locationDataContainer: LastLocationDataContainer @Inject lateinit var repository: AppRepository - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider @Inject lateinit var dateUtil: DateUtil diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt index 9e8dd75a1a..f88b3684e0 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileStore @@ -24,7 +24,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class, AppRepository::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt index d03c0fa8d2..912c4345ea 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt @@ -41,7 +41,7 @@ open class ActionsTestBase : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var configBuilder: ConfigBuilder - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var profilePlugin: ProfileInterface @Mock lateinit var smsCommunicatorPlugin: SmsCommunicatorInterface @Mock lateinit var loopPlugin: TestLoopPlugin diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt index a39f4ab4d2..21c8090bd9 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt @@ -5,7 +5,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -25,7 +25,7 @@ open class TriggerTestBase : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var locationDataContainer: LastLocationDataContainer - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var iobCobCalculator: IobCobCalculator @Mock lateinit var autosensDataStore: AutosensDataStore @Mock lateinit var context: Context diff --git a/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt index c24b48fa00..875f07a657 100644 --- a/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt +++ b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt @@ -27,7 +27,7 @@ class ComboPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var profileFunction: ProfileFunction - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var pumpSync: PumpSync @Mock lateinit var sp: SP diff --git a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt index d1f21894c4..353f808935 100644 --- a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt @@ -20,7 +20,7 @@ import info.nightscout.androidaps.core.databinding.ActivityTddStatsBinding import info.nightscout.androidaps.db.TDD import info.nightscout.androidaps.events.EventDanaRSyncStatus import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -47,7 +47,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var databaseHelper: DatabaseHelperInterface @Inject lateinit var fabricPrivacy: FabricPrivacy diff --git a/core/src/main/java/info/nightscout/androidaps/core/di/CoreModule.kt b/core/src/main/java/info/nightscout/androidaps/core/di/CoreModule.kt index 1ea1ddda52..8f018cdc71 100644 --- a/core/src/main/java/info/nightscout/androidaps/core/di/CoreModule.kt +++ b/core/src/main/java/info/nightscout/androidaps/core/di/CoreModule.kt @@ -5,7 +5,7 @@ import android.preference.PreferenceManager import dagger.Module import dagger.Provides import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLoggerProduction @@ -28,7 +28,7 @@ open class CoreModule { @Provides @Singleton - fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider, fabricPrivacy: FabricPrivacy, dateUtil: DateUtil): ProfileFunction { + fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePlugin, fabricPrivacy: FabricPrivacy, dateUtil: DateUtil): ProfileFunction { return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin, fabricPrivacy, dateUtil) } diff --git a/core/src/main/java/info/nightscout/androidaps/data/Profile.java b/core/src/main/java/info/nightscout/androidaps/data/Profile.java index a79cb5daff..1cdf6faa24 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/core/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -16,7 +16,7 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.core.R; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.ConfigInterface; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.PumpDescription; @@ -33,7 +33,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper; public class Profile { @Inject public AAPSLogger aapsLogger; - @Inject public ActivePluginProvider activePlugin; + @Inject public ActivePlugin activePlugin; @Inject public ResourceHelper resourceHelper; @Inject public RxBusWrapper rxBus; @Inject public FabricPrivacy fabricPrivacy; diff --git a/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java b/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java index 6459a238c3..f00a49dbe6 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java +++ b/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java @@ -17,15 +17,11 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.data.Iob; -import info.nightscout.androidaps.data.IobTotal; -import info.nightscout.androidaps.data.Profile; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; -import info.nightscout.androidaps.interfaces.InsulinInterface; +import info.nightscout.androidaps.interfaces.ActivePlugin; +import info.nightscout.androidaps.interfaces.Insulin; import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface; import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries; -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.JsonHelper; @@ -39,7 +35,7 @@ import info.nightscout.androidaps.utils.Round; @DatabaseTable(tableName = "ExtendedBoluses") public class ExtendedBolus implements Interval, DataPointWithLabelInterface { - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject DateUtil dateUtil; private HasAndroidInjector injector; @@ -64,7 +60,7 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface { public int durationInMinutes = 0; // duration == 0 means end of extended bolus @DatabaseField - public int insulinInterfaceID = InsulinInterface.InsulinType.OREF_RAPID_ACTING.getValue(); + public int insulinInterfaceID = Insulin.InsulinType.OREF_RAPID_ACTING.getValue(); @DatabaseField public double dia = Constants.defaultDIA; @@ -231,90 +227,6 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface { return absoluteRate() * getRealDuration() / 60d; } - public IobTotal iobCalc(long time, Profile profile) { - IobTotal result = new IobTotal(time); - InsulinInterface insulinInterface = activePlugin.getActiveInsulin(); - - double realDuration = getDurationToTime(time); - - if (realDuration > 0) { - double dia = profile.getDia(); - double dia_ago = time - dia * 60 * 60 * 1000; - int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d); - double spacing = realDuration / aboutFiveMinIntervals; - - for (long j = 0L; j < aboutFiveMinIntervals; j++) { - // find middle of the interval - long calcdate = (long) (date + j * spacing * 60 * 1000 + 0.5d * spacing * 60 * 1000); - - if (calcdate > dia_ago && calcdate <= time) { - double tempBolusSize = absoluteRate() * spacing / 60d; - - Treatment tempBolusPart = new Treatment(); - tempBolusPart.insulin = tempBolusSize; - tempBolusPart.date = calcdate; - - Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia); - result.iob += aIOB.getIobContrib(); - result.activity += aIOB.getActivityContrib(); - result.extendedBolusInsulin += tempBolusPart.insulin; - } - } - } - return result; - } - - public IobTotal iobCalc(long time, Profile profile, AutosensResult lastAutosensResult, boolean exercise_mode, int half_basal_exercise_target, boolean isTempTarget) { - IobTotal result = new IobTotal(time); - InsulinInterface insulinInterface = activePlugin.getActiveInsulin(); - - double realDuration = getDurationToTime(time); - double netBasalAmount = 0d; - - double sensitivityRatio = lastAutosensResult.ratio; - double normalTarget = 100; - - if (exercise_mode && isTempTarget && profile.getTargetMgdl() >= normalTarget + 5) { - // w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44 - // e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6 - double c = half_basal_exercise_target - normalTarget; - sensitivityRatio = c / (c + profile.getTargetMgdl() - normalTarget); - } - - if (realDuration > 0) { - double netBasalRate; - double dia = profile.getDia(); - double dia_ago = time - dia * 60 * 60 * 1000; - int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d); - double spacing = realDuration / aboutFiveMinIntervals; - - for (long j = 0L; j < aboutFiveMinIntervals; j++) { - // find middle of the interval - long calcdate = (long) (date + j * spacing * 60 * 1000 + 0.5d * spacing * 60 * 1000); - - double basalRate = profile.getBasal(calcdate); - double basalRateCorrection = basalRate * (sensitivityRatio - 1); - - - netBasalRate = absoluteRate() - basalRateCorrection; - - if (calcdate > dia_ago && calcdate <= time) { - double tempBolusSize = netBasalRate * spacing / 60d; - - Treatment tempBolusPart = new Treatment(); - tempBolusPart.insulin = tempBolusSize; - tempBolusPart.date = calcdate; - - Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia); - result.iob += aIOB.getIobContrib(); - result.activity += aIOB.getActivityContrib(); - result.extendedBolusInsulin += tempBolusPart.insulin; - } - } - } - return result; - } - public int getRealDuration() { return getDurationToTime(System.currentTimeMillis()); } diff --git a/core/src/main/java/info/nightscout/androidaps/db/TemporaryBasal.java b/core/src/main/java/info/nightscout/androidaps/db/TemporaryBasal.java index 696947cb14..762c7b7971 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/TemporaryBasal.java +++ b/core/src/main/java/info/nightscout/androidaps/db/TemporaryBasal.java @@ -8,16 +8,11 @@ import java.util.Objects; import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.core.R; -import info.nightscout.androidaps.data.Iob; -import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.Profile; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; -import info.nightscout.androidaps.interfaces.InsulinInterface; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.sharedPreferences.SP; @@ -32,7 +27,7 @@ public class TemporaryBasal implements Interval, DbObjectBase { @Inject public AAPSLogger aapsLogger; @Inject public ProfileFunction profileFunction; - @Inject public ActivePluginProvider activePlugin; + @Inject public ActivePlugin activePlugin; @Inject public SP sp; @Inject public DateUtil dateUtil; @@ -245,128 +240,6 @@ public class TemporaryBasal implements Interval, DbObjectBase { // -------- Interval interface end --------- - public IobTotal iobCalc(long time, Profile profile) { - - if (isFakeExtended) { - aapsLogger.error("iobCalc should only be called on Extended boluses separately"); - return new IobTotal(time); - } - - IobTotal result = new IobTotal(time); - InsulinInterface insulinInterface = activePlugin.getActiveInsulin(); - - int realDuration = getDurationToTime(time); - double netBasalAmount = 0d; - - if (realDuration > 0) { - double netBasalRate; - double dia = profile.getDia(); - double dia_ago = time - dia * 60 * 60 * 1000; - int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d); - double tempBolusSpacing = (double) (realDuration / aboutFiveMinIntervals); - - for (long j = 0L; j < aboutFiveMinIntervals; j++) { - // find middle of the interval - long calcdate = (long) (date + j * tempBolusSpacing * 60 * 1000 + 0.5d * tempBolusSpacing * 60 * 1000); - - double basalRate = profile.getBasal(calcdate); - - if (isAbsolute) { - netBasalRate = absoluteRate - basalRate; - } else { - netBasalRate = (percentRate - 100) / 100d * basalRate; - } - - if (calcdate > dia_ago && calcdate <= time) { - double tempBolusSize = netBasalRate * tempBolusSpacing / 60d; - netBasalAmount += tempBolusSize; - - Treatment tempBolusPart = new Treatment(); - tempBolusPart.insulin = tempBolusSize; - tempBolusPart.date = calcdate; - - Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia); - result.basaliob += aIOB.getIobContrib(); - result.activity += aIOB.getActivityContrib(); - result.netbasalinsulin += tempBolusPart.insulin; - if (tempBolusPart.insulin > 0) { - result.hightempinsulin += tempBolusPart.insulin; - } - } - result.netRatio = netBasalRate; // ratio at the end of interval - } - } - result.netInsulin = netBasalAmount; - return result; - } - - public IobTotal iobCalc(long time, Profile profile, AutosensResult lastAutosensResult, boolean exercise_mode, int half_basal_exercise_target, boolean isTempTarget) { - - if (isFakeExtended) { - aapsLogger.error("iobCalc should only be called on Extended boluses separately"); - return new IobTotal(time); - } - - IobTotal result = new IobTotal(time); - InsulinInterface insulinInterface = activePlugin.getActiveInsulin(); - - double realDuration = getDurationToTime(time); - double netBasalAmount = 0d; - - double sensitivityRatio = lastAutosensResult.ratio; - double normalTarget = 100; - - if (exercise_mode && isTempTarget && profile.getTargetMgdl() >= normalTarget + 5) { - // w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44 - // e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6 - double c = half_basal_exercise_target - normalTarget; - sensitivityRatio = c / (c + profile.getTargetMgdl() - normalTarget); - } - - if (realDuration > 0) { - double netBasalRate; - double dia = profile.getDia(); - double dia_ago = time - dia * 60 * 60 * 1000; - int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d); - double tempBolusSpacing = realDuration / aboutFiveMinIntervals; - - for (long j = 0L; j < aboutFiveMinIntervals; j++) { - // find middle of the interval - long calcdate = (long) (date + j * tempBolusSpacing * 60 * 1000 + 0.5d * tempBolusSpacing * 60 * 1000); - - double basalRate = profile.getBasal(calcdate); - basalRate *= sensitivityRatio; - - if (isAbsolute) { - netBasalRate = absoluteRate - basalRate; - } else { - double abs = percentRate / 100d * profile.getBasal(calcdate); - netBasalRate = abs - basalRate; - } - - if (calcdate > dia_ago && calcdate <= time) { - double tempBolusSize = netBasalRate * tempBolusSpacing / 60d; - netBasalAmount += tempBolusSize; - - Treatment tempBolusPart = new Treatment(); - tempBolusPart.insulin = tempBolusSize; - tempBolusPart.date = calcdate; - - Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia); - result.basaliob += aIOB.getIobContrib(); - result.activity += aIOB.getActivityContrib(); - result.netbasalinsulin += tempBolusPart.insulin; - if (tempBolusPart.insulin > 0) { - result.hightempinsulin += tempBolusPart.insulin; - } - } - result.netRatio = netBasalRate; // ratio at the end of interval - } - } - result.netInsulin = netBasalAmount; - return result; - } - public int getRealDuration() { return getDurationToTime(System.currentTimeMillis()); } diff --git a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java index 19e1fc2771..0285844cce 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java +++ b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java @@ -18,11 +18,10 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.core.R; -import info.nightscout.androidaps.data.Iob; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.database.entities.Bolus; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; -import info.nightscout.androidaps.interfaces.InsulinInterface; +import info.nightscout.androidaps.interfaces.ActivePlugin; +import info.nightscout.androidaps.interfaces.Insulin; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface; import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries; @@ -38,7 +37,7 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase { @Inject public DefaultValueHelper defaultValueHelper; @Inject public ResourceHelper resourceHelper; @Inject public ProfileFunction profileFunction; - @Inject public ActivePluginProvider activePlugin; + @Inject public ActivePlugin activePlugin; @Inject public DateUtil dateUtil; public static final String TABLE_TREATMENTS = "Treatments"; @@ -67,7 +66,7 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase { public boolean isSMB = false; @DatabaseField - public int insulinInterfaceID = InsulinInterface.InsulinType.OREF_RAPID_ACTING.getValue(); // currently unused, will be used in the future + public int insulinInterfaceID = Insulin.InsulinType.OREF_RAPID_ACTING.getValue(); // currently unused, will be used in the future @DatabaseField public double dia = Constants.defaultDIA; // currently unused, will be used in the future @DatabaseField diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt index f905d7b40d..94dd93ef51 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.Constants import info.nightscout.androidaps.core.R import info.nightscout.androidaps.core.databinding.DialogProfileviewerBinding import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DateUtil @@ -27,7 +27,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var dateUtil: DateUtil @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var databaseHelper: DatabaseHelperInterface diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt index c395a203f8..bef74006e9 100644 --- a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt @@ -4,15 +4,15 @@ import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.database.embedments.InterfaceIDs import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.database.entities.TherapyEvent -import info.nightscout.androidaps.interfaces.ActivePluginProvider -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper import org.json.JSONObject -fun Bolus.iobCalc(activePlugin: ActivePluginProvider, time: Long, dia: Double): Iob { +fun Bolus.iobCalc(activePlugin: ActivePlugin, time: Long, dia: Double): Iob { if (!isValid || type == Bolus.Type.PRIMING ) return Iob() - val insulinInterface: InsulinInterface = activePlugin.activeInsulin + val insulinInterface: Insulin = activePlugin.activeInsulin return insulinInterface.iobCalcForTreatment(this, time, dia) } diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt index 6c75f72cd0..ab34f7fcc5 100644 --- a/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.database.entities.ExtendedBolus import info.nightscout.androidaps.database.entities.TemporaryBasal import info.nightscout.androidaps.database.entities.TherapyEvent import info.nightscout.androidaps.database.interfaces.end -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal @@ -125,7 +125,7 @@ fun extendedBolusFromJson(jsonObject: JSONObject): ExtendedBolus? { } } -fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: InsulinInterface): IobTotal { +fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal { val result = IobTotal(time) val realDuration = getPassedDurationToTimeInMinutes(time) if (realDuration > 0) { @@ -153,7 +153,7 @@ fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insuli return result } -fun ExtendedBolus.iobCalc(time: Long, profile: Profile, lastAutosensResult: AutosensResult, exercise_mode: Boolean, half_basal_exercise_target: Int, isTempTarget: Boolean, insulinInterface: InsulinInterface): IobTotal { +fun ExtendedBolus.iobCalc(time: Long, profile: Profile, lastAutosensResult: AutosensResult, exercise_mode: Boolean, half_basal_exercise_target: Int, isTempTarget: Boolean, insulinInterface: Insulin): IobTotal { val result = IobTotal(time) val realDuration = getPassedDurationToTimeInMinutes(time) var sensitivityRatio = lastAutosensResult.ratio diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt index 549792a109..6ab4c012e3 100644 --- a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt @@ -8,7 +8,7 @@ import info.nightscout.androidaps.database.entities.TemporaryBasal import info.nightscout.androidaps.database.entities.TemporaryBasal.Type.Companion.fromString import info.nightscout.androidaps.database.entities.TherapyEvent import info.nightscout.androidaps.database.interfaces.end -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal @@ -130,7 +130,7 @@ fun TemporaryBasal.toStringShort(): String = if (isAbsolute || type == TemporaryBasal.Type.FAKE_EXTENDED) to2Decimal(rate) + "U/h" else "${to0Decimal(rate)}%" -fun TemporaryBasal.iobCalc(time: Long, profile: Profile, insulinInterface: InsulinInterface): IobTotal { +fun TemporaryBasal.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal { val result = IobTotal(time) val realDuration: Int = getPassedDurationToTimeInMinutes(time) var netBasalAmount = 0.0 @@ -172,7 +172,7 @@ fun TemporaryBasal.iobCalc(time: Long, profile: Profile, insulinInterface: Insul return result } -fun TemporaryBasal.iobCalc(time: Long, profile: Profile, lastAutosensResult: AutosensResult, exercise_mode: Boolean, half_basal_exercise_target: Int, isTempTarget: Boolean, insulinInterface: InsulinInterface): IobTotal { +fun TemporaryBasal.iobCalc(time: Long, profile: Profile, lastAutosensResult: AutosensResult, exercise_mode: Boolean, half_basal_exercise_target: Int, isTempTarget: Boolean, insulinInterface: Insulin): IobTotal { val result = IobTotal(time) val realDuration: Double = getPassedDurationToTimeInMinutes(time).toDouble() var netBasalAmount = 0.0 diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/APSInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/APS.kt similarity index 90% rename from core/src/main/java/info/nightscout/androidaps/interfaces/APSInterface.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/APS.kt index 38eb6dac20..cb2c2b4005 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/APSInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/APS.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.plugins.aps.loop.APSResult -interface APSInterface { +interface APS { val lastAPSResult: APSResult? val lastAPSRun: Long diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt new file mode 100644 index 0000000000..77dac99e04 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt @@ -0,0 +1,74 @@ +package info.nightscout.androidaps.interfaces + +import java.util.* + +interface ActivePlugin { + + /** + * Currently selected BgSource plugin + * Default to Dexcom + */ + val activeBgSource: BgSource + + /** + * Currently selected Profile plugin + * Default LocalProfile + */ + val activeProfileInterface: ProfileInterface + + /** + * Currently selected Insulin plugin + * Default RapidActing + */ + val activeInsulin: Insulin + + /** + * Currently selected APS plugin + * Default SMB + */ + val activeAPS: APS + + /** + * Currently selected Pump plugin + * Default VirtualPump + */ + val activePump: PumpInterface + + /** + * Currently selected Sensitivity plugin + * Default Oref1 + */ + val activeSensitivity: Sensitivity + + /** + * Currently selected Treatments plugin + */ + val activeTreatments: TreatmentsInterface + + /** + * Currently selected Overview plugin + * Always OverviewPlugin + */ + val activeOverview: Overview + + /** + * List of all registered plugins + */ + fun getPluginsList(): ArrayList + + /** + * List of all plugins of type marked as ShowInList + * (for ConfigBuilder UI) + */ + fun getSpecificPluginsVisibleInList(type: PluginType): ArrayList + + /** + * List of all plugins implementing interface + */ + fun getSpecificPluginsListByInterface(interfaceClass: Class<*>): ArrayList + + /** + * Pre-process all plugin types and validate active plugins (ie. only only one plugin for type is selected) + */ + fun verifySelectionInCategories() +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt deleted file mode 100644 index ba13cd3888..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -package info.nightscout.androidaps.interfaces - -import java.util.* - -interface ActivePluginProvider { - - val activeBgSource: BgSourceInterface // Forced to Dexcom - val activeProfileInterface: ProfileInterface // Forced to LocalProfile if not changed - val activeInsulin: InsulinInterface // Forced to RapidActing if not changed - val activeAPS: APSInterface // Forced to SMB - val activePump: PumpInterface // Use in places not reachable without active pump. Otherwise IllegalStateException is thrown - val activeSensitivity: SensitivityInterface // Forced to oref1 if not changed - val activeTreatments: TreatmentsInterface // Forced to treatments - val activeOverview: OverviewInterface // Forced to overview - - fun getPluginsList(): ArrayList - - fun getSpecificPluginsVisibleInListByInterface(interfaceClass: Class<*>, type: PluginType): ArrayList - fun getSpecificPluginsVisibleInList(type: PluginType): ArrayList - fun getSpecificPluginsListByInterface(interfaceClass: Class<*>): ArrayList - fun verifySelectionInCategories() -} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt new file mode 100644 index 0000000000..91e4638353 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt @@ -0,0 +1,29 @@ +package info.nightscout.androidaps.interfaces + +import info.nightscout.androidaps.database.entities.GlucoseValue + +interface BgSource { + + /** + * Does bg source support advanced filtering ? Currently Dexcom native mode only + * + * @return true if supported + */ + fun advancedFilteringSupported(): Boolean = false + + /** + * Sensor battery level in % + * + * -1 if not supported + */ + val sensorBatteryLevel: Int + get() = -1 + + /** + * Decide if GlucoseValue should be uploaded to NS + * + * @param glucoseValue glucose value + * @return true if GlucoseValue should be uploaded to NS (supported by plugin and enabled in preferences) + */ + fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/BgSourceInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/BgSourceInterface.kt deleted file mode 100644 index 0543004913..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/BgSourceInterface.kt +++ /dev/null @@ -1,14 +0,0 @@ -package info.nightscout.androidaps.interfaces - -import info.nightscout.androidaps.database.entities.GlucoseValue - -/** - * Created by mike on 20.06.2016. - */ -interface BgSourceInterface { - - fun advancedFilteringSupported(): Boolean = false - val sensorBatteryLevel: Int - get() = -1 - fun uploadToNs(glucoseValue: GlucoseValue) : Boolean -} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImport.kt similarity index 80% rename from core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImport.kt index 5e4cee973b..5f50f16df3 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImport.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.interfaces import org.json.JSONObject -interface ConfigExportImportInterface { +interface ConfigExportImport { fun configuration(): JSONObject fun applyConfiguration(configuration: JSONObject) diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt similarity index 64% rename from core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt index 27397a2c83..368587650b 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt @@ -2,21 +2,21 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.database.entities.Bolus -import info.nightscout.androidaps.db.Treatment -import org.json.JSONObject -interface InsulinInterface : ConfigExportImportInterface{ +interface Insulin : ConfigExportImport { enum class InsulinType(val value: Int) { UNKNOWN(-1), - // int FASTACTINGINSULIN = 0; // old model no longer available - // int FASTACTINGINSULINPROLONGED = 1; // old model no longer available + + // int FAST_ACTING_INSULIN = 0; // old model no longer available + // int FAST_ACTING_INSULIN_PROLONGED = 1; // old model no longer available OREF_RAPID_ACTING(2), OREF_ULTRA_RAPID_ACTING(3), OREF_FREE_PEAK(4), OREF_LYUMJEV(5); companion object { + private val map = values().associateBy(InsulinType::value) fun fromInt(type: Int) = map[type] } @@ -27,6 +27,5 @@ interface InsulinInterface : ConfigExportImportInterface{ val comment: String val dia: Double - fun iobCalcForTreatment(treatment: Treatment, time: Long, dia: Double): Iob fun iobCalcForTreatment(bolus: Bolus, time: Long, dia: Double): Iob } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt new file mode 100644 index 0000000000..23d43b35b0 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt @@ -0,0 +1,3 @@ +package info.nightscout.androidaps.interfaces + +interface Overview : ConfigExportImport \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt deleted file mode 100644 index 7bc6dfa429..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt +++ /dev/null @@ -1,3 +0,0 @@ -package info.nightscout.androidaps.interfaces - -interface OverviewInterface : ConfigExportImportInterface \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt index b560353b3a..de78f2a12b 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt @@ -36,7 +36,7 @@ abstract class PluginBase( get() { if (pluginDescription.shortName == -1) return name val translatedName = resourceHelper.gs(pluginDescription.shortName) - return if (!translatedName.trim { it <= ' ' }.isEmpty()) translatedName else name + return if (translatedName.trim { it <= ' ' }.isNotEmpty()) translatedName else name // use long name as fallback } @@ -68,7 +68,7 @@ abstract class PluginBase( /** * So far plugin can have it's main type + ConstraintInterface + ProfileInterface * ConstraintInterface is enabled if main plugin is enabled - * ProfileInterface can be enabled only if main iterface is enable + * ProfileInterface can be enabled only if main interface is enable */ fun setPluginEnabled(type: PluginType, newState: Boolean) { if (type == pluginDescription.mainType) { @@ -103,7 +103,7 @@ abstract class PluginBase( fun showInList(type: PluginType): Boolean { if (pluginDescription.mainType == type) return pluginDescription.showInList && specialShowInListCondition() - return if (type == PluginType.PROFILE && pluginDescription.mainType == PluginType.PUMP) isEnabled(PluginType.PUMP) else false + return false } open fun specialEnableCondition(): Boolean { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Sensitivity.kt similarity index 92% rename from core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/Sensitivity.kt index 47772ce312..b15d2a976c 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Sensitivity.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -interface SensitivityInterface : ConfigExportImportInterface { +interface Sensitivity : ConfigExportImport { enum class SensitivityType(val value: Int) { UNKNOWN(-1), diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt index 653d6c1f44..989ecdcdd0 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.core.R import info.nightscout.androidaps.data.IobTotal import info.nightscout.androidaps.database.entities.GlucoseValue -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction @@ -35,7 +35,7 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) { @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var sp: SP - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var resourceHelper: ResourceHelper diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt index 07b4f8f66b..bd3c1d32b6 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.configBuilder import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.ConstraintsInterface import info.nightscout.androidaps.interfaces.PluginType @@ -10,7 +10,7 @@ import javax.inject.Inject import javax.inject.Singleton @Singleton -class ConstraintChecker @Inject constructor(private val activePlugin: ActivePluginProvider) : ConstraintsInterface { +class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlugin) : ConstraintsInterface { fun isLoopInvocationAllowed(): Constraint = isLoopInvocationAllowed(Constraint(true)) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt index 9145214ea9..f18048ac51 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch import info.nightscout.androidaps.db.Source import info.nightscout.androidaps.interfaces.ProfileStore -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.TreatmentsInterface import info.nightscout.androidaps.logging.AAPSLogger @@ -27,7 +27,7 @@ class ProfileFunctionImplementation @Inject constructor( private val aapsLogger: AAPSLogger, private val sp: SP, private val resourceHelper: ResourceHelper, - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil ) : ProfileFunction { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt index 9e809c42db..cf3b151d4d 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt @@ -1,11 +1,11 @@ package info.nightscout.androidaps.plugins.configBuilder import info.nightscout.androidaps.core.R -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigBuilder -import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.PluginType -import info.nightscout.androidaps.interfaces.SensitivityInterface +import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.pump.common.defs.PumpType @@ -18,7 +18,7 @@ import javax.inject.Singleton @Singleton class RunningConfiguration @Inject constructor( - private val activePlugin: ActivePluginProvider, + private val activePlugin: ActivePlugin, private val configBuilder: ConfigBuilder, private val sp: SP, private val aapsLogger: AAPSLogger @@ -52,9 +52,9 @@ class RunningConfiguration @Inject constructor( // called in NSClient mode only fun apply(configuration: JSONObject) { if (configuration.has("insulin")) { - val insulin = InsulinInterface.InsulinType.fromInt(JsonHelper.safeGetInt(configuration, "insulin", InsulinInterface.InsulinType.UNKNOWN.value)) - for (p in activePlugin.getSpecificPluginsListByInterface(InsulinInterface::class.java)) { - val insulinPlugin = p as InsulinInterface + val insulin = Insulin.InsulinType.fromInt(JsonHelper.safeGetInt(configuration, "insulin", Insulin.InsulinType.UNKNOWN.value)) + for (p in activePlugin.getSpecificPluginsListByInterface(Insulin::class.java)) { + val insulinPlugin = p as Insulin if (insulinPlugin.id == insulin) { if (!p.isEnabled()) { aapsLogger.debug(LTag.CORE, "Changing insulin plugin to ${insulin.name}") @@ -66,9 +66,9 @@ class RunningConfiguration @Inject constructor( } if (configuration.has("sensitivity")) { - val sensitivity = SensitivityInterface.SensitivityType.fromInt(JsonHelper.safeGetInt(configuration, "sensitivity", SensitivityInterface.SensitivityType.UNKNOWN.value)) - for (p in activePlugin.getSpecificPluginsListByInterface(SensitivityInterface::class.java)) { - val sensitivityPlugin = p as SensitivityInterface + val sensitivity = Sensitivity.SensitivityType.fromInt(JsonHelper.safeGetInt(configuration, "sensitivity", Sensitivity.SensitivityType.UNKNOWN.value)) + for (p in activePlugin.getSpecificPluginsListByInterface(Sensitivity::class.java)) { + val sensitivityPlugin = p as Sensitivity if (sensitivityPlugin.id == sensitivity) { if (!p.isEnabled()) { aapsLogger.debug(LTag.CORE, "Changing sensitivity plugin to ${sensitivity.name}") diff --git a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index f6a8baeb83..813d0dcf5d 100644 --- a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileStore @@ -23,7 +23,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt index 1c6e3d152d..2c93443d2d 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt @@ -15,7 +15,7 @@ import info.nightscout.androidaps.events.EventExtendedBolusChange import info.nightscout.androidaps.events.EventInitializationChanged import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.events.EventTempBasalChange -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.logging.AAPSLogger @@ -46,7 +46,7 @@ class DanaFragment : DaggerFragment() { @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var danaPump: DanaPump @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var sp: SP diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt index b631b05efa..76d491995c 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.DanaRHistoryRecord import info.nightscout.androidaps.events.EventDanaRSyncStatus import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -42,7 +42,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() { @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var databaseHelper: DatabaseHelperInterface @Inject lateinit var dateUtil: DateUtil diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt index c96237455c..3936d22eb8 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.dana.R import info.nightscout.androidaps.dana.databinding.DanarUserOptionsActivityBinding import info.nightscout.androidaps.events.EventInitializationChanged -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -32,7 +32,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() { @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var context: Context @Inject lateinit var danaPump: DanaPump - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var aapsSchedulers: AapsSchedulers diff --git a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index be4e29d439..7232a0c367 100644 --- a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileStore @@ -23,7 +23,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index 2c35807936..0f9669df39 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -15,7 +15,7 @@ import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.events.EventPreferenceChange -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType @@ -48,7 +48,7 @@ class DanaRKoreanPlugin @Inject constructor( private val context: Context, resourceHelper: ResourceHelper, constraintChecker: ConstraintChecker, - activePlugin: ActivePluginProvider, + activePlugin: ActivePlugin, sp: SP, commandQueue: CommandQueueProvider, danaPump: DanaPump, diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 02ae08ec28..a4a5555c81 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -42,7 +42,7 @@ import info.nightscout.androidaps.dialogs.BolusProgressDialog; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventProfileNeedsUpdate; import info.nightscout.androidaps.events.EventPumpStatusChanged; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.PumpSync; @@ -69,7 +69,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { @Inject DanaRKoreanPlugin danaRKoreanPlugin; @Inject CommandQueueProvider commandQueue; @Inject MessageHashTableRKorean messageHashTableRKorean; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject ProfileFunction profileFunction; @Inject PumpSync pumpSync; @Inject DateUtil dateUtil; diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index 72d70a14ab..34309dd182 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -20,7 +20,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventAppExit; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PumpSync; @@ -64,7 +64,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { Context context, ResourceHelper resourceHelper, ConstraintChecker constraintChecker, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, CommandQueueProvider commandQueue, DanaPump danaPump, diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index 73532ab9b1..35ad542dd3 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -55,7 +55,7 @@ import info.nightscout.androidaps.dialogs.BolusProgressDialog; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventProfileNeedsUpdate; import info.nightscout.androidaps.events.EventPumpStatusChanged; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.PumpInterface; @@ -82,7 +82,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { @Inject DanaPump danaPump; @Inject DanaRKoreanPlugin danaRKoreanPlugin; @Inject DanaRv2Plugin danaRv2Plugin; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject CommandQueueProvider commandQueue; @Inject Context context; @Inject MessageHashTableRv2 messageHashTableRv2; diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index e6136df269..6fb15bb05f 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -15,7 +15,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.extensions.PumpStateExtensionKt; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.ConstraintsInterface; @@ -57,7 +57,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump protected DanaPump danaPump; protected ConstraintChecker constraintChecker; protected RxBusWrapper rxBus; - protected ActivePluginProvider activePlugin; + protected ActivePlugin activePlugin; protected SP sp; protected DateUtil dateUtil; protected AapsSchedulers aapsSchedulers; @@ -72,7 +72,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump AapsSchedulers aapsSchedulers, CommandQueueProvider commandQueue, RxBusWrapper rxBus, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, DateUtil dateUtil, PumpSync pumpSync diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 3cc4aa1154..6aaa1f2bf2 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -19,7 +19,7 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventPreferenceChange; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PluginType; @@ -58,7 +58,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { Context context, ResourceHelper resourceHelper, ConstraintChecker constraintChecker, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, CommandQueueProvider commandQueue, DanaPump danaPump, diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java index 39115103a9..7ac298d494 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java @@ -17,7 +17,7 @@ import info.nightscout.androidaps.dana.DanaPump; import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.danaRv2.DanaRv2Plugin; import info.nightscout.androidaps.danar.DanaRPlugin; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.ConfigBuilder; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; @@ -47,7 +47,7 @@ public class MessageBase { @Inject public DanaRv2Plugin danaRv2Plugin; @Inject public RxBusWrapper rxBus; @Inject public ResourceHelper resourceHelper; - @Inject public ActivePluginProvider activePlugin; + @Inject public ActivePlugin activePlugin; @Inject public ConfigBuilder configBuilder; @Inject public CommandQueueProvider commandQueue; @Inject public DetailedBolusInfoStorage detailedBolusInfoStorage; diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index 2eac4030e9..51e81ab5e7 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -38,7 +38,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventBTChange; import info.nightscout.androidaps.events.EventPumpStatusChanged; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.AAPSLogger; @@ -72,7 +72,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { @Inject DatabaseHelperInterface databaseHelper; @Inject AapsSchedulers aapsSchedulers; @Inject PumpSync pumpSync; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; private final CompositeDisposable disposable = new CompositeDisposable(); diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index be4e29d439..7232a0c367 100644 --- a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileStore @@ -23,7 +23,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 9677e10d73..6eb138470a 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -29,7 +29,7 @@ open class DanaRTestBase : TestBase() { @Mock lateinit var sp: SP @Mock lateinit var profileFunction: ProfileFunction - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var dateUtil: DateUtil @Mock lateinit var databaseHelper: DatabaseHelperInterface @Mock lateinit var danaRPlugin: DanaRPlugin @@ -48,7 +48,7 @@ open class DanaRTestBase : TestBase() { fun setup() { danaPump = DanaPump(aapsLogger, sp, dateUtil, injector) testPumpPlugin = TestPumpPlugin(injector) - `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) + `when`(activePlugin.activePump).thenReturn(testPumpPlugin) doNothing().`when`(danaRKoreanPlugin).setPluginEnabled(anyObject(), anyBoolean()) doNothing().`when`(danaRPlugin).setPluginEnabled(anyObject(), anyBoolean()) `when`(resourceHelper.gs(ArgumentMatchers.anyInt())).thenReturn("") @@ -65,7 +65,7 @@ open class DanaRTestBase : TestBase() { it.danaRv2Plugin = danaRv2Plugin it.rxBus = RxBusWrapper(aapsSchedulers) it.resourceHelper = resourceHelper - it.activePlugin = activePluginProvider + it.activePlugin = activePlugin it.configBuilder = configBuilder it.detailedBolusInfoStorage = detailedBolusInfoStorage it.constraintChecker = constraintChecker diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt index f3b6f159d1..000b2800fb 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.events.EventInitializationChanged import info.nightscout.androidaps.events.EventProfileNeedsUpdate import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync @@ -65,7 +65,7 @@ class DanaRSService : DaggerService() { @Inject lateinit var danaRSPlugin: DanaRSPlugin @Inject lateinit var danaPump: DanaPump @Inject lateinit var danaRSMessageHashTable: DanaRSMessageHashTable - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Inject lateinit var bleComm: BLEComm diff --git a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index be4e29d439..7232a0c367 100644 --- a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileStore @@ -23,7 +23,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { - @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var treatmentsInterface: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index 556d3bf7c1..7bbeef73b6 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert @@ -21,7 +21,7 @@ import org.powermock.modules.junit4.PowerMockRunner @PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() { - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt index 2397295ffa..98c90be4ac 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.encryption.BleEncryption -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage @@ -20,7 +20,7 @@ import org.powermock.modules.junit4.PowerMockRunner @PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class) class DanaRsMessageHashTableTest : DanaRSTestBase() { - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt index 0ec370e381..093adb3fe3 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt @@ -5,7 +5,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage @@ -23,7 +23,7 @@ import java.util.* class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() { @Mock lateinit var context: Context - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var pumpSync: PumpSync @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index f8d583c27c..840f9c6b42 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert @@ -20,7 +20,7 @@ import org.powermock.modules.junit4.PowerMockRunner @PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) class DanaRsPacketBolusSetStepBolusStopTest : DanaRSTestBase() { - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index b8318b686f..ab9b803ad9 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -5,7 +5,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -27,7 +27,7 @@ import org.powermock.modules.junit4.PowerMockRunner @PrepareForTest(ConstraintChecker::class, RxBusWrapper::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class) class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { - @Mock lateinit var activePlugin: ActivePluginProvider + @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var context: Context diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java index 7023f8f06c..f5f8e39870 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java @@ -20,7 +20,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventCustomActionsChanged; import info.nightscout.androidaps.extensions.PumpStateExtensionKt; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.ConstraintsInterface; import info.nightscout.androidaps.interfaces.PluginDescription; @@ -56,7 +56,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI protected HasAndroidInjector injector; protected AAPSLogger aapsLogger; protected RxBusWrapper rxBus; - protected ActivePluginProvider activePlugin; + protected ActivePlugin activePlugin; protected Context context; protected FabricPrivacy fabricPrivacy; protected ResourceHelper resourceHelper; @@ -80,7 +80,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI AAPSLogger aapsLogger, CommandQueueProvider commandQueue, RxBusWrapper rxBus, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, Context context, FabricPrivacy fabricPrivacy, diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt index fea2656607..d9124ec15e 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.events.EventExtendedBolusChange import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.events.EventTempBasalChange import info.nightscout.androidaps.extensions.toStringFull -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.AAPSLogger @@ -56,7 +56,7 @@ class MedtronicFragment : DaggerFragment() { @Inject lateinit var dateUtil: DateUtil @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var warnColors: WarnColors @Inject lateinit var rileyLinkUtil: RileyLinkUtil diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 0c66db266c..3499364bdb 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -35,7 +35,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.events.EventRefreshOverview; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; @@ -127,7 +127,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter RxBusWrapper rxBus, Context context, ResourceHelper resourceHelper, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, CommandQueueProvider commandQueue, FabricPrivacy fabricPrivacy, diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java index 0d0f5ce006..f4fa579e93 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java @@ -27,7 +27,7 @@ import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TDD; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.Treatment; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.AAPSLogger; @@ -72,7 +72,7 @@ public class MedtronicHistoryData { private final HasAndroidInjector injector; private final AAPSLogger aapsLogger; private final SP sp; - private final ActivePluginProvider activePlugin; + private final ActivePlugin activePlugin; private final MedtronicUtil medtronicUtil; private final MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder; private final MedtronicPumpStatus medtronicPumpStatus; @@ -105,7 +105,7 @@ public class MedtronicHistoryData { HasAndroidInjector injector, AAPSLogger aapsLogger, SP sp, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, MedtronicUtil medtronicUtil, MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder, MedtronicPumpStatus medtronicPumpStatus, diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java index fe7f001654..c2c8180b5a 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java @@ -11,7 +11,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import java.util.List; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLoggerTest; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; @@ -35,7 +35,7 @@ public class MedtronicPumpHistoryDecoderUTest { AAPSLogger aapsLogger = new AAPSLoggerTest(); RxBusWrapper rxBusWrapper = new RxBusWrapper(new TestAapsSchedulers()); @Mock ResourceHelper resourceHelper; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) ActivePluginProvider activePluginProvider; + @Mock(answer = Answers.RETURNS_DEEP_STUBS) ActivePlugin activePlugin; @Mock RileyLinkUtil rileyLinkUtil; @Mock SP sp; MedtronicPumpStatus medtronicPumpStatus; diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index cecd69564d..b985f757d2 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -40,7 +40,7 @@ import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppInitialized; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventRefreshOverview; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; @@ -132,7 +132,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements PumpInterfa private final AAPSLogger aapsLogger; private final AapsSchedulers aapsSchedulers; private final RxBusWrapper rxBus; - private final ActivePluginProvider activePlugin; + private final ActivePlugin activePlugin; private final Context context; private final FabricPrivacy fabricPrivacy; private final ResourceHelper resourceHelper; @@ -166,7 +166,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements PumpInterfa RxBusWrapper rxBus, Context context, ResourceHelper resourceHelper, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, SP sp, PodStateManager podStateManager, AapsOmnipodErosManager aapsOmnipodErosManager, diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java index 206b182ad6..d394747a58 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java @@ -22,7 +22,7 @@ import info.nightscout.androidaps.db.OmnipodHistoryRecord; import info.nightscout.androidaps.events.Event; import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.extensions.PumpStateExtensionKt; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.AAPSLogger; @@ -94,7 +94,7 @@ public class AapsOmnipodErosManager { private final RxBusWrapper rxBus; private final ResourceHelper resourceHelper; private final HasAndroidInjector injector; - private final ActivePluginProvider activePlugin; + private final ActivePlugin activePlugin; private final SP sp; private final OmnipodManager delegate; private final DatabaseHelperInterface databaseHelper; @@ -127,7 +127,7 @@ public class AapsOmnipodErosManager { SP sp, ResourceHelper resourceHelper, HasAndroidInjector injector, - ActivePluginProvider activePlugin, + ActivePlugin activePlugin, DatabaseHelperInterface databaseHelper, OmnipodAlertUtil omnipodAlertUtil, Context context, diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt index 747b5fb86c..fe2bd876a2 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt @@ -13,7 +13,7 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.Constants import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.events.EventPreferenceChange -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification @@ -72,7 +72,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() { @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var commandQueue: CommandQueueProvider - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin @Inject lateinit var podStateManager: PodStateManager @Inject lateinit var sp: SP diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java index d3a246ffe0..bb0ba03b19 100644 --- a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.AAPSLogger; @@ -46,7 +46,7 @@ public class OmnipodErosPumpPluginTest { AAPSLogger aapsLogger = new AAPSLoggerTest(); RxBusWrapper rxBusWrapper = new RxBusWrapper(new TestAapsSchedulers()); @Mock ResourceHelper resourceHelper; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) ActivePluginProvider activePluginProvider; + @Mock(answer = Answers.RETURNS_DEEP_STUBS) ActivePlugin activePlugin; @Mock AapsOmnipodErosManager aapsOmnipodErosManager; @Mock CommandQueueProvider commandQueueProvider; @Mock RileyLinkUtil rileyLinkUtil; @@ -66,7 +66,7 @@ public class OmnipodErosPumpPluginTest { // mock all the things PowerMockito.mockStatic(Looper.class); OmnipodErosPumpPlugin plugin = new OmnipodErosPumpPlugin(injector, aapsLogger, new TestAapsSchedulers(), rxBusWrapper, null, - resourceHelper, activePluginProvider, null, null, aapsOmnipodErosManager, commandQueueProvider, + resourceHelper, activePlugin, null, null, aapsOmnipodErosManager, commandQueueProvider, null, null, null, null, rileyLinkUtil, null, null, pumpSync ); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.java index 7a65e186ee..3f2482c2cc 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.java @@ -32,7 +32,7 @@ import java.util.Map; import javax.inject.Inject; import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.R; @@ -52,7 +52,7 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity { @Inject ResourceHelper resourceHelper; @Inject BlePreCheck blePrecheck; @Inject RileyLinkUtil rileyLinkUtil; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; private static final String TAG = "RileyLinkBLEConfigActivity"; private static final long SCAN_PERIOD_MILLIS = 15_000; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java index 0a88d5b510..fcaf8e3bcd 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java @@ -5,7 +5,7 @@ import java.util.Locale; import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; @@ -39,7 +39,7 @@ public abstract class RileyLinkCommunicationManager { @Inject protected ServiceTaskExecutor serviceTaskExecutor; @Inject protected RFSpy rfspy; @Inject protected HasAndroidInjector injector; - @Inject protected ActivePluginProvider activePluginProvider; + @Inject protected ActivePlugin activePlugin; private final int SCAN_TIMEOUT = 1500; private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes @@ -427,7 +427,7 @@ public abstract class RileyLinkCommunicationManager { } private RileyLinkPumpDevice getPumpDevice() { - return (RileyLinkPumpDevice) activePluginProvider.getActivePump(); + return (RileyLinkPumpDevice) activePlugin.getActivePump(); } public abstract boolean isDeviceReachable(); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java index e9dddd92f6..2ae48e3f5a 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java @@ -13,7 +13,7 @@ import java.util.Optional; import javax.inject.Inject; import dagger.android.support.DaggerFragment; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.plugins.pump.common.R; import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; @@ -35,7 +35,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re private static final String PLACEHOLDER = "-"; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject ResourceHelper resourceHelper; @Inject AAPSLogger aapsLogger; @Inject RileyLinkServiceData rileyLinkServiceData; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt index 54e2f59cbd..a72093cc98 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt @@ -5,7 +5,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import dagger.android.DaggerBroadcastReceiver -import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil @@ -13,7 +13,7 @@ import javax.inject.Inject class RileyLinkBluetoothStateReceiver : DaggerBroadcastReceiver() { @Inject lateinit var aapsLogger: AAPSLogger - @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var rileyLinkUtil: RileyLinkUtil override fun onReceive(context: Context, intent: Intent) { diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java index dbe2731e89..096b1e0b20 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java @@ -20,7 +20,7 @@ import javax.inject.Inject; import dagger.android.DaggerBroadcastReceiver; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; @@ -47,7 +47,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver { @Inject AAPSLogger aapsLogger; @Inject RileyLinkServiceData rileyLinkServiceData; @Inject ServiceTaskExecutor serviceTaskExecutor; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; RileyLinkService serviceInstance; protected Map> broadcastIdentifiers = null; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java index 5c8e47d74a..c1c4bebc3b 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java @@ -12,7 +12,7 @@ import javax.inject.Inject; import dagger.android.DaggerService; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; @@ -43,7 +43,7 @@ public abstract class RileyLinkService extends DaggerService { @Inject protected HasAndroidInjector injector; @Inject protected ResourceHelper resourceHelper; @Inject protected RileyLinkServiceData rileyLinkServiceData; - @Inject protected ActivePluginProvider activePlugin; + @Inject protected ActivePlugin activePlugin; @Inject protected RileyLinkBLE rileyLinkBLE; // android-bluetooth management @Inject protected RFSpy rfspy; // interface for RL xxx Mhz radio. diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java index 7b68549902..249c94d74b 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java @@ -5,7 +5,7 @@ import java.util.Locale; import javax.inject.Inject; import javax.inject.Singleton; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; @@ -29,7 +29,7 @@ public class RileyLinkServiceData { @Inject AAPSLogger aapsLogger; @Inject RileyLinkUtil rileyLinkUtil; @Inject RxBusWrapper rxBus; - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; boolean tuneUpDone = false; public RileyLinkError rileyLinkError; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java index d0916911ea..06ea7e3831 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java @@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java index 45e16b6487..28a56795a7 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; @@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin */ public class ResetRileyLinkConfigurationTask extends PumpTask { - @Inject ActivePluginProvider activePlugin; + @Inject ActivePlugin activePlugin; @Inject RxBusWrapper rxBus; @Inject RFSpy rfSpy; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java index 74193bda1c..498344913b 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; +import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; @@ -12,7 +12,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data. */ public class ServiceTask implements Runnable { - @Inject protected ActivePluginProvider activePlugin; + @Inject protected ActivePlugin activePlugin; public boolean completed = false; protected ServiceTransport mTransport; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java index 911b078e46..cf4ace58c8 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java @@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task import javax.inject.Inject; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;