From 73f876a45da78a5b5246b66207f2aa11e3e886be Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 10 Nov 2022 19:27:04 +0100 Subject: [PATCH] move to interfaces --- .../activities/MyPreferenceFragment.kt | 3 +- .../nightscout/androidaps/di/AppModule.kt | 4 +- .../androidaps/dialogs/InsulinDialog.kt | 3 +- .../androidaps/dialogs/ProfileSwitchDialog.kt | 9 +- .../androidaps/dialogs/TempBasalDialog.kt | 2 +- .../androidaps/dialogs/TempTargetDialog.kt | 12 +- .../androidaps/dialogs/WizardDialog.kt | 4 +- .../androidaps/plugins/aps/loop/LoopPlugin.kt | 6 +- .../openAPSAMA/DetermineBasalAdapterAMAJS.kt | 2 +- .../aps/openAPSAMA/OpenAPSAMAPlugin.kt | 5 +- .../openAPSSMB/DetermineBasalAdapterSMBJS.kt | 2 +- .../aps/openAPSSMB/OpenAPSSMBPlugin.kt | 5 +- .../DetermineBasalAdapterSMBDynamicISFJS.kt | 3 +- .../OpenAPSSMBDynamicISFPlugin.kt | 10 +- .../configBuilder/ConfigBuilderPlugin.kt | 4 +- .../plugins/configBuilder/PluginStore.kt | 2 +- .../configBuilder/ProfileFunctionImpl.kt | 6 +- .../constraints/safety/SafetyPlugin.kt | 4 +- .../maintenance/MaintenanceFragment.kt | 2 +- .../general/overview/OverviewFragment.kt | 5 +- .../PersistentNotificationPlugin.kt | 3 +- .../wear/wearintegration/DataHandlerMobile.kt | 7 +- .../IobCobCalculatorPlugin.kt | 2 +- .../sensitivity/SensitivityAAPSPlugin.kt | 5 +- .../sensitivity/SensitivityOref1Plugin.kt | 5 +- .../SensitivityWeightedAveragePlugin.kt | 5 +- .../androidaps/plugins/source/DexcomPlugin.kt | 3 +- .../receivers/TimeDateOrTZChangeReceiver.kt | 2 +- .../androidaps/setupwizard/SWDefinition.kt | 2 +- .../elements/SWEditNumberWithUnits.kt | 7 +- .../utils/extensions/DoubleToSignedString.kt | 2 +- .../androidaps/utils/wizard/BolusWizard.kt | 6 +- .../utils/wizard/QuickWizardEntry.kt | 3 +- .../workflow/PrepareBgDataWorker.kt | 8 +- .../PrepareTemporaryTargetDataWorker.kt | 9 +- .../workflow/PrepareTreatmentsDataWorker.kt | 5 +- .../androidaps/TestBaseWithProfile.kt | 2 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../interfaces/ConstraintsCheckerTest.kt | 6 +- .../configBuilder/ConfigBuilderPluginTest.kt | 4 +- .../constraints/safety/SafetyPluginTest.kt | 43 ++-- .../utils/wizard/BolusWizardTest.kt | 2 +- .../actions/ActionStartTempTarget.kt | 7 +- .../automation/elements/InputTime.kt | 7 +- .../automation/elements/InputTimeRange.kt | 7 +- .../automation/triggers/TriggerBg.kt | 10 +- .../automation/triggers/TriggerDelta.kt | 10 +- .../triggers/TriggerRecurringTime.kt | 8 +- .../triggers/TriggerTempTargetValue.kt | 12 +- .../automation/triggers/TriggerTimeRange.kt | 8 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../automation/actions/ActionsTestBase.kt | 2 +- .../androidaps/data/ProfileSealed.kt | 111 ++++----- .../androidaps/dialogs/ProfileViewerDialog.kt | 22 +- .../BolusCalculatorResultExtension.kt | 3 +- .../extensions/ExtendedBolusExtension.kt | 10 +- .../extensions/GlucoseValueExtension.kt | 1 + .../extensions/ProfileSwitchExtension.kt | 8 +- .../extensions/TemporaryBasalExtension.kt | 13 +- .../extensions/TemporaryTargetExtension.kt | 3 +- .../androidaps/interfaces/ActivePlugin.kt | 1 + .../androidaps/interfaces/CommandQueue.kt | 6 +- .../androidaps/interfaces/Constraints.kt | 1 + .../DetermineBasalAdapterInterface.kt | 1 + .../androidaps/interfaces/IobCobCalculator.kt | 1 + .../nightscout/androidaps/interfaces/Loop.kt | 1 + .../androidaps/interfaces/Profile.kt | 212 ------------------ .../androidaps/interfaces/ProfileFunction.kt | 1 + .../graphExtensions/GlucoseValueDataPoint.kt | 3 +- .../graphExtensions/TherapyEventDataPoint.kt | 4 +- .../common/bolusInfo/TemporaryBasalStorage.kt | 4 +- .../androidaps/utils/DecimalFormatter.kt | 2 +- .../androidaps/utils/DefaultValueHelper.kt | 9 +- .../textValidator/DefaultEditTextValidator.kt | 35 ++- .../ValidatingEditTextPreference.kt | 6 +- .../validators/BgRangeValidator.kt | 3 +- .../androidaps/utils/ui/BasalProfileGraph.kt | 2 +- .../androidaps/utils/ui/IcProfileGraph.kt | 2 +- .../androidaps/utils/ui/IsfProfileGraph.kt | 3 +- .../utils/ui/TargetBgProfileGraph.kt | 7 +- .../userEntry/UserEntryPresentationHelper.kt | 3 +- .../core/profile/ProfileExtension.kt | 80 +++++++ .../core/profile/ProfileStoreObject.kt | 4 +- .../core/pumpExtensions/PumpStateExtension.kt | 4 +- .../androidaps/TestBaseWithProfile.kt | 9 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../nightscout/androidaps/data/ProfileTest.kt | 25 ++- .../bolusInfo/TemporaryBasalStorageTest.kt | 2 +- .../implementation/HardLimitsImpl.kt | 36 +-- .../constraints/ConstraintsImpl.kt | 2 +- .../implementation/di/ImplementationModule.kt | 15 +- .../pump/PumpSyncImplementation.kt | 2 +- .../queue/CommandQueueImplementation.kt | 6 +- .../queue/commands/CommandSetProfile.kt | 2 +- .../commands/CommandTempBasalAbsolute.kt | 7 +- .../queue/commands/CommandTempBasalPercent.kt | 7 +- .../implementation/stats/DexcomTirImpl.kt | 10 +- .../implementation/stats/TirCalculatorImpl.kt | 15 +- .../androidaps/TestBaseWithProfile.kt | 2 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../queue/CommandQueueImplementationTest.kt | 2 +- .../implementation/queue/QueueThreadTest.kt | 2 +- .../pump/insight/LocalInsightPlugin.java | 8 +- .../activities/InsightPairingActivity.java | 4 +- .../nightscout/interfaces/profile/Profile.kt | 138 ++++++++++++ .../info/nightscout/interfaces/pump}/Pump.kt | 11 +- .../nightscout/interfaces/pump}/PumpSync.kt | 16 +- .../nightscout/interfaces/utils/HardLimits.kt | 47 ++++ .../configBuilder/RunningConfiguration.kt | 2 +- .../general/autotune/AutotuneFragment.kt | 3 +- .../plugins/general/autotune/AutotuneIob.kt | 5 +- .../general/autotune/AutotunePlugin.kt | 4 +- .../general/autotune/data/ATProfile.kt | 6 +- .../smsCommunicator/SmsCommunicatorPlugin.kt | 7 +- .../xdripStatusline/StatusLinePlugin.kt | 3 +- .../plugins/insulin/InsulinLyumjevPlugin.kt | 2 +- .../plugins/insulin/InsulinOrefBasePlugin.kt | 2 +- .../insulin/InsulinOrefFreePeakPlugin.kt | 2 +- .../insulin/InsulinOrefRapidActingPlugin.kt | 2 +- .../InsulinOrefUltraRapidActingPlugin.kt | 2 +- .../plugins/profile/ProfileFragment.kt | 5 +- .../plugins/profile/ProfilePlugin.kt | 7 +- .../plugins/pump/virtual/VirtualPumpPlugin.kt | 6 +- .../extensions/DeviceStatusExtension.kt | 2 +- .../EffectiveProfileSwitchExtension.kt | 2 +- .../extensions/ExtendedBolusExtension.kt | 2 +- .../extensions/ProfileSwitchExtension.kt | 6 +- .../extensions/TemporaryBasalExtension.kt | 2 +- .../extensions/TemporaryTargetExtension.kt | 4 +- .../EffectiveProfileSwitchExtension.kt | 2 +- .../extensions/ProfileSwitchExtension.kt | 4 +- .../sync/tidepool/elements/BasalElement.kt | 2 +- .../tidepool/elements/BloodGlucoseElement.kt | 3 +- .../sync/tidepool/elements/ProfileElement.kt | 2 +- .../androidaps/TestBaseWithProfile.kt | 2 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../insulin/InsulinLyumjevPluginTest.kt | 2 +- .../insulin/InsulinOrefBasePluginTest.kt | 2 +- .../insulin/InsulinOrefFreePeakPluginTest.kt | 2 +- .../InsulinOrefRapidActingPluginTest.kt | 2 +- .../InsulinOrefUltraRapidActingPluginTest.kt | 2 +- .../pump/virtual/VirtualPumpPluginUTest.kt | 2 +- .../plugins/pump/combo/ComboPlugin.java | 6 +- .../plugins/pump/combo/ComboPluginTest.kt | 2 +- .../androidaps/dana/DanaFragment.kt | 2 +- .../nightscout/androidaps/dana/DanaPump.kt | 4 +- .../dana/activities/DanaHistoryActivity.kt | 3 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../danaRKorean/DanaRKoreanPlugin.kt | 6 +- .../services/DanaRKoreanExecutionService.java | 4 +- .../androidaps/danaRv2/DanaRv2Plugin.java | 4 +- .../services/DanaRv2ExecutionService.java | 6 +- .../androidaps/danar/AbstractDanaRPlugin.java | 6 +- .../androidaps/danar/DanaRPlugin.java | 4 +- .../androidaps/danar/comm/MessageBase.kt | 8 +- .../AbstractDanaRExecutionService.java | 4 +- .../danar/services/DanaRExecutionService.java | 4 +- .../androidaps/TestBaseWithProfile.kt | 2 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- .../plugins/pump/danaR/DanaRPluginTest.kt | 2 +- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 8 +- .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 2 +- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 2 +- .../androidaps/danars/DanaRSPlugin.kt | 6 +- .../comm/DanaRSPacketAPSHistoryEvents.kt | 8 +- .../comm/DanaRSPacketBolusSet24CIRCFArray.kt | 3 +- .../danars/comm/DanaRSPacketHistory.kt | 4 +- .../danars/comm/DanaRSPacketNotifyAlarm.kt | 4 +- .../androidaps/danars/services/BLEComm.kt | 10 +- .../danars/services/DanaRSService.kt | 4 +- .../androidaps/TestBaseWithProfile.kt | 4 +- .../androidaps/danars/DanaRSPluginTest.kt | 2 +- .../comm/DanaRsPacketApsHistoryEventsTest.kt | 5 +- .../DanaRsPacketBolusSetStepBolusStartTest.kt | 2 +- .../comm/DanaRsPacketNotifyAlarmTest.kt | 2 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 4 +- .../androidaps/diaconn/DiaconnG8Fragment.kt | 2 +- .../androidaps/diaconn/DiaconnG8Plugin.kt | 6 +- .../androidaps/diaconn/DiaconnG8Pump.kt | 10 +- .../packet/BigLogInquireResponsePacket.kt | 12 +- .../diaconn/service/DiaconnG8Service.kt | 4 +- .../plugins/pump/eopatch/EopatchPumpPlugin.kt | 6 +- .../pump/eopatch/alarm/AlarmManager.kt | 2 +- .../pump/eopatch/ble/PatchManager.java | 10 +- .../pump/eopatch/ble/PatchManagerImpl.java | 6 +- .../ble/task/InternalSuspendedTask.java | 4 +- .../pump/eopatch/ble/task/PauseBasalTask.java | 4 +- .../pump/eopatch/ble/task/StopBasalTask.java | 4 +- .../ui/viewmodel/EopatchOverviewViewModel.kt | 10 +- .../pump/eopatch/vo/NormalBasalManager.kt | 4 +- .../pump/medtronic/MedtronicFragment.kt | 2 +- .../pump/medtronic/MedtronicPumpPlugin.kt | 8 +- .../medtronic/data/MedtronicHistoryData.kt | 6 +- .../info/nightscout/androidaps/TestBase.kt | 2 +- .../omnipod/dash/OmnipodDashPumpPlugin.kt | 6 +- .../pump/omnipod/dash/history/data/Record.kt | 2 +- .../dash/history/database/Converters.kt | 2 +- .../action/DashInsertCannulaViewModel.kt | 2 +- .../pump/omnipod/dash/util/Functions.kt | 5 +- .../pump/omnipod/dash/util/FunctionsTest.kt | 4 +- .../omnipod/eros/OmnipodErosPumpPlugin.java | 6 +- .../eros/manager/AapsOmnipodErosManager.java | 4 +- .../eros/ui/ErosPodHistoryActivity.java | 6 +- .../omnipod/eros/OmnipodErosPumpPluginTest.kt | 4 +- .../AapsOmnipodErosManagerTest.java | 2 +- .../plugins/pump/common/PumpPluginAbstract.kt | 8 +- .../pump/common/di/PumpCommonModule.kt | 2 +- .../plugins/pump/common/sync/PumpDbEntry.kt | 2 +- .../pump/common/sync/PumpSyncStorage.kt | 2 +- .../plugins/pump/common/utils/ProfileUtil.kt | 6 +- .../TreatmentsProfileSwitchFragment.kt | 6 +- .../ui/defaultProfile/DefaultProfile.kt | 20 +- .../ui/defaultProfile/DefaultProfileDPV.kt | 6 +- .../ui/dialogs/CalibrationDialog.kt | 4 +- .../info/nightscout/ui/dialogs/CarbsDialog.kt | 3 +- .../info/nightscout/ui/dialogs/CareDialog.kt | 8 +- .../nightscout/ui/dialogs/WizardInfoDialog.kt | 4 +- .../java/info/nightscout/ui/widget/Widget.kt | 5 +- .../androidaps/TestBaseWithProfile.kt | 2 +- .../nightscout/androidaps/TestPumpPlugin.kt | 6 +- 221 files changed, 971 insertions(+), 771 deletions(-) delete mode 100644 core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt create mode 100644 core/core-main/src/main/java/info/nightscout/core/profile/ProfileExtension.kt rename core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt => implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt (76%) create mode 100644 interfaces/src/main/java/info/nightscout/interfaces/profile/Profile.kt rename {core/core-main/src/main/java/info/nightscout/androidaps/interfaces => interfaces/src/main/java/info/nightscout/interfaces/pump}/Pump.kt (96%) rename {core/core-main/src/main/java/info/nightscout/androidaps/interfaces => interfaces/src/main/java/info/nightscout/interfaces/pump}/PumpSync.kt (96%) create mode 100644 interfaces/src/main/java/info/nightscout/interfaces/utils/HardLimits.kt diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index b50279df35..be0c389c45 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -23,7 +23,6 @@ import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.diaconn.DiaconnG8Plugin import info.nightscout.androidaps.events.EventPreferenceChange -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin @@ -56,8 +55,10 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionTyp import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.CUSTOM_PIN import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.NONE import info.nightscout.automation.AutomationPlugin +import info.nightscout.core.profile.toCurrentUnits import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.general.autotune.AutotunePlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index af89d8eca5..c061af79f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -15,7 +15,6 @@ import info.nightscout.androidaps.interfaces.DataSyncSelector import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.TrendCalculator import info.nightscout.androidaps.interfaces.XDripBroadcast import info.nightscout.androidaps.interfaces.stats.DexcomTirCalculator @@ -28,7 +27,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.androidNotification.NotificationHolderImpl import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.androidaps.utils.buildHelper.ConfigImpl @@ -58,11 +56,13 @@ import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.autotune.Autotune import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.smsCommunicator.SmsCommunicator import info.nightscout.interfaces.storage.FileStorage import info.nightscout.interfaces.storage.Storage import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.IconsProvider +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.general.autotune.AutotunePlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.sync.nsclient.DataSyncSelectorImplementation 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 36e10be75a..ccb5ca7e61 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -14,7 +14,6 @@ import info.nightscout.androidaps.extensions.formatColor import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DecimalFormatter @@ -24,6 +23,7 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.extensions.toSignedString import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS +import info.nightscout.core.profile.toMgdl import info.nightscout.core.pumpExtensions.insertBolusTransaction import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action @@ -35,6 +35,7 @@ import info.nightscout.interfaces.BolusTimer import info.nightscout.interfaces.Config import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames 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 cda87b566e..76247624be 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -11,25 +11,26 @@ import android.widget.ArrayAdapter import com.google.common.base.Joiner import info.nightscout.androidaps.R import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.androidaps.databinding.DialogProfileswitchBinding import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.LTag 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 779eb8a0fe..4f3e3b6e39 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -13,7 +13,6 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog @@ -23,6 +22,7 @@ import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index 244625183b..b96fb82424 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -9,13 +9,8 @@ import android.widget.ArrayAdapter import com.google.common.base.Joiner import com.google.common.collect.Lists import info.nightscout.androidaps.R -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.ValueWrapper -import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction -import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.androidaps.databinding.DialogTemptargetBinding import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DefaultValueHelper @@ -23,12 +18,19 @@ import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS +import info.nightscout.core.profile.toCurrentUnitsString +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.ValueWrapper +import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction +import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper 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 c61990bc68..9a2bee2930 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -26,7 +26,6 @@ import info.nightscout.androidaps.extensions.valueToUnits import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.ToastUtils @@ -35,11 +34,14 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BO import info.nightscout.androidaps.utils.wizard.BolusWizard import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.iob.round +import info.nightscout.core.profile.toMgdl +import info.nightscout.core.profile.toUnitsString import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.Round import info.nightscout.rx.AapsSchedulers 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 c015aa4a30..4edc518e93 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 @@ -26,9 +26,7 @@ import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.Loop.LastRun -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui @@ -36,7 +34,6 @@ import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotifi import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.receivers.ReceiverStatusStore -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.extensions.buildDeviceStatus import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.database.entities.OfflineEvent @@ -54,10 +51,13 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.configBuilder.RunningConfiguration import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.rx.AapsSchedulers diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt index a3e2380f62..7182964b34 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback import info.nightscout.androidaps.plugins.aps.loop.APSResult @@ -18,6 +17,7 @@ import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.aps.SMBDefaults import info.nightscout.interfaces.iob.IobTotal import info.nightscout.interfaces.iob.MealData +import info.nightscout.interfaces.profile.Profile import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import info.nightscout.shared.sharedPreferences.SP 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 acfd94599e..592c2fe9ed 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 @@ -10,7 +10,6 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.aps.OpenAPSFragment import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui @@ -18,15 +17,17 @@ import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.Round import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger 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 c6b152bbc1..0fa6f92983 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 @@ -9,7 +9,6 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback import info.nightscout.androidaps.plugins.aps.loop.APSResult @@ -19,6 +18,7 @@ import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.aps.SMBDefaults import info.nightscout.interfaces.iob.IobTotal import info.nightscout.interfaces.iob.MealData +import info.nightscout.interfaces.profile.Profile import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import info.nightscout.shared.SafeParse 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 36b0777cf3..784ef4cf24 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 @@ -12,7 +12,6 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.aps.OpenAPSFragment import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui @@ -20,8 +19,8 @@ import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper import info.nightscout.interfaces.aps.SMBDefaults @@ -29,6 +28,8 @@ import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.Round import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt index 6bf251e708..007c969883 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt @@ -9,18 +9,19 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.stats.TddCalculator import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus +import info.nightscout.core.profile.toMgdl import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.aps.SMBDefaults import info.nightscout.interfaces.iob.IobTotal import info.nightscout.interfaces.iob.MealData +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt index 995ecdffca..2b58e004fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt @@ -4,23 +4,23 @@ import android.content.Context import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.database.impl.AppRepository import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.DetermineBasalAdapterInterface import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.aps.loop.ScriptReader import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider -import info.nightscout.shared.utils.DateUtil -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler +import info.nightscout.database.impl.AppRepository +import info.nightscout.interfaces.BuildHelper +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil import javax.inject.Inject import javax.inject.Singleton 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 15bb96ffa4..8f42e3e4df 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 @@ -6,8 +6,6 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.APS import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.BgSource -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui @@ -21,6 +19,8 @@ import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileSource +import info.nightscout.interfaces.pump.Pump +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.sync.NsClient import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventAppInitialized 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 eb0b3330f7..d4f05982cb 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 @@ -4,7 +4,6 @@ import info.nightscout.androidaps.interfaces.APS import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.interfaces.Config import info.nightscout.interfaces.Overview @@ -13,6 +12,7 @@ import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileSource +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.Sync import info.nightscout.rx.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt index 149e56f8c1..a09d1bb413 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt @@ -2,11 +2,9 @@ package info.nightscout.androidaps.plugins.configBuilder import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged +import info.nightscout.androidaps.extensions.fromConstant import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.extensions.fromConstant import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.main.R import info.nightscout.database.entities.ProfileSwitch @@ -16,7 +14,9 @@ import info.nightscout.database.impl.transactions.InsertOrUpdateProfileSwitch import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus 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 a742ff3ed2..771bf8c230 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt @@ -11,14 +11,12 @@ import info.nightscout.androidaps.extensions.storeString import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.utils.DecimalFormatter -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.Constraint @@ -27,7 +25,9 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpDescription +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.Round import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt index c0675bc702..d2fcb899e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt @@ -16,7 +16,6 @@ import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.insight.database.InsightDatabase import info.nightscout.androidaps.interfaces.DataSyncSelector import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity import info.nightscout.androidaps.plugins.general.overview.OverviewData @@ -30,6 +29,7 @@ import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.maintenance.ImportExportPrefs +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus 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 de3ce9b3c2..a5bbeba151 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 @@ -48,7 +48,6 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.TrendCalculator import info.nightscout.androidaps.logging.UserEntryLogger @@ -74,6 +73,9 @@ import info.nightscout.androidaps.utils.ui.UIRunnable import info.nightscout.androidaps.utils.wizard.QuickWizard import info.nightscout.automation.AutomationPlugin import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.core.profile.toSignedUnitsString +import info.nightscout.core.profile.toTargetRangeString +import info.nightscout.core.profile.toUnits import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.interfaces.end @@ -84,6 +86,7 @@ import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin 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 1917e67088..6e3e986393 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 @@ -13,17 +13,18 @@ import info.nightscout.androidaps.extensions.toStringShort import info.nightscout.androidaps.extensions.valueToUnitsString import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.iob.round +import info.nightscout.core.profile.toSignedUnitsString import info.nightscout.interfaces.Constants import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.ui.IconsProvider import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt index 24485ea475..c829b5f68d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt @@ -15,7 +15,6 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.TrendCalculator import info.nightscout.androidaps.logging.UserEntryLogger @@ -25,13 +24,15 @@ import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.services.AlarmSoundServiceHelper import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.wizard.BolusWizard import info.nightscout.androidaps.utils.wizard.QuickWizard import info.nightscout.androidaps.utils.wizard.QuickWizardEntry import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.iob.round +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toMgdl +import info.nightscout.core.profile.toTargetRangeString import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.GlucoseValue import info.nightscout.database.entities.TemporaryBasal @@ -49,8 +50,10 @@ import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus 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 d7d0efa5f2..f06afc3710 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 @@ -13,7 +13,6 @@ import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.toTemporaryBasal import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData @@ -37,6 +36,7 @@ import info.nightscout.interfaces.iob.MealData import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus 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 8992a77d47..ab6f045d3e 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 @@ -3,17 +3,18 @@ package info.nightscout.androidaps.plugins.sensitivity import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.extensions.isPSEvent5minBack import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Constants import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack import info.nightscout.plugins.utils.Percentile import info.nightscout.rx.logging.AAPSLogger 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 811c4d6128..328e89013a 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 @@ -3,18 +3,19 @@ package info.nightscout.androidaps.plugins.sensitivity import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.extensions.isPSEvent5minBack import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Constants import info.nightscout.interfaces.aps.SMBDefaults import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack import info.nightscout.plugins.utils.Percentile import info.nightscout.rx.logging.AAPSLogger 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 58b3450fd3..708fb9f59a 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 @@ -4,17 +4,18 @@ import androidx.collection.LongSparseArray import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.extensions.isPSEvent5minBack import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Constants import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag 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 0c1a7996e8..787c687a65 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 @@ -11,11 +11,11 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.extensions.fromConstant import info.nightscout.androidaps.interfaces.BgSource -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.XDripBroadcast import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.source.activities.RequestDexcomPermissionActivity import info.nightscout.androidaps.receivers.DataWorkerStorage +import info.nightscout.core.profile.unit import info.nightscout.database.entities.GlucoseValue import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.UserEntry.Action @@ -28,6 +28,7 @@ import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.source.BGSourceFragment import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag 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 bceeef2eea..cf9f5cdf83 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt @@ -5,7 +5,7 @@ import android.content.Intent import com.google.gson.Gson import dagger.android.DaggerBroadcastReceiver import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Pump +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.utils.TimeChangeType import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.BundleLogger 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 6b2c504f9b..ba39419230 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt @@ -35,7 +35,6 @@ import info.nightscout.androidaps.setupwizard.elements.SWPreference import info.nightscout.androidaps.setupwizard.elements.SWRadioButton import info.nightscout.androidaps.setupwizard.events.EventSWUpdate import info.nightscout.androidaps.utils.CryptoUtil -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.extensions.isRunningTest import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.Config @@ -43,6 +42,7 @@ import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.Constants import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.profile.ProfileFragment import info.nightscout.plugins.profile.ProfilePlugin import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt index 249617102f..70bcec7e22 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt @@ -7,12 +7,13 @@ import android.view.View import android.widget.LinearLayout import android.widget.TextView import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.setupwizard.SWNumberValidator -import info.nightscout.shared.SafeParse import info.nightscout.androidaps.utils.ui.NumberPicker +import info.nightscout.core.profile.toCurrentUnits +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import info.nightscout.shared.SafeParse import java.text.DecimalFormat import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/utils/extensions/DoubleToSignedString.kt b/app/src/main/java/info/nightscout/androidaps/utils/extensions/DoubleToSignedString.kt index bbad911a7c..1298115a00 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/extensions/DoubleToSignedString.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/extensions/DoubleToSignedString.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.utils.extensions -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.utils.DecimalFormatter +import info.nightscout.interfaces.pump.Pump fun Double.toSignedString(pump: Pump): String { val formatted = DecimalFormatter.toPumpSupportedBolus(this, pump) 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 4d2566a139..68d20dcaa9 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 @@ -13,14 +13,14 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.core.iob.round +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.OfflineEvent import info.nightscout.database.entities.TemporaryTarget @@ -34,7 +34,9 @@ import info.nightscout.interfaces.CarbTimer import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt index 5e7a90f72c..b7147cd474 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt @@ -6,14 +6,15 @@ import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.extensions.valueToUnits import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.core.iob.round +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.entities.GlucoseValue import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper.safeGetInt import info.nightscout.interfaces.utils.JsonHelper.safeGetString import info.nightscout.rx.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt index 4a9e1146dc..5a5427b0da 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt @@ -5,10 +5,7 @@ import androidx.work.Worker import androidx.work.WorkerParameters import androidx.work.workDataOf import dagger.android.HasAndroidInjector -import info.nightscout.database.impl.AppRepository -import info.nightscout.interfaces.GlucoseUnit import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface @@ -16,9 +13,12 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Gluco import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries import info.nightscout.androidaps.receivers.DataWorkerStorage import info.nightscout.androidaps.utils.DefaultValueHelper +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.database.impl.AppRepository +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import info.nightscout.shared.interfaces.ResourceHelper -import java.util.ArrayList import javax.inject.Inject class PrepareBgDataWorker( diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt index eada8b4423..1f48c5306d 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt @@ -8,17 +8,18 @@ import com.jjoe64.graphview.series.DataPoint import com.jjoe64.graphview.series.LineGraphSeries import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.ValueWrapper import info.nightscout.androidaps.extensions.target import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress import info.nightscout.androidaps.receivers.DataWorkerStorage +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.ValueWrapper +import info.nightscout.interfaces.profile.Profile import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject import kotlin.math.max diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt index ed3829557a..307dd774cb 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt @@ -5,9 +5,7 @@ import androidx.work.Worker import androidx.work.WorkerParameters import androidx.work.workDataOf import dagger.android.HasAndroidInjector -import info.nightscout.database.impl.AppRepository import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.general.overview.graphExtensions.BolusDataPoint @@ -21,9 +19,12 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa import info.nightscout.androidaps.receivers.DataWorkerStorage import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.Translator +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.TherapyEvent +import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index c02f09ecf8..7f76f71a53 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.entities.EffectiveProfileSwitch diff --git a/app/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/app/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 7829779b22..7262510558 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType 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 25181580dd..0c80960576 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -25,7 +25,6 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalSt import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.database.impl.AppRepository @@ -34,7 +33,9 @@ import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert @@ -63,6 +64,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var insightDatabaseDao: InsightDatabaseDao @Mock lateinit var ruffyScripter: RuffyScripter @Mock lateinit var buildHelper: BuildHelper + @Mock lateinit var hardLimits: HardLimits private lateinit var danaPump: DanaPump private lateinit var insightDbHelper: InsightDbHelper @@ -76,7 +78,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { private lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin private lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin private lateinit var openAPSSMBDynamicISFPlugin: OpenAPSSMBDynamicISFPlugin - private lateinit var hardLimits: HardLimits private val injector = HasAndroidInjector { AndroidInjector { @@ -131,7 +132,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { insightDbHelper = InsightDbHelper(insightDatabaseDao) danaPump = DanaPump(aapsLogger, sp, dateUtil, injector) - hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config) comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync) 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 62079d1ca3..86c9c174c8 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 @@ -4,10 +4,10 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Before import org.junit.Test 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 104488dc83..d8b4cc425e 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 @@ -11,12 +11,12 @@ import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.pump.defs.PumpDescription +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert @@ -38,8 +38,8 @@ class SafetyPluginTest : TestBaseWithProfile() { @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var glimpPlugin: GlimpPlugin @Mock lateinit var repository: AppRepository + @Mock lateinit var hardLimits: HardLimits - private lateinit var hardLimits: HardLimits private lateinit var safetyPlugin: SafetyPlugin val injector = HasAndroidInjector { AndroidInjector { } } @@ -69,11 +69,12 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) - hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository) `when`(config.APS).thenReturn(true) - safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, openAPSSMBDynamicISFPlugin, sensitivityOref1Plugin, activePlugin, - hardLimits, buildHelper, - iobCobCalculator, config, dateUtil) + safetyPlugin = SafetyPlugin( + injector, aapsLogger, rh, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, openAPSSMBDynamicISFPlugin, sensitivityOref1Plugin, activePlugin, + hardLimits, buildHelper, + iobCobCalculator, config, dateUtil + ) } @Test fun pumpDescriptionShouldLimitLoopInvocation() { @@ -135,12 +136,14 @@ class SafetyPluginTest : TestBaseWithProfile() { val c = Constraint(Constants.REALLYHIGHBASALRATE) safetyPlugin.applyBasalConstraints(c, validProfile) Assert.assertEquals(1.0, c.value(), 0.01) - Assert.assertEquals(""" + Assert.assertEquals( + """ Safety: Limiting max basal rate to 1.00 U/h because of max value in preferences Safety: Limiting max basal rate to 4.00 U/h because of max basal multiplier Safety: Limiting max basal rate to 3.00 U/h because of max daily basal multiplier Safety: Limiting max basal rate to 2.00 U/h because of hard limit - """.trimIndent(), c.getReasons(aapsLogger)) + """.trimIndent(), c.getReasons(aapsLogger) + ) Assert.assertEquals("Safety: Limiting max basal rate to 1.00 U/h because of max value in preferences", c.getMostLimitedReasons(aapsLogger)) } @@ -149,10 +152,12 @@ class SafetyPluginTest : TestBaseWithProfile() { val d = Constraint(-0.5) safetyPlugin.applyBasalConstraints(d, validProfile) Assert.assertEquals(0.0, d.value(), 0.01) - Assert.assertEquals(""" + Assert.assertEquals( + """ Safety: Limiting max basal rate to 0.00 U/h because of it must be positive value Safety: Increasing max basal value because setting is lower than your max basal in profile - """.trimIndent(), d.getReasons(aapsLogger)) + """.trimIndent(), d.getReasons(aapsLogger) + ) } @Test fun percentBasalRateShouldBeLimited() { @@ -164,7 +169,8 @@ class SafetyPluginTest : TestBaseWithProfile() { val i = Constraint(Constants.REALLYHIGHPERCENTBASALRATE) safetyPlugin.applyBasalPercentConstraints(i, validProfile) Assert.assertEquals(100, i.value()) - Assert.assertEquals(""" + Assert.assertEquals( + """ Safety: Percent rate 1111111% recalculated to 11111.11 U/h with current basal 1.00 U/h Safety: Limiting max basal rate to 1.00 U/h because of max value in preferences Safety: Limiting max basal rate to 4.00 U/h because of max basal multiplier @@ -172,7 +178,8 @@ class SafetyPluginTest : TestBaseWithProfile() { Safety: Limiting max basal rate to 2.00 U/h because of hard limit Safety: Limiting max percent rate to 100% because of pump limit Safety: Limiting max basal rate to 500.00 U/h because of pump limit - """.trimIndent(), i.getReasons(aapsLogger)) + """.trimIndent(), i.getReasons(aapsLogger) + ) Assert.assertEquals("Safety: Limiting max percent rate to 100% because of pump limit", i.getMostLimitedReasons(aapsLogger)) } @@ -181,12 +188,14 @@ class SafetyPluginTest : TestBaseWithProfile() { val i = Constraint(-22) safetyPlugin.applyBasalPercentConstraints(i, validProfile) Assert.assertEquals(0, i.value()) - Assert.assertEquals(""" + Assert.assertEquals( + """ Safety: Percent rate -22% recalculated to -0.22 U/h with current basal 1.00 U/h Safety: Limiting max basal rate to 0.00 U/h because of it must be positive value Safety: Increasing max basal value because setting is lower than your max basal in profile Safety: Limiting max percent rate to 0% because of pump limit - """.trimIndent(), i.getReasons(aapsLogger)) + """.trimIndent(), i.getReasons(aapsLogger) + ) Assert.assertEquals("Safety: Limiting max percent rate to 0% because of pump limit", i.getMostLimitedReasons(aapsLogger)) } @@ -196,10 +205,12 @@ class SafetyPluginTest : TestBaseWithProfile() { var d = Constraint(Constants.REALLYHIGHBOLUS) d = safetyPlugin.applyBolusConstraints(d) Assert.assertEquals(3.0, d.value(), 0.01) - Assert.assertEquals(""" + Assert.assertEquals( + """ Safety: Limiting bolus to 3.0 U because of max value in preferences Safety: Limiting bolus to 5.0 U because of hard limit - """.trimIndent(), d.getReasons(aapsLogger)) + """.trimIndent(), d.getReasons(aapsLogger) + ) Assert.assertEquals("Safety: Limiting bolus to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) } 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 f3482a95a3..8415a14be6 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 @@ -9,13 +9,13 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.iob.IobTotal +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.rx.bus.RxBus diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt index a391b07170..b901ae1f91 100644 --- a/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt +++ b/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt @@ -4,11 +4,8 @@ import android.widget.LinearLayout import androidx.annotation.DrawableRes import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.androidaps.extensions.friendlyDescription import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.automation.R @@ -18,12 +15,16 @@ import info.nightscout.automation.elements.InputTempTarget import info.nightscout.automation.elements.LabelWithElement import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.triggers.TriggerTempTarget +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.interfaces.utils.JsonHelper.safeGetDouble diff --git a/automation/src/main/java/info/nightscout/automation/elements/InputTime.kt b/automation/src/main/java/info/nightscout/automation/elements/InputTime.kt index 851d71b4ab..3afe0cc273 100644 --- a/automation/src/main/java/info/nightscout/automation/elements/InputTime.kt +++ b/automation/src/main/java/info/nightscout/automation/elements/InputTime.kt @@ -11,11 +11,12 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentManager import com.google.android.material.timepicker.MaterialTimePicker import com.google.android.material.timepicker.TimeFormat -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.automation.R +import info.nightscout.core.profile.secondsFromMidnight +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil -import info.nightscout.interfaces.utils.MidnightTime -import info.nightscout.automation.R import java.util.Calendar class InputTime(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() { diff --git a/automation/src/main/java/info/nightscout/automation/elements/InputTimeRange.kt b/automation/src/main/java/info/nightscout/automation/elements/InputTimeRange.kt index 016fa92a05..585f9036b1 100644 --- a/automation/src/main/java/info/nightscout/automation/elements/InputTimeRange.kt +++ b/automation/src/main/java/info/nightscout/automation/elements/InputTimeRange.kt @@ -12,11 +12,12 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentManager import com.google.android.material.timepicker.MaterialTimePicker import com.google.android.material.timepicker.TimeFormat -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.automation.R +import info.nightscout.core.profile.secondsFromMidnight +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil -import info.nightscout.interfaces.utils.MidnightTime -import info.nightscout.automation.R import java.util.Calendar class InputTimeRange(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() { diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerBg.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerBg.kt index 6b18739c2e..dc56e2c18b 100644 --- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerBg.kt +++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerBg.kt @@ -3,18 +3,18 @@ package info.nightscout.automation.triggers import android.widget.LinearLayout import com.google.common.base.Optional import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.Constants -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator import info.nightscout.automation.elements.InputBg import info.nightscout.automation.elements.LabelWithElement import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.elements.StaticLabel +import info.nightscout.core.profile.toMgdl +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.rx.logging.LTag - import org.json.JSONObject class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) { diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerDelta.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerDelta.kt index 9b3ab2402e..f7d75769f6 100644 --- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerDelta.kt +++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerDelta.kt @@ -3,10 +3,6 @@ package info.nightscout.automation.triggers import android.widget.LinearLayout import com.google.common.base.Optional import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.Constants -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator import info.nightscout.automation.elements.InputDelta @@ -14,8 +10,12 @@ import info.nightscout.automation.elements.InputDelta.DeltaType import info.nightscout.automation.elements.LabelWithElement import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.elements.StaticLabel +import info.nightscout.core.profile.toMgdl +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.rx.logging.LTag - import org.json.JSONObject import java.text.DecimalFormat diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerRecurringTime.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerRecurringTime.kt index 97206e1b9a..170598ec8a 100644 --- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerRecurringTime.kt +++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerRecurringTime.kt @@ -3,16 +3,16 @@ package info.nightscout.automation.triggers import android.widget.LinearLayout import com.google.common.base.Optional import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.utils.JsonHelper -import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.automation.R import info.nightscout.automation.elements.InputTime import info.nightscout.automation.elements.InputWeekDay import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.elements.StaticLabel +import info.nightscout.core.profile.secondsFromMidnight +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.JsonHelper +import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.rx.logging.LTag - import org.json.JSONObject import java.util.Calendar import java.util.Objects diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt index de161f96ab..9459564f2e 100644 --- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt +++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt @@ -3,19 +3,19 @@ package info.nightscout.automation.triggers import android.widget.LinearLayout import com.google.common.base.Optional import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.Constants -import info.nightscout.database.impl.ValueWrapper -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator import info.nightscout.automation.elements.InputBg import info.nightscout.automation.elements.LabelWithElement import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.elements.StaticLabel +import info.nightscout.core.profile.toMgdl +import info.nightscout.database.impl.ValueWrapper +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.rx.logging.LTag - import org.json.JSONObject class TriggerTempTargetValue(injector: HasAndroidInjector) : Trigger(injector) { diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTimeRange.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTimeRange.kt index 92506c3ce1..d8638df250 100644 --- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTimeRange.kt +++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTimeRange.kt @@ -3,15 +3,15 @@ package info.nightscout.automation.triggers import android.widget.LinearLayout import com.google.common.base.Optional import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.utils.JsonHelper.safeGetInt -import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.automation.R import info.nightscout.automation.elements.InputTimeRange import info.nightscout.automation.elements.LayoutBuilder import info.nightscout.automation.elements.StaticLabel +import info.nightscout.core.profile.secondsFromMidnight +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.JsonHelper.safeGetInt +import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.rx.logging.LTag - import org.json.JSONObject // Trigger for time range ( from 10:00AM till 13:00PM ) diff --git a/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 5f625e2741..e6428b4bee 100644 --- a/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -3,15 +3,15 @@ package info.nightscout.androidaps import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Config +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper diff --git a/automation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/automation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 8b70132d3f..f906d1b5ff 100644 --- a/automation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/automation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,13 +2,13 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt index 1900ec73bd..dee897a5ad 100644 --- a/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt +++ b/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.automation.triggers.Trigger import info.nightscout.database.entities.OfflineEvent @@ -17,6 +16,7 @@ import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileSource import info.nightscout.interfaces.smsCommunicator.SmsCommunicator import info.nightscout.rx.logging.AAPSLogger diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt index 1e0e2f4d11..1701cb47db 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt @@ -6,14 +6,10 @@ import info.nightscout.androidaps.extensions.lowTargetBlockValueBySeconds import info.nightscout.androidaps.extensions.shiftBlock import info.nightscout.androidaps.extensions.shiftTargetBlock import info.nightscout.androidaps.extensions.targetBlockValueBySeconds -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight -import info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl -import info.nightscout.androidaps.interfaces.Profile.ProfileValue -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.core.main.R +import info.nightscout.core.profile.secondsFromMidnight +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.EffectiveProfileSwitch import info.nightscout.database.entities.ProfileSwitch import info.nightscout.database.entities.data.Block @@ -23,7 +19,11 @@ import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.interfaces.Config import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.profile.Profile.ProfileValue import info.nightscout.interfaces.profile.PureProfile +import info.nightscout.interfaces.pump.Pump +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil @@ -161,14 +161,14 @@ sealed class ProfileSealed( break } for (isf in isfBlocks) - if (!hardLimits.isInRange(toMgdl(isf.amount * 100.0 / percentage, units), HardLimits.MIN_ISF, HardLimits.MAX_ISF)) { + if (!hardLimits.isInRange(Profile.toMgdl(isf.amount * 100.0 / percentage, units), HardLimits.MIN_ISF, HardLimits.MAX_ISF)) { validityCheck.isValid = false validityCheck.reasons.add(rh.gs(R.string.value_out_of_hard_limits, rh.gs(R.string.profile_sensitivity_value), isf.amount * 100.0 / percentage)) break } for (target in targetBlocks) { if (!hardLimits.isInRange( - toMgdl(target.lowTarget, units), + Profile.toMgdl(target.lowTarget, units), HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1] ) @@ -178,7 +178,7 @@ sealed class ProfileSealed( break } if (!hardLimits.isInRange( - toMgdl(target.highTarget, units), + Profile.toMgdl(target.highTarget, units), HardLimits.VERY_HARD_LIMIT_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_MAX_BG[1] ) @@ -214,11 +214,11 @@ sealed class ProfileSealed( override fun isEqual(profile: Profile): Boolean { for (hour in 0..23) { val seconds = T.hours(hour.toLong()).secs().toInt() - if (getBasalTimeFromMidnight(seconds) != profile.getBasalTimeFromMidnight(seconds)) return false - if (getIsfMgdlTimeFromMidnight(seconds) != profile.getIsfMgdlTimeFromMidnight(seconds)) return false - if (getIcTimeFromMidnight(seconds) != profile.getIcTimeFromMidnight(seconds)) return false - if (getTargetLowMgdlTimeFromMidnight(seconds) != profile.getTargetLowMgdlTimeFromMidnight(seconds)) return false - if (getTargetHighMgdlTimeFromMidnight(seconds) != profile.getTargetHighMgdlTimeFromMidnight(seconds)) return false + if (getBasalTimeFromMidnight(seconds) != profile.getBasalTimeFromMidnight(seconds)) return false + if (getIsfMgdlTimeFromMidnight(seconds) != profile.getIsfMgdlTimeFromMidnight(seconds)) return false + if (getIcTimeFromMidnight(seconds) != profile.getIcTimeFromMidnight(seconds)) return false + if (getTargetLowMgdlTimeFromMidnight(seconds) != profile.getTargetLowMgdlTimeFromMidnight(seconds)) return false + if (getTargetHighMgdlTimeFromMidnight(seconds) != profile.getTargetHighMgdlTimeFromMidnight(seconds)) return false } if (dia != profile.dia) return false if ((profile is EPS) && profileName != profile.value.originalProfileName) return false // handle profile name change too @@ -228,29 +228,33 @@ sealed class ProfileSealed( override val percentage: Int get() = pct - override fun getBasal(): Double = basalBlocks.blockValueBySeconds(secondsFromMidnight(), percentage / 100.0, timeshift) - override fun getBasal(timestamp: Long): Double = basalBlocks.blockValueBySeconds(secondsFromMidnight(timestamp), percentage / 100.0, timeshift) - override fun getIc(): Double = icBlocks.blockValueBySeconds(secondsFromMidnight(), 100.0 / percentage, timeshift) - override fun getIc(timestamp: Long): Double = icBlocks.blockValueBySeconds(secondsFromMidnight(timestamp), 100.0 / percentage, timeshift) - override fun getIsfMgdl(): Double = toMgdl(isfBlocks.blockValueBySeconds(secondsFromMidnight(), 100.0 / percentage, timeshift), units) - override fun getIsfMgdl(timestamp: Long): Double = toMgdl(isfBlocks.blockValueBySeconds(secondsFromMidnight(timestamp), 100.0 / percentage, timeshift), units) - override fun getTargetMgdl(): Double = toMgdl(targetBlocks.targetBlockValueBySeconds(secondsFromMidnight(), timeshift), units) - override fun getTargetLowMgdl(): Double = toMgdl(targetBlocks.lowTargetBlockValueBySeconds(secondsFromMidnight(), timeshift), units) - override fun getTargetLowMgdl(timestamp: Long): Double = toMgdl(targetBlocks.lowTargetBlockValueBySeconds(secondsFromMidnight(timestamp), timeshift), units) - override fun getTargetHighMgdl(): Double = toMgdl(targetBlocks.highTargetBlockValueBySeconds(secondsFromMidnight(), timeshift), units) - override fun getTargetHighMgdl(timestamp: Long): Double = toMgdl(targetBlocks.highTargetBlockValueBySeconds(secondsFromMidnight(timestamp), timeshift), units) + override fun getBasal(): Double = basalBlocks.blockValueBySeconds(Profile.secondsFromMidnight(), percentage / 100.0, timeshift) + override fun getBasal(timestamp: Long): Double = basalBlocks.blockValueBySeconds(Profile.secondsFromMidnight(timestamp), percentage / 100.0, timeshift) + override fun getIc(): Double = icBlocks.blockValueBySeconds(Profile.secondsFromMidnight(), 100.0 / percentage, timeshift) + override fun getIc(timestamp: Long): Double = icBlocks.blockValueBySeconds(Profile.secondsFromMidnight(timestamp), 100.0 / percentage, timeshift) + override fun getIsfMgdl(): Double = Profile.toMgdl(isfBlocks.blockValueBySeconds(Profile.secondsFromMidnight(), 100.0 / percentage, timeshift), units) + override fun getIsfMgdl(timestamp: Long): Double = Profile.toMgdl(isfBlocks.blockValueBySeconds(Profile.secondsFromMidnight(timestamp), 100.0 / percentage, timeshift), units) + override fun getTargetMgdl(): Double = Profile.toMgdl(targetBlocks.targetBlockValueBySeconds(Profile.secondsFromMidnight(), timeshift), units) + override fun getTargetLowMgdl(): Double = Profile.toMgdl(targetBlocks.lowTargetBlockValueBySeconds(Profile.secondsFromMidnight(), timeshift), units) + override fun getTargetLowMgdl(timestamp: Long): Double = Profile.toMgdl(targetBlocks.lowTargetBlockValueBySeconds(Profile.secondsFromMidnight(timestamp), timeshift), units) + override fun getTargetHighMgdl(): Double = Profile.toMgdl(targetBlocks.highTargetBlockValueBySeconds(Profile.secondsFromMidnight(), timeshift), units) + override fun getTargetHighMgdl(timestamp: Long): Double = Profile.toMgdl(targetBlocks.highTargetBlockValueBySeconds(Profile.secondsFromMidnight(timestamp), timeshift), units) override fun getBasalTimeFromMidnight(timeAsSeconds: Int): Double = basalBlocks.blockValueBySeconds(timeAsSeconds, percentage / 100.0, timeshift) override fun getIcTimeFromMidnight(timeAsSeconds: Int): Double = icBlocks.blockValueBySeconds(timeAsSeconds, 100.0 / percentage, timeshift) fun getIsfTimeFromMidnight(timeAsSeconds: Int): Double = isfBlocks.blockValueBySeconds(timeAsSeconds, 100.0 / percentage, timeshift) - override fun getIsfMgdlTimeFromMidnight(timeAsSeconds: Int): Double = toMgdl(isfBlocks.blockValueBySeconds(timeAsSeconds, 100.0 / percentage, timeshift), units) - override fun getTargetLowMgdlTimeFromMidnight(timeAsSeconds: Int): Double = toMgdl(targetBlocks.lowTargetBlockValueBySeconds(timeAsSeconds, timeshift), units) + override fun getIsfMgdlTimeFromMidnight(timeAsSeconds: Int): Double = Profile.toMgdl(isfBlocks.blockValueBySeconds(timeAsSeconds, 100.0 / percentage, timeshift), units) + override fun getTargetLowMgdlTimeFromMidnight(timeAsSeconds: Int): Double = Profile.toMgdl(targetBlocks.lowTargetBlockValueBySeconds(timeAsSeconds, timeshift), units) private fun getTargetLowTimeFromMidnight(timeAsSeconds: Int): Double = targetBlocks.lowTargetBlockValueBySeconds(timeAsSeconds, timeshift) private fun getTargetHighTimeFromMidnight(timeAsSeconds: Int): Double = targetBlocks.highTargetBlockValueBySeconds(timeAsSeconds, timeshift) - override fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double = toMgdl(targetBlocks.highTargetBlockValueBySeconds(timeAsSeconds, timeshift), units) + override fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double = Profile.toMgdl(targetBlocks.highTargetBlockValueBySeconds(timeAsSeconds, timeshift), units) override fun getIcList(rh: ResourceHelper, dateUtil: DateUtil): String = getValuesList(icBlocks, 100.0 / percentage, DecimalFormat("0.0"), rh.gs(R.string.profile_carbs_per_unit), dateUtil) - override fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String = getValuesList(isfBlocks, 100.0 / percentage, DecimalFormat("0.0"), units.asText + rh.gs(R.string.profile_per_unit), dateUtil) - override fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String = getValuesList(basalBlocks, percentage / 100.0, DecimalFormat("0.00"), rh.gs(R.string.profile_ins_units_per_hour), dateUtil) + override fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String = + getValuesList(isfBlocks, 100.0 / percentage, DecimalFormat("0.0"), units.asText + rh.gs(R.string.profile_per_unit), dateUtil) + + override fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String = + getValuesList(basalBlocks, percentage / 100.0, DecimalFormat("0.00"), rh.gs(R.string.profile_ins_units_per_hour), dateUtil) + override fun getTargetList(rh: ResourceHelper, dateUtil: DateUtil): String = getTargetValuesList(targetBlocks, DecimalFormat("0.0"), units.asText, dateUtil) override fun convertToNonCustomizedProfile(dateUtil: DateUtil): PureProfile = @@ -278,10 +282,11 @@ sealed class ProfileSealed( val sens = JSONArray() var elapsedHours = 0L isfBlocks.forEach { - sens.put(JSONObject() - .put("time", DecimalFormat("00").format(elapsedHours) + ":00") - .put("timeAsSeconds", T.hours(elapsedHours).secs()) - .put("value", getIsfTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) + sens.put( + JSONObject() + .put("time", DecimalFormat("00").format(elapsedHours) + ":00") + .put("timeAsSeconds", T.hours(elapsedHours).secs()) + .put("value", getIsfTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) ) elapsedHours += T.msecs(it.duration).hours() } @@ -289,10 +294,11 @@ sealed class ProfileSealed( val carbratio = JSONArray() elapsedHours = 0L icBlocks.forEach { - carbratio.put(JSONObject() - .put("time", DecimalFormat("00").format(elapsedHours) + ":00") - .put("timeAsSeconds", T.hours(elapsedHours).secs()) - .put("value", getIcTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) + carbratio.put( + JSONObject() + .put("time", DecimalFormat("00").format(elapsedHours) + ":00") + .put("timeAsSeconds", T.hours(elapsedHours).secs()) + .put("value", getIcTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) ) elapsedHours += T.msecs(it.duration).hours() } @@ -300,10 +306,11 @@ sealed class ProfileSealed( val basal = JSONArray() elapsedHours = 0L basalBlocks.forEach { - basal.put(JSONObject() - .put("time", DecimalFormat("00").format(elapsedHours) + ":00") - .put("timeAsSeconds", T.hours(elapsedHours).secs()) - .put("value", getBasalTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) + basal.put( + JSONObject() + .put("time", DecimalFormat("00").format(elapsedHours) + ":00") + .put("timeAsSeconds", T.hours(elapsedHours).secs()) + .put("value", getBasalTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) ) elapsedHours += T.msecs(it.duration).hours() } @@ -312,15 +319,17 @@ sealed class ProfileSealed( val targetHigh = JSONArray() elapsedHours = 0L targetBlocks.forEach { - targetLow.put(JSONObject() - .put("time", DecimalFormat("00").format(elapsedHours) + ":00") - .put("timeAsSeconds", T.hours(elapsedHours).secs()) - .put("value", getTargetLowTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) + targetLow.put( + JSONObject() + .put("time", DecimalFormat("00").format(elapsedHours) + ":00") + .put("timeAsSeconds", T.hours(elapsedHours).secs()) + .put("value", getTargetLowTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) ) - targetHigh.put(JSONObject() - .put("time", DecimalFormat("00").format(elapsedHours) + ":00") - .put("timeAsSeconds", T.hours(elapsedHours).secs()) - .put("value", getTargetHighTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) + targetHigh.put( + JSONObject() + .put("time", DecimalFormat("00").format(elapsedHours) + ":00") + .put("timeAsSeconds", T.hours(elapsedHours).secs()) + .put("value", getTargetHighTimeFromMidnight(T.hours(elapsedHours).secs().toInt())) ) elapsedHours += T.msecs(it.duration).hours() } @@ -351,7 +360,7 @@ sealed class ProfileSealed( val ret = Array(shifted.size) { ProfileValue(0, 0.0) } var elapsed = 0 for (index in shifted.indices) { - ret[index] = ProfileValue(elapsed, toMgdl(shifted[index].amount, units)) + ret[index] = ProfileValue(elapsed, Profile.toMgdl(shifted[index].amount, units)) elapsed += T.msecs(shifted[index].duration).secs().toInt() } return ret diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt index b4f4ea79b1..4d41ee73af 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt @@ -9,24 +9,26 @@ import android.view.Window import android.view.WindowManager import dagger.android.HasAndroidInjector import dagger.android.support.DaggerDialogFragment +import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.getCustomizedName +import info.nightscout.androidaps.extensions.pureProfileFromJson +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.core.main.R import info.nightscout.core.main.databinding.DialogProfileviewerBinding -import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toUnitsString import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper -import info.nightscout.shared.extensions.toVisibility -import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.shared.utils.DateUtil -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.extensions.getCustomizedName -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.extensions.toVisibility +import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.utils.DateUtil import org.json.JSONObject import java.text.DecimalFormat import javax.inject.Inject diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt index 3703192377..2c3949aa3e 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt @@ -2,9 +2,10 @@ package info.nightscout.androidaps.extensions import com.google.gson.Gson import com.google.gson.JsonSyntaxException -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.database.entities.BolusCalculatorResult +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt index a1582d04ae..eefc4c13e9 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt @@ -1,14 +1,14 @@ package info.nightscout.androidaps.extensions -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal +import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.TemporaryBasal import info.nightscout.database.entities.interfaces.end import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.iob.IobTotal +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import kotlin.math.ceil @@ -24,13 +24,13 @@ val ExtendedBolus.plannedRemainingMinutes: Int get() = max(round((end - System.currentTimeMillis()) / 1000.0 / 60).toInt(), 0) fun ExtendedBolus.toStringFull(dateUtil: DateUtil): String = - "E " + to2Decimal(rate) + "U/h @" + dateUtil.timeString(timestamp) + + "E " + DecimalFormatter.to2Decimal(rate) + "U/h @" + dateUtil.timeString(timestamp) + " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + T.msecs(duration).mins() + "min" fun ExtendedBolus.toStringMedium(dateUtil: DateUtil): String = - to2Decimal(rate) + "U/h " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + T.msecs(duration).mins() + "'" + DecimalFormatter.to2Decimal(rate) + "U/h " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + T.msecs(duration).mins() + "'" -fun ExtendedBolus.toStringTotal(): String = "${to2Decimal(amount)}U ( ${to2Decimal(rate)} U/h )" +fun ExtendedBolus.toStringTotal(): String = "${DecimalFormatter.to2Decimal(amount)}U ( ${DecimalFormatter.to2Decimal(rate)} U/h )" fun ExtendedBolus.getPassedDurationToTimeInMinutes(time: Long): Int = ((min(time, end) - timestamp) / 60.0 / 1000).roundToInt() diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt index 97f62fa922..ec7e2d2bc2 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.extensions + import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.database.entities.GlucoseValue import info.nightscout.interfaces.Constants diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt index 33f9243544..15f8dc1969 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt @@ -1,9 +1,7 @@ -package info.nightscout.androidaps.utils.extensions +package info.nightscout.androidaps.extensions import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.extensions.blockFromJsonArray -import info.nightscout.androidaps.extensions.targetBlockFromJsonArray -import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal +import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.database.entities.ProfileSwitch import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit @@ -29,7 +27,7 @@ fun List.isPSEvent5minBack(time: Long): Boolean { fun ProfileSwitch.getCustomizedName(): String { var name: String = profileName if (Constants.LOCAL_PROFILE == name) { - name = to2Decimal(ProfileSealed.PS(this).percentageBasalSum()) + "U " + name = DecimalFormatter.to2Decimal(ProfileSealed.PS(this).percentageBasalSum()) + "U " } if (timeshift != 0L || percentage != 100) { name += "($percentage%" diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt index a8b4e56c16..125839b5af 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt @@ -1,14 +1,13 @@ package info.nightscout.androidaps.extensions -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult -import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal -import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal +import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.TemporaryBasal import info.nightscout.database.entities.interfaces.end import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.iob.IobTotal +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import kotlin.math.ceil @@ -38,13 +37,13 @@ val TemporaryBasal.durationInMinutes fun TemporaryBasal.toStringFull(profile: Profile, dateUtil: DateUtil): String { return when { type == TemporaryBasal.Type.FAKE_EXTENDED -> { - to2Decimal(rate) + "U/h (" + to2Decimal(netExtendedRate(profile)) + "E) @" + + DecimalFormatter.to2Decimal(rate) + "U/h (" + DecimalFormatter.to2Decimal(netExtendedRate(profile)) + "E) @" + dateUtil.timeString(timestamp) + " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'" } isAbsolute -> { - to2Decimal(rate) + "U/h @" + + DecimalFormatter.to2Decimal(rate) + "U/h @" + dateUtil.timeString(timestamp) + " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'" } @@ -58,8 +57,8 @@ fun TemporaryBasal.toStringFull(profile: Profile, dateUtil: DateUtil): String { } fun TemporaryBasal.toStringShort(): String = - if (isAbsolute || type == TemporaryBasal.Type.FAKE_EXTENDED) to2Decimal(rate) + "U/h" - else "${to0Decimal(rate)}%" + if (isAbsolute || type == TemporaryBasal.Type.FAKE_EXTENDED) DecimalFormatter.to2Decimal(rate) + "U/h" + else "${DecimalFormatter.to0Decimal(rate)}%" fun TemporaryBasal.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal { val result = IobTotal(time) diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt index 0ff7e6cdd8..0bc5b8d78e 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt @@ -1,11 +1,12 @@ package info.nightscout.androidaps.extensions -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.core.main.R +import info.nightscout.core.profile.toTargetRangeString import info.nightscout.database.entities.TemporaryTarget import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import java.util.concurrent.TimeUnit diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt index ab17476e41..04b2f35a7e 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ActivePlugin.kt @@ -6,6 +6,7 @@ import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileSource +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.Sync diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt index 20cf7988e3..c9a1060d4a 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt @@ -1,9 +1,11 @@ package info.nightscout.androidaps.interfaces import android.text.Spanned -import info.nightscout.interfaces.pump.DetailedBolusInfo -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CustomCommand interface CommandQueue { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt index ea0a4a1394..deddfeda8e 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile /** * Constraints interface diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DetermineBasalAdapterInterface.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DetermineBasalAdapterInterface.kt index c9038b209c..3a65caa9a7 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DetermineBasalAdapterInterface.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DetermineBasalAdapterInterface.kt @@ -4,6 +4,7 @@ import info.nightscout.androidaps.plugins.aps.loop.APSResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.interfaces.iob.IobTotal import info.nightscout.interfaces.iob.MealData +import info.nightscout.interfaces.profile.Profile interface DetermineBasalAdapterInterface { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt index 0d9a3d41bc..558118c85b 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt @@ -9,6 +9,7 @@ import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.TemporaryBasal import info.nightscout.interfaces.iob.IobTotal import info.nightscout.interfaces.iob.MealData +import info.nightscout.interfaces.profile.Profile import org.json.JSONArray interface IobCobCalculator { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt index 9e39f10357..94cd92b9b5 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.plugins.aps.loop.APSResult import info.nightscout.database.entities.OfflineEvent import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.PumpEnactResult interface Loop { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt deleted file mode 100644 index 8435ac7026..0000000000 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt +++ /dev/null @@ -1,212 +0,0 @@ -package info.nightscout.androidaps.interfaces - -import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal -import info.nightscout.androidaps.utils.DecimalFormatter.to1Decimal -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.interfaces.Config -import info.nightscout.interfaces.Constants -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.interfaces.profile.PureProfile -import info.nightscout.interfaces.utils.Round -import info.nightscout.rx.bus.RxBus -import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.shared.utils.DateUtil -import org.joda.time.DateTime -import org.json.JSONObject - -interface Profile { - - class ValidityCheck(var isValid: Boolean = true, val reasons: ArrayList = arrayListOf()) - - fun isValid(from: String, pump: Pump, config: Config, rh: ResourceHelper, rxBus: RxBus, hardLimits: HardLimits, sendNotifications: Boolean): ValidityCheck - - /** - * Units used for ISF & target - */ - val units: GlucoseUnit - - //@Deprecated("Replace in favor of accessing InsulinProfile") - val dia: Double - - val percentage: Int - - /** - * Timeshift modifier of base profile in hours - */ - val timeshift: Int - - /** - * is equal to another profile? - */ - fun isEqual(profile: Profile): Boolean - - /** - * Basal value according to "now" - */ - fun getBasal(): Double - - /** - * Basal value according to timestamp - */ - fun getBasal(timestamp: Long): Double - - /** - * I:C value according to "now" - */ - fun getIc(): Double - - /** - * I:C value according to timestamp - */ - fun getIc(timestamp: Long): Double - - /** - * ISF value according to "now"" in MGDL - */ - fun getIsfMgdl(): Double - - /** - * ISF value according to timestamp in MGDL - */ - fun getIsfMgdl(timestamp: Long): Double - - /** - * Average target value according to "now" in MGDL - */ - fun getTargetMgdl(): Double - fun getTargetLowMgdl(): Double - fun getTargetLowMgdl(timestamp: Long): Double - fun getTargetHighMgdl(): Double - fun getTargetHighMgdl(timestamp: Long): Double - - /** - * Basal value according to elapsed seconds from midnight - */ - fun getBasalTimeFromMidnight(timeAsSeconds: Int): Double - - /** - * I:C value according to elapsed seconds from midnight - */ - fun getIcTimeFromMidnight(timeAsSeconds: Int): Double - - /** - * ISF value according to elapsed seconds from midnight - */ - fun getIsfMgdlTimeFromMidnight(timeAsSeconds: Int): Double - - /** - * Low target value according to elapsed seconds from midnight - */ - fun getTargetLowMgdlTimeFromMidnight(timeAsSeconds: Int): Double - - /** - * High target value according to elapsed seconds from midnight in MGDL - */ - fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double - - fun getIcList(rh: ResourceHelper, dateUtil: DateUtil): String - fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String - fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String - fun getTargetList(rh: ResourceHelper, dateUtil: DateUtil): String - - fun convertToNonCustomizedProfile(dateUtil: DateUtil): PureProfile - fun toPureNsJson(dateUtil: DateUtil): JSONObject - fun getMaxDailyBasal(): Double - fun baseBasalSum(): Double - fun percentageBasalSum(): Double - - fun getBasalValues(): Array - fun getIcsValues(): Array - fun getIsfsMgdlValues(): Array - fun getSingleTargetsMgdl(): Array - - open class ProfileValue(var timeAsSeconds: Int, var value: Double) { - - override fun equals(other: Any?): Boolean { - if (other !is ProfileValue) { - return false - } - return timeAsSeconds == other.timeAsSeconds && Round.isSame(value, other.value) - } - - override fun hashCode(): Int { - var result = timeAsSeconds - result = 31 * result + value.hashCode() - return result - } - } - - companion object { - - /* - * Midnight time conversion - */ - fun secondsFromMidnight(): Int { - val passed = DateTime().millisOfDay.toLong() - return (passed / 1000).toInt() - } - - fun secondsFromMidnight(date: Long): Int { - val passed = DateTime(date).millisOfDay.toLong() - return (passed / 1000).toInt() - } - - fun milliSecFromMidnight(date: Long): Long { - return DateTime(date).millisOfDay.toLong() - } - /* - * Units conversion - */ - - fun fromMgdlToUnits(value: Double, units: GlucoseUnit): Double = - if (units == GlucoseUnit.MGDL) value else value * Constants.MGDL_TO_MMOLL - - fun fromMmolToUnits(value: Double, units: GlucoseUnit): Double = - if (units == GlucoseUnit.MMOL) value else value * Constants.MMOLL_TO_MGDL - - fun toUnits(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): Double = - if (units == GlucoseUnit.MGDL) valueInMgdl else valueInMmol - - fun toUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String = - if (units == GlucoseUnit.MGDL) to0Decimal(valueInMgdl) else to1Decimal(valueInMmol) - - fun toSignedUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String = - if (units == GlucoseUnit.MGDL) (if (valueInMgdl > 0) "+" else "") + to0Decimal(valueInMgdl) - else (if (valueInMmol > 0) "+" else "") + to1Decimal(valueInMmol) - - fun isMgdl(anyBg: Double) = anyBg >= 39 - fun isMmol(anyBg: Double) = anyBg < 39 - fun unit(anyBg: Double) = if (isMgdl(anyBg)) GlucoseUnit.MGDL else GlucoseUnit.MMOL - - fun toCurrentUnits(profileFunction: ProfileFunction, anyBg: Double): Double = - if (isMmol(anyBg)) fromMmolToUnits(anyBg, profileFunction.getUnits()) - else fromMgdlToUnits(anyBg, profileFunction.getUnits()) - - fun toCurrentUnits(units: GlucoseUnit, anyBg: Double): Double = - if (isMmol(anyBg)) fromMmolToUnits(anyBg, units) - else fromMgdlToUnits(anyBg, units) - - fun toCurrentUnitsString(profileFunction: ProfileFunction, anyBg: Double): String = - if (isMmol(anyBg)) toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits()) - else toUnitsString(anyBg, anyBg * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()) - - fun toMgdl(value: Double): Double = - if (isMgdl(value)) value else value * Constants.MMOLL_TO_MGDL - - fun toMgdl(value: Double, units: GlucoseUnit): Double = - if (units == GlucoseUnit.MGDL) value else value * Constants.MMOLL_TO_MGDL - - fun toMmol(value: Double, units: GlucoseUnit): Double = - if (units == GlucoseUnit.MGDL) value * Constants.MGDL_TO_MMOLL else value - - // targets are stored in mg/dl but profile vary - fun toTargetRangeString(low: Double, high: Double, sourceUnits: GlucoseUnit, units: GlucoseUnit): String { - val lowMgdl = toMgdl(low, sourceUnits) - val highMgdl = toMgdl(high, sourceUnits) - val lowMmol = toMmol(low, sourceUnits) - val highMmol = toMmol(high, sourceUnits) - return if (low == high) toUnitsString(lowMgdl, lowMmol, units) else toUnitsString(lowMgdl, lowMmol, units) + " - " + toUnitsString(highMgdl, highMmol, units) - } - - } -} \ No newline at end of file diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt index 29d7dbef52..49eac5acaf 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.database.entities.ProfileSwitch import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore interface ProfileFunction { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt index a5cef52fcd..4c96f1fd2f 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt @@ -1,13 +1,14 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions import android.content.Context -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.core.main.R +import info.nightscout.core.profile.toCurrentUnitsString import info.nightscout.database.entities.GlucoseValue import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.interfaces.ResourceHelper class GlucoseValueDataPoint( diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt index 916cf8c9fb..dbd2e31de6 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt @@ -1,12 +1,14 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions import android.content.Context -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.Translator import info.nightscout.core.main.R +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toUnits import info.nightscout.database.entities.TherapyEvent import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.interfaces.ResourceHelper class TherapyEventDataPoint( diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt index 3d38653bf9..45f9561110 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt @@ -1,10 +1,10 @@ package info.nightscout.androidaps.plugins.pump.common.bolusInfo import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.utils.T +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag +import info.nightscout.shared.utils.T import javax.inject.Inject import javax.inject.Singleton import kotlin.math.abs diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/DecimalFormatter.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/DecimalFormatter.kt index 811888d85e..438e55f274 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/DecimalFormatter.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/DecimalFormatter.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.utils import info.nightscout.core.main.R -import info.nightscout.androidaps.interfaces.Pump +import info.nightscout.interfaces.pump.Pump import info.nightscout.shared.interfaces.ResourceHelper import java.text.DecimalFormat diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt index b346feaffc..13b9922535 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt @@ -1,11 +1,12 @@ package info.nightscout.androidaps.utils -import info.nightscout.interfaces.Constants import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.core.main.R -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.core.main.R +import info.nightscout.core.profile.toCurrentUnits +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject import javax.inject.Singleton diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt index 16bbc77974..44ebd8a998 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt @@ -7,10 +7,37 @@ import android.text.TextWatcher import android.widget.EditText import com.google.android.material.textfield.TextInputLayout import dagger.android.HasAndroidInjector -import info.nightscout.core.main.R -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.textValidator.validators.* +import info.nightscout.androidaps.utils.textValidator.validators.AlphaNumericValidator +import info.nightscout.androidaps.utils.textValidator.validators.AlphaValidator +import info.nightscout.androidaps.utils.textValidator.validators.AndValidator +import info.nightscout.androidaps.utils.textValidator.validators.BgRangeValidator +import info.nightscout.androidaps.utils.textValidator.validators.CreditCardValidator +import info.nightscout.androidaps.utils.textValidator.validators.DateValidator +import info.nightscout.androidaps.utils.textValidator.validators.DomainValidator +import info.nightscout.androidaps.utils.textValidator.validators.DummyValidator +import info.nightscout.androidaps.utils.textValidator.validators.EmailValidator +import info.nightscout.androidaps.utils.textValidator.validators.EmptyValidator +import info.nightscout.androidaps.utils.textValidator.validators.FloatNumericRangeValidator +import info.nightscout.androidaps.utils.textValidator.validators.HttpsUrlValidator +import info.nightscout.androidaps.utils.textValidator.validators.IpAddressValidator +import info.nightscout.androidaps.utils.textValidator.validators.MinDigitLengthValidator +import info.nightscout.androidaps.utils.textValidator.validators.MultiPhoneValidator +import info.nightscout.androidaps.utils.textValidator.validators.MultiValidator +import info.nightscout.androidaps.utils.textValidator.validators.NotValidator +import info.nightscout.androidaps.utils.textValidator.validators.NumericRangeValidator +import info.nightscout.androidaps.utils.textValidator.validators.NumericValidator +import info.nightscout.androidaps.utils.textValidator.validators.OrValidator +import info.nightscout.androidaps.utils.textValidator.validators.PersonFullNameValidator +import info.nightscout.androidaps.utils.textValidator.validators.PersonNameValidator +import info.nightscout.androidaps.utils.textValidator.validators.PhoneValidator +import info.nightscout.androidaps.utils.textValidator.validators.PinStrengthValidator +import info.nightscout.androidaps.utils.textValidator.validators.RegexpValidator +import info.nightscout.androidaps.utils.textValidator.validators.Validator +import info.nightscout.androidaps.utils.textValidator.validators.WebUrlValidator +import info.nightscout.core.main.R +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.interfaces.profile.Profile import javax.inject.Inject @Suppress("SpellCheckingInspection") @@ -110,7 +137,7 @@ class DefaultEditTextValidator : EditTextValidator { defaultEmptyErrorString = context.getString(R.string.error_field_must_not_be_empty) setEmptyErrorString(emptyErrorStringDef) mValidator = AndValidator() - val toAdd: Validator = + val toAdd: Validator = when (testType) { EditTextValidator.TEST_NOCHECK -> DummyValidator() EditTextValidator.TEST_ALPHA -> AlphaValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_only_standard_letters_are_allowed) else testErrorString) diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt index 354ad7daab..af7f37b0f1 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt @@ -5,9 +5,11 @@ import android.util.AttributeSet import androidx.preference.EditTextPreference import androidx.preference.PreferenceViewHolder import dagger.android.HasAndroidInjector -import info.nightscout.core.main.R -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.core.main.R +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toMgdl +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.SafeParse import javax.inject.Inject diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/BgRangeValidator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/BgRangeValidator.kt index 33915141f8..9a716193a6 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/BgRangeValidator.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/BgRangeValidator.kt @@ -1,8 +1,9 @@ package info.nightscout.androidaps.utils.textValidator.validators import android.widget.EditText -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.interfaces.profile.Profile class BgRangeValidator(_customErrorMessage: String?, private val min: Int, private val max: Int, private val profileFunction: ProfileFunction) : Validator(_customErrorMessage) { diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/BasalProfileGraph.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/BasalProfileGraph.kt index 1517b19d39..a6072fec6c 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/BasalProfileGraph.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/BasalProfileGraph.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.core.main.R -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import java.text.NumberFormat import kotlin.math.max diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IcProfileGraph.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IcProfileGraph.kt index 4af96b9f65..e04eceb4ee 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IcProfileGraph.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IcProfileGraph.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.core.main.R -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import java.text.NumberFormat import kotlin.math.max diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IsfProfileGraph.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IsfProfileGraph.kt index 3906db112e..3dde0ec2fe 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IsfProfileGraph.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/IsfProfileGraph.kt @@ -7,7 +7,8 @@ import com.jjoe64.graphview.GraphView import com.jjoe64.graphview.series.DataPoint import com.jjoe64.graphview.series.LineGraphSeries import info.nightscout.core.main.R -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import java.text.NumberFormat import kotlin.math.max diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/TargetBgProfileGraph.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/TargetBgProfileGraph.kt index f2feee5ed9..55e90c4012 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/TargetBgProfileGraph.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/TargetBgProfileGraph.kt @@ -4,11 +4,12 @@ import android.content.Context import android.util.AttributeSet import com.jjoe64.graphview.DefaultLabelFormatter import com.jjoe64.graphview.GraphView -import info.nightscout.core.main.R -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.general.overview.graphExtensions.AreaGraphSeries import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DoubleDataPoint +import info.nightscout.core.main.R +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import java.text.NumberFormat import kotlin.math.max diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt index b2f5da37e4..2de85ac78d 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps.utils.userEntry import android.text.Spanned import dagger.Reusable -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.Translator import info.nightscout.core.main.R +import info.nightscout.core.profile.toUnitsString import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.ColorGroup @@ -14,6 +14,7 @@ import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil diff --git a/core/core-main/src/main/java/info/nightscout/core/profile/ProfileExtension.kt b/core/core-main/src/main/java/info/nightscout/core/profile/ProfileExtension.kt new file mode 100644 index 0000000000..60d1157328 --- /dev/null +++ b/core/core-main/src/main/java/info/nightscout/core/profile/ProfileExtension.kt @@ -0,0 +1,80 @@ +package info.nightscout.core.profile + +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.utils.DecimalFormatter +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import org.joda.time.DateTime + +/* + * Midnight time conversion + */ +fun Profile.Companion.secondsFromMidnight(): Int { + val passed = DateTime().millisOfDay.toLong() + return (passed / 1000).toInt() +} + +fun Profile.Companion.secondsFromMidnight(date: Long): Int { + val passed = DateTime(date).millisOfDay.toLong() + return (passed / 1000).toInt() +} + +fun Profile.Companion.milliSecFromMidnight(date: Long): Long { + return DateTime(date).millisOfDay.toLong() +} +/* + * Units conversion + */ + +fun Profile.Companion.fromMgdlToUnits(value: Double, units: GlucoseUnit): Double = + if (units == GlucoseUnit.MGDL) value else value * Constants.MGDL_TO_MMOLL + +fun Profile.Companion.fromMmolToUnits(value: Double, units: GlucoseUnit): Double = + if (units == GlucoseUnit.MMOL) value else value * Constants.MMOLL_TO_MGDL + +fun Profile.Companion.toUnits(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): Double = + if (units == GlucoseUnit.MGDL) valueInMgdl else valueInMmol + +fun Profile.Companion.toUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String = + if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(valueInMgdl) else DecimalFormatter.to1Decimal(valueInMmol) + +fun Profile.Companion.toSignedUnitsString(valueInMgdl: Double, valueInMmol: Double, units: GlucoseUnit): String = + if (units == GlucoseUnit.MGDL) (if (valueInMgdl > 0) "+" else "") + DecimalFormatter.to0Decimal(valueInMgdl) + else (if (valueInMmol > 0) "+" else "") + DecimalFormatter.to1Decimal(valueInMmol) + +fun Profile.Companion.isMgdl(anyBg: Double) = anyBg >= 39 +fun Profile.Companion.isMmol(anyBg: Double) = anyBg < 39 +fun Profile.Companion.unit(anyBg: Double) = if (isMgdl(anyBg)) GlucoseUnit.MGDL else GlucoseUnit.MMOL + +fun Profile.Companion.toCurrentUnits(profileFunction: ProfileFunction, anyBg: Double): Double = + if (isMmol(anyBg)) fromMmolToUnits(anyBg, profileFunction.getUnits()) + else fromMgdlToUnits(anyBg, profileFunction.getUnits()) + +fun Profile.Companion.toCurrentUnits(units: GlucoseUnit, anyBg: Double): Double = + if (isMmol(anyBg)) fromMmolToUnits(anyBg, units) + else fromMgdlToUnits(anyBg, units) + +fun Profile.Companion.toCurrentUnitsString(profileFunction: ProfileFunction, anyBg: Double): String = + if (isMmol(anyBg)) toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits()) + else toUnitsString(anyBg, anyBg * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()) + +fun Profile.Companion.toMgdl(value: Double): Double = + if (isMgdl(value)) value else value * Constants.MMOLL_TO_MGDL + +fun Profile.Companion.toMgdl(value: Double, units: GlucoseUnit): Double = + if (units == GlucoseUnit.MGDL) value else value * Constants.MMOLL_TO_MGDL + +fun Profile.Companion.toMmol(value: Double, units: GlucoseUnit): Double = + if (units == GlucoseUnit.MGDL) value * Constants.MGDL_TO_MMOLL else value + +// targets are stored in mg/dl but profile vary +fun Profile.Companion.toTargetRangeString(low: Double, high: Double, sourceUnits: GlucoseUnit, units: GlucoseUnit): String { + val lowMgdl = toMgdl(low, sourceUnits) + val highMgdl = toMgdl(high, sourceUnits) + val lowMmol = toMmol(low, sourceUnits) + val highMmol = toMmol(high, sourceUnits) + return if (low == high) toUnitsString(lowMgdl, lowMmol, units) + else toUnitsString(lowMgdl, lowMmol, units) + " - " + toUnitsString(highMgdl, highMmol, units) +} + diff --git a/core/core-main/src/main/java/info/nightscout/core/profile/ProfileStoreObject.kt b/core/core-main/src/main/java/info/nightscout/core/profile/ProfileStoreObject.kt index 2c6b42118e..d66ebcba86 100644 --- a/core/core-main/src/main/java/info/nightscout/core/profile/ProfileStoreObject.kt +++ b/core/core-main/src/main/java/info/nightscout/core/profile/ProfileStoreObject.kt @@ -3,12 +3,12 @@ package info.nightscout.core.profile import androidx.collection.ArrayMap import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.interfaces.Config import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.interfaces.profile.PureProfile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/core/core-main/src/main/java/info/nightscout/core/pumpExtensions/PumpStateExtension.kt b/core/core-main/src/main/java/info/nightscout/core/pumpExtensions/PumpStateExtension.kt index b4d6bce4bc..f82adc569b 100644 --- a/core/core-main/src/main/java/info/nightscout/core/pumpExtensions/PumpStateExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/core/pumpExtensions/PumpStateExtension.kt @@ -1,8 +1,8 @@ package info.nightscout.androidaps.extensions -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.utils.DecimalFormatter +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import kotlin.math.ceil diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index eef46d8a41..ce9a00c156 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,16 +4,16 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Config +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP @@ -35,6 +35,7 @@ open class TestBaseWithProfile : TestBase() { @Mock lateinit var sp: SP @Mock lateinit var context: Context @Mock lateinit var repository: AppRepository + @Mock lateinit var hardLimits: HardLimits lateinit var testPumpPlugin: TestPumpPlugin @@ -48,7 +49,7 @@ open class TestBaseWithProfile : TestBase() { it.config = config it.rh = rh it.rxBus = rxBus - it.hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository) + it.hardLimits = hardLimits } } } diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/core/core-main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 7829779b22..7262510558 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt index c85e1fc21a..ef5d3a8899 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt @@ -4,19 +4,25 @@ import android.content.Context import dagger.android.AndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestPumpPlugin -import info.nightscout.core.main.R -import info.nightscout.database.impl.AppRepository +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.shared.utils.DateUtil -import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson +import info.nightscout.core.main.R +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toMgdl +import info.nightscout.core.profile.toMmol +import info.nightscout.core.profile.toTargetRangeString +import info.nightscout.core.profile.toUnits +import info.nightscout.core.profile.toUnitsString +import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Config +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before @@ -38,11 +44,11 @@ class ProfileTest : TestBase() { @Mock lateinit var config: Config @Mock lateinit var sp: SP @Mock lateinit var repository: AppRepository + @Mock lateinit var hardLimits: HardLimits private lateinit var rxBus: RxBus private lateinit var dateUtil: DateUtil private lateinit var testPumpPlugin: TestPumpPlugin - private lateinit var hardLimits: HardLimits private var okProfile = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}]," + "\"sens\":[{\"time\":\"00:00\",\"value\":\"6\"},{\"time\":\"2:00\",\"value\":\"6.2\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" @@ -64,7 +70,6 @@ class ProfileTest : TestBase() { testPumpPlugin = TestPumpPlugin { AndroidInjector { } } dateUtil = DateUtil(context) rxBus = RxBus(TestAapsSchedulers(), aapsLogger) - hardLimits = HardLimits(aapsLogger, rxBus, sp, rh, context, repository) `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) `when`(rh.gs(R.string.profile_per_unit)).thenReturn("/U") `when`(rh.gs(R.string.profile_carbs_per_unit)).thenReturn("g/U") diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/pump/bolusInfo/TemporaryBasalStorageTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/pump/bolusInfo/TemporaryBasalStorageTest.kt index d54568e4ae..dbec87ad2a 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/pump/bolusInfo/TemporaryBasalStorageTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/pump/bolusInfo/TemporaryBasalStorageTest.kt @@ -1,8 +1,8 @@ package info.nightscout.androidaps.pump.bolusInfo import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage +import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert.assertEquals import org.junit.Assert.assertNull import org.junit.Before diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt b/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt similarity index 76% rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt rename to implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt index de39a4ef78..f1641ef0e5 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt +++ b/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt @@ -1,13 +1,15 @@ -package info.nightscout.androidaps.utils +package info.nightscout.implementation import android.content.Context import info.nightscout.androidaps.annotations.OpenForTesting +import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.core.main.R import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction -import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign @@ -18,14 +20,14 @@ import kotlin.math.min @OpenForTesting @Singleton -class HardLimits @Inject constructor( +class HardLimitsImpl @Inject constructor( private val aapsLogger: AAPSLogger, private val rxBus: RxBus, private val sp: SP, private val rh: ResourceHelper, private val context: Context, private val repository: AppRepository -) { +) : HardLimits { private val disposable = CompositeDisposable() @@ -70,26 +72,26 @@ class HardLimits @Inject constructor( rh.gs(R.string.key_adult) -> ADULT rh.gs(R.string.key_resistantadult) -> RESISTANT_ADULT rh.gs(R.string.key_pregnant) -> PREGNANT - else -> ADULT + else -> ADULT } - fun maxBolus(): Double = MAX_BOLUS[loadAge()] - fun maxIobAMA(): Double = MAX_IOB_AMA[loadAge()] - fun maxIobSMB(): Double = MAX_IOB_SMB[loadAge()] - fun maxBasal(): Double = MAX_BASAL[loadAge()] - fun minDia(): Double = MIN_DIA[loadAge()] - fun maxDia(): Double = MAX_DIA[loadAge()] - fun minIC(): Double = MIN_IC[loadAge()] - fun maxIC(): Double = MAX_IC[loadAge()] + override fun maxBolus(): Double = MAX_BOLUS[loadAge()] + override fun maxIobAMA(): Double = MAX_IOB_AMA[loadAge()] + override fun maxIobSMB(): Double = MAX_IOB_SMB[loadAge()] + override fun maxBasal(): Double = MAX_BASAL[loadAge()] + override fun minDia(): Double = MIN_DIA[loadAge()] + override fun maxDia(): Double = MAX_DIA[loadAge()] + override fun minIC(): Double = MIN_IC[loadAge()] + override fun maxIC(): Double = MAX_IC[loadAge()] // safety checks - fun checkHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Boolean = - value == verifyHardLimits(value, valueName, lowLimit, highLimit) + override fun checkHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Boolean = + value == verifyHardLimits(value, valueName, lowLimit, highLimit) - fun isInRange(value: Double, lowLimit: Double, highLimit: Double): Boolean = + override fun isInRange(value: Double, lowLimit: Double, highLimit: Double): Boolean = value in lowLimit..highLimit - fun verifyHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Double { + override fun verifyHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Double { var newValue = value if (newValue < lowLimit || newValue > highLimit) { newValue = max(newValue, lowLimit) diff --git a/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt b/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt index f1f7e5a011..5fdd617c2e 100644 --- a/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt @@ -2,8 +2,8 @@ package info.nightscout.implementation.constraints import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import javax.inject.Inject import javax.inject.Singleton diff --git a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt index 1ebf7218dd..e6cf6101c2 100644 --- a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt +++ b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt @@ -4,7 +4,14 @@ import android.content.Context import dagger.Module import dagger.Provides import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.database.impl.AppRepository +import info.nightscout.implementation.HardLimitsImpl +import info.nightscout.implementation.resources.ResourceHelperImpl +import info.nightscout.interfaces.utils.HardLimits +import info.nightscout.rx.bus.RxBus +import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.sharedPreferences.SP import javax.inject.Singleton @Module( @@ -15,8 +22,14 @@ import javax.inject.Singleton @Suppress("unused") open class ImplementationModule { + @Provides @Singleton fun provideResources(context: Context, fabricPrivacy: FabricPrivacy): ResourceHelper = - info.nightscout.implementation.resources.ResourceHelperImpl(context, fabricPrivacy) + ResourceHelperImpl(context, fabricPrivacy) + + @Provides + @Singleton + fun provideHardLimits(aapsLogger: AAPSLogger, rxBus: RxBus, sp: SP, rh: ResourceHelper, context: Context, repository: AppRepository): HardLimits = + HardLimitsImpl(aapsLogger, rxBus, sp, rh, context, repository) } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt index 1afa3c168b..4d71325c0a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt @@ -2,7 +2,6 @@ package info.nightscout.implementation.pump import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.core.main.R @@ -38,6 +37,7 @@ import info.nightscout.database.impl.transactions.SyncPumpTotalDailyDoseTransact import info.nightscout.database.impl.transactions.SyncTemporaryBasalWithTempIdTransaction import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.VirtualPump import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.rx.bus.RxBus diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt index 6ed3b595ec..c6e5a7d41f 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt @@ -10,18 +10,16 @@ import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.dialogs.BolusProgressDialog +import info.nightscout.androidaps.extensions.getCustomizedName import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.queue.commands.Command import info.nightscout.androidaps.queue.commands.Command.CommandType -import info.nightscout.androidaps.utils.extensions.getCustomizedName import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.pumpExtensions.insertCarbsTransaction import info.nightscout.database.entities.EffectiveProfileSwitch @@ -52,8 +50,10 @@ import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CustomCommand import info.nightscout.interfaces.ui.ActivityNames diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt index 6e5f8618fb..d7164e8c8c 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt @@ -4,12 +4,12 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.queue.commands.Command import info.nightscout.database.impl.ValueWrapper import info.nightscout.implementation.R import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.smsCommunicator.SmsCommunicator import info.nightscout.rx.logging.LTag diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt index f9d3077b1f..fa1bcf0b22 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt @@ -2,13 +2,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandTempBasalAbsolute( diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt index 0d7d287ca6..cf01966ccc 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt @@ -2,13 +2,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandTempBasalPercent( diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirImpl.kt b/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirImpl.kt index 314c9e63fc..7e2e15fa7a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirImpl.kt @@ -6,13 +6,15 @@ import android.graphics.Typeface import android.view.Gravity import android.widget.TableRow import android.widget.TextView -import info.nightscout.interfaces.Constants -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.stats.DexcomTIR +import info.nightscout.core.profile.toCurrentUnitsString +import info.nightscout.core.profile.toUnitsString import info.nightscout.implementation.R -import java.util.* +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile +import info.nightscout.shared.interfaces.ResourceHelper +import java.util.Calendar import kotlin.math.pow import kotlin.math.roundToInt import kotlin.math.sqrt diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt index 9c62357b90..7958695c4f 100644 --- a/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt @@ -8,17 +8,18 @@ import android.view.Gravity import android.view.ViewGroup import android.widget.TableLayout import android.widget.TextView -import info.nightscout.interfaces.Constants -import info.nightscout.database.impl.AppRepository -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.stats.TIR import info.nightscout.androidaps.interfaces.stats.TirCalculator -import info.nightscout.shared.utils.DateUtil -import info.nightscout.interfaces.utils.MidnightTime -import info.nightscout.shared.utils.T +import info.nightscout.core.profile.toCurrentUnitsString +import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.R +import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.utils.MidnightTime +import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.utils.DateUtil +import info.nightscout.shared.utils.T import javax.inject.Inject import javax.inject.Singleton diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index c02f09ecf8..7f76f71a53 100644 --- a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.entities.EffectiveProfileSwitch diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 7829779b22..7262510558 100644 --- a/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt index 532b7dee34..593c8397ae 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt @@ -10,7 +10,6 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.queue.commands.Command import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.database.entities.Bolus @@ -27,6 +26,7 @@ import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CustomCommand import info.nightscout.interfaces.ui.ActivityNames diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt index 0ee309ab82..eab716d753 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.queue.commands.Command import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.R @@ -16,6 +15,7 @@ import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.BuildHelper import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.shared.sharedPreferences.SP diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 1d96b532f0..ed44fd4789 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -39,12 +39,8 @@ import info.nightscout.androidaps.insight.database.InsightPumpID; import info.nightscout.androidaps.insight.database.InsightPumpID.EventType; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.Pump; import info.nightscout.androidaps.interfaces.PumpPluginBase; -import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.androidaps.interfaces.PumpSync.PumpState.TemporaryBasal; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.pump.insight.app_layer.Service; @@ -118,9 +114,13 @@ import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.interfaces.pump.Insight; +import info.nightscout.interfaces.pump.Pump; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.pump.PumpSync.PumpState.TemporaryBasal; import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.pump.defs.PumpType; diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java index fda0450c1f..b72bfc3589 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.pump.insight.activities; -import info.nightscout.androidaps.extensions.BluetoothAdapterExtensionKt; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothManager; @@ -34,13 +33,14 @@ import java.util.List; import javax.inject.Inject; import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; +import info.nightscout.androidaps.extensions.BluetoothAdapterExtensionKt; import info.nightscout.androidaps.extensions.IntentExtensionKt; import info.nightscout.androidaps.insight.R; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck; import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService; import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState; import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator; +import info.nightscout.interfaces.pump.PumpSync; public class InsightPairingActivity extends NoSplashAppCompatActivity implements InsightConnectionService.StateCallback, View.OnClickListener, InsightConnectionService.ExceptionCallback { diff --git a/interfaces/src/main/java/info/nightscout/interfaces/profile/Profile.kt b/interfaces/src/main/java/info/nightscout/interfaces/profile/Profile.kt new file mode 100644 index 0000000000..2c380a0158 --- /dev/null +++ b/interfaces/src/main/java/info/nightscout/interfaces/profile/Profile.kt @@ -0,0 +1,138 @@ +package info.nightscout.interfaces.profile + +import info.nightscout.interfaces.Config +import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.pump.Pump +import info.nightscout.interfaces.utils.HardLimits +import info.nightscout.interfaces.utils.Round +import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.utils.DateUtil +import org.json.JSONObject + +interface Profile { + + class ValidityCheck(var isValid: Boolean = true, val reasons: ArrayList = arrayListOf()) + + fun isValid(from: String, pump: Pump, config: Config, rh: ResourceHelper, rxBus: RxBus, hardLimits: HardLimits, sendNotifications: Boolean): ValidityCheck + + /** + * Units used for ISF & target + */ + val units: GlucoseUnit + + //@Deprecated("Replace in favor of accessing InsulinProfile") + val dia: Double + + val percentage: Int + + /** + * Timeshift modifier of base profile in hours + */ + val timeshift: Int + + /** + * is equal to another profile? + */ + fun isEqual(profile: Profile): Boolean + + /** + * Basal value according to "now" + */ + fun getBasal(): Double + + /** + * Basal value according to timestamp + */ + fun getBasal(timestamp: Long): Double + + /** + * I:C value according to "now" + */ + fun getIc(): Double + + /** + * I:C value according to timestamp + */ + fun getIc(timestamp: Long): Double + + /** + * ISF value according to "now"" in MGDL + */ + fun getIsfMgdl(): Double + + /** + * ISF value according to timestamp in MGDL + */ + fun getIsfMgdl(timestamp: Long): Double + + /** + * Average target value according to "now" in MGDL + */ + fun getTargetMgdl(): Double + fun getTargetLowMgdl(): Double + fun getTargetLowMgdl(timestamp: Long): Double + fun getTargetHighMgdl(): Double + fun getTargetHighMgdl(timestamp: Long): Double + + /** + * Basal value according to elapsed seconds from midnight + */ + fun getBasalTimeFromMidnight(timeAsSeconds: Int): Double + + /** + * I:C value according to elapsed seconds from midnight + */ + fun getIcTimeFromMidnight(timeAsSeconds: Int): Double + + /** + * ISF value according to elapsed seconds from midnight + */ + fun getIsfMgdlTimeFromMidnight(timeAsSeconds: Int): Double + + /** + * Low target value according to elapsed seconds from midnight + */ + fun getTargetLowMgdlTimeFromMidnight(timeAsSeconds: Int): Double + + /** + * High target value according to elapsed seconds from midnight in MGDL + */ + fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double + + fun getIcList(rh: ResourceHelper, dateUtil: DateUtil): String + fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String + fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String + fun getTargetList(rh: ResourceHelper, dateUtil: DateUtil): String + + fun convertToNonCustomizedProfile(dateUtil: DateUtil): PureProfile + fun toPureNsJson(dateUtil: DateUtil): JSONObject + fun getMaxDailyBasal(): Double + fun baseBasalSum(): Double + fun percentageBasalSum(): Double + + fun getBasalValues(): Array + fun getIcsValues(): Array + fun getIsfsMgdlValues(): Array + fun getSingleTargetsMgdl(): Array + + open class ProfileValue(var timeAsSeconds: Int, var value: Double) { + + override fun equals(other: Any?): Boolean { + if (other !is ProfileValue) { + return false + } + return timeAsSeconds == other.timeAsSeconds && Round.isSame(value, other.value) + } + + override fun hashCode(): Int { + var result = timeAsSeconds + result = 31 * result + value.hashCode() + return result + } + } + + companion object { + + } +} \ No newline at end of file diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt b/interfaces/src/main/java/info/nightscout/interfaces/pump/Pump.kt similarity index 96% rename from core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt rename to interfaces/src/main/java/info/nightscout/interfaces/pump/Pump.kt index 8a669ca254..7ab5ecebf6 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt +++ b/interfaces/src/main/java/info/nightscout/interfaces/pump/Pump.kt @@ -1,7 +1,6 @@ -package info.nightscout.androidaps.interfaces +package info.nightscout.interfaces.pump -import info.nightscout.interfaces.pump.DetailedBolusInfo -import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType @@ -13,7 +12,7 @@ import org.json.JSONObject /** * This interface defines the communication from AAPS-core to pump drivers. - * Pump drivers communicate data changes back to AAPS-core using [info.nightscout.androidaps.interfaces.PumpSync]. + * Pump drivers communicate data changes back to AAPS-core using [info.nightscout.interfaces.pump.PumpSync]. * * Created by mike on 04.06.2016. */ @@ -202,7 +201,7 @@ interface Pump { /** * Pump model * - * If new model is covered by driver, model and it's capabilities must be added to [info.nightscout.androidaps.plugins.pump.common.defs.PumpType] + * If new model is covered by driver, model and it's capabilities must be added to [info.nightscout.interfaces.pump.defs.PumpType] * * @return PumpType */ @@ -258,7 +257,7 @@ interface Pump { /** * Executes a custom queued command - * See [CommandQueue.customCommand] for queuing a custom command. + * See [info.nightscout.interfaces.queue.CustomCommand] for queuing a custom command. * * @param customCommand the custom command to be executed * @return PumpEnactResult that represents the command execution result diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt b/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt similarity index 96% rename from core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt rename to interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt index 4d5d7907a3..a0b5b23c36 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt +++ b/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt @@ -1,7 +1,7 @@ -package info.nightscout.androidaps.interfaces +package info.nightscout.interfaces.pump -import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.database.entities.TemporaryBasal +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpType /** @@ -268,7 +268,7 @@ interface PumpSync { * if db record already has endPumpId assigned by [syncStopTemporaryBasalWithPumpId] other updates * are ignored * - * see [info.nightscout.androidaps.database.transactions.SyncPumpTemporaryBasalTransaction] + * see [info.nightscout.database.impl.transactions.SyncPumpTemporaryBasalTransaction] * * @param timestamp timestamp of event from pump history * @param rate TBR rate in U/h or % (value of 100% is equal to no TBR) @@ -298,7 +298,7 @@ interface PumpSync { * endPumpId is stored to running record * If db record doesn't exist data is ignored and false returned * - * see [info.nightscout.androidaps.database.transactions.SyncPumpCancelTemporaryBasalIfAnyTransaction] + * see [info.nightscout.database.impl.transactions.SyncPumpCancelTemporaryBasalIfAnyTransaction] * * @param timestamp timestamp of event from pump history * @param endPumpId pump id of ending event from history @@ -332,7 +332,7 @@ interface PumpSync { * @param pumpSerial pump serial number * @return true if new record is created * - * see [info.nightscout.androidaps.database.transactions.InsertTemporaryBasalWithTempIdTransaction] + * see [info.nightscout.database.impl.transactions.InsertTemporaryBasalWithTempIdTransaction] **/ fun addTemporaryBasalWithTempId(timestamp: Long, rate: Double, duration: Long, isAbsolute: Boolean, tempId: Long, type: TemporaryBasalType, pumpType: PumpType, pumpSerial: String): Boolean @@ -424,7 +424,7 @@ interface PumpSync { * If db record doesn't exist, new record is created. * isValid field is preserved * - * see [info.nightscout.androidaps.database.transactions.SyncPumpExtendedBolusTransaction] + * see [info.nightscout.database.impl.transactions.SyncPumpExtendedBolusTransaction] * * @param timestamp timestamp of event from pump history * @param amount EB total amount in U @@ -452,7 +452,7 @@ interface PumpSync { * endPumpId is stored to running record * If db record doesn't exist data is ignored and false returned * - * see [info.nightscout.androidaps.database.transactions.SyncPumpCancelExtendedBolusIfAnyTransaction] + * see [info.nightscout.database.impl.transactions.SyncPumpCancelExtendedBolusIfAnyTransaction] * * @param timestamp timestamp of event from pump history * @param endPumpId pump id of ending event from history @@ -477,7 +477,7 @@ interface PumpSync { * isValid field is preserved * If db record doesn't exist, new record is created. * - * see [info.nightscout.androidaps.database.transactions.SyncPumpTotalDailyDoseTransaction] + * see [info.nightscout.database.impl.transactions.SyncPumpTotalDailyDoseTransaction] * * @param timestamp timestamp of event from pump history * @param bolusAmount bolus part diff --git a/interfaces/src/main/java/info/nightscout/interfaces/utils/HardLimits.kt b/interfaces/src/main/java/info/nightscout/interfaces/utils/HardLimits.kt new file mode 100644 index 0000000000..b957d08f9d --- /dev/null +++ b/interfaces/src/main/java/info/nightscout/interfaces/utils/HardLimits.kt @@ -0,0 +1,47 @@ +package info.nightscout.interfaces.utils + +interface HardLimits { + companion object { + + // Very Hard Limits Ranges + // First value is the Lowest and second value is the Highest a Limit can define + val VERY_HARD_LIMIT_MIN_BG = doubleArrayOf(80.0, 180.0) + val VERY_HARD_LIMIT_MAX_BG = doubleArrayOf(90.0, 200.0) + val VERY_HARD_LIMIT_TARGET_BG = doubleArrayOf(80.0, 200.0) + + // Very Hard Limits Ranges for Temp Targets + val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180) + val VERY_HARD_LIMIT_TEMP_MAX_BG = intArrayOf(72, 270) + val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200) + val MIN_DIA = doubleArrayOf(5.0, 5.0, 5.0, 5.0, 5.0) + val MAX_DIA = doubleArrayOf(9.0, 9.0, 9.0, 9.0, 10.0) + val MIN_IC = doubleArrayOf(2.0, 2.0, 2.0, 2.0, 0.3) + val MAX_IC = doubleArrayOf(100.0, 100.0, 100.0, 100.0, 100.0) + const val MIN_ISF = 2.0 // mgdl + const val MAX_ISF = 1000.0 // mgdl + val MAX_IOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0, 25.0) + val MAX_IOB_SMB = doubleArrayOf(7.0, 13.0, 22.0, 30.0, 70.0) + val MAX_BASAL = doubleArrayOf(2.0, 5.0, 10.0, 12.0, 25.0) + + //LGS Hard limits + //No IOB at all + const val MAX_IOB_LGS = 0.0 + } + + fun maxBolus(): Double + fun maxIobAMA(): Double + fun maxIobSMB(): Double + fun maxBasal(): Double + fun minDia(): Double + fun maxDia(): Double + fun minIC(): Double + fun maxIC(): Double + + // safety checks + fun checkHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Boolean + + fun isInRange(value: Double, lowLimit: Double, highLimit: Double): Boolean + + fun verifyHardLimits(value: Double, valueName: Int, lowLimit: Double, highLimit: Double): Double + +} \ No newline at end of file diff --git a/plugins/src/main/java/info/nightscout/plugins/configBuilder/RunningConfiguration.kt b/plugins/src/main/java/info/nightscout/plugins/configBuilder/RunningConfiguration.kt index d63acfd0d6..3313a5ed2b 100644 --- a/plugins/src/main/java/info/nightscout/plugins/configBuilder/RunningConfiguration.kt +++ b/plugins/src/main/java/info/nightscout/plugins/configBuilder/RunningConfiguration.kt @@ -1,7 +1,6 @@ package info.nightscout.plugins.configBuilder import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.Sensitivity import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.core.main.R @@ -10,6 +9,7 @@ import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.sync.NsClient import info.nightscout.plugins.sync.nsShared.events.EventNSClientNewLog diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt index bad815109a..6d2cbc2b51 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt @@ -22,16 +22,17 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.dialogs.ProfileViewerDialog import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.interfaces.utils.Round diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt index cfc929c823..a3fa051a41 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt @@ -3,9 +3,9 @@ package info.nightscout.plugins.general.autotune import info.nightscout.androidaps.extensions.durationInMinutes import info.nightscout.androidaps.extensions.toJson import info.nightscout.androidaps.extensions.toTemporaryBasal -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.core.iob.round +import info.nightscout.core.profile.milliSecFromMidnight import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.ExtendedBolus @@ -17,6 +17,7 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Constants import info.nightscout.interfaces.iob.Iob import info.nightscout.interfaces.iob.IobTotal +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.Round import info.nightscout.plugins.R import info.nightscout.plugins.general.autotune.data.ATProfile @@ -248,7 +249,7 @@ open class AutotuneIob @Inject constructor( getCalculationToTimeTreatments(time, localInsulin).round() // Add specific calculation for Autotune (reference localInsulin for Peak/dia) - fun Bolus.iobCalc(time: Long, localInsulin: LocalInsulin): Iob { + private fun Bolus.iobCalc(time: Long, localInsulin: LocalInsulin): Iob { if (!isValid || type == Bolus.Type.PRIMING ) return Iob() return localInsulin.iobCalcForTreatment(this, time) } diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt index ef577a1e64..aa2a88d82d 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt @@ -3,11 +3,10 @@ package info.nightscout.plugins.general.autotune import android.view.View import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.ValueWithUnit @@ -17,6 +16,7 @@ import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.plugins.R diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt index bd24b36cf0..e31f73f07f 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt @@ -3,16 +3,18 @@ package info.nightscout.plugins.general.autotune.data import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.extensions.blockValueBySeconds +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.main.R import info.nightscout.core.profile.ProfileStoreObject +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.secondsFromMidnight import info.nightscout.database.entities.data.Block import info.nightscout.interfaces.Config import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.interfaces.profile.PureProfile import info.nightscout.interfaces.utils.Round diff --git a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index edb9100927..dff5adfdac 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -19,9 +19,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.XDripBroadcast import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification @@ -31,6 +29,9 @@ import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.iob.round +import info.nightscout.core.profile.toCurrentUnits +import info.nightscout.core.profile.toMgdl +import info.nightscout.core.profile.toUnitsString import info.nightscout.database.entities.OfflineEvent import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action @@ -49,7 +50,9 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.smsCommunicator.Sms import info.nightscout.interfaces.smsCommunicator.SmsCommunicator diff --git a/plugins/src/main/java/info/nightscout/plugins/general/xdripStatusline/StatusLinePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/xdripStatusline/StatusLinePlugin.kt index b8b441de59..df31c42eb1 100644 --- a/plugins/src/main/java/info/nightscout/plugins/general/xdripStatusline/StatusLinePlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/general/xdripStatusline/StatusLinePlugin.kt @@ -8,14 +8,15 @@ import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.extensions.toStringShort import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.iob.round +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.R import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinLyumjevPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinLyumjevPlugin.kt index 059169e2e1..cf35817824 100644 --- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinLyumjevPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinLyumjevPlugin.kt @@ -2,9 +2,9 @@ package info.nightscout.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt index 5300a7e885..144e744760 100644 --- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt @@ -3,7 +3,6 @@ package info.nightscout.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.embedments.InsulinConfiguration import info.nightscout.interfaces.Config @@ -13,6 +12,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPlugin.kt index 903d6143ab..8712ed9b70 100644 --- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPlugin.kt @@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.extensions.putInt import info.nightscout.androidaps.extensions.storeInt import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPlugin.kt index fdbd18f2db..d2d7cb4cba 100644 --- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPlugin.kt @@ -2,9 +2,9 @@ package info.nightscout.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt index 740d21eae6..d2c9cf1dbf 100644 --- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt @@ -2,9 +2,9 @@ package info.nightscout.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt index cd17c2fd8d..b4ad2ce3f8 100644 --- a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt +++ b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt @@ -12,19 +12,20 @@ import com.google.android.material.tabs.TabLayout import dagger.android.support.DaggerFragment import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DecimalFormatter -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.plugins.databinding.ProfileFragmentBinding import info.nightscout.plugins.ui.TimeListEdit diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt index 1a2ad4d0a2..18fb8a515c 100644 --- a/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt @@ -9,17 +9,16 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.extensions.blockFromJsonArray +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.XDripBroadcast import info.nightscout.androidaps.receivers.DataWorkerStorage import info.nightscout.androidaps.utils.DecimalFormatter -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.profile.ProfileStoreObject +import info.nightscout.core.profile.toMgdl import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit @@ -27,9 +26,11 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileSource import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.interfaces.profile.PureProfile +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus diff --git a/plugins/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt index 3048694003..b69576ffed 100644 --- a/plugins/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt +++ b/plugins/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt @@ -11,19 +11,19 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.Config import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.VirtualPump import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt index 3650f605e4..ef7ca96b17 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt @@ -4,10 +4,10 @@ import android.os.Build import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.core.iob.json import info.nightscout.database.entities.DeviceStatus +import info.nightscout.interfaces.pump.Pump import info.nightscout.plugins.configBuilder.RunningConfiguration import info.nightscout.shared.utils.DateUtil import org.json.JSONObject diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt index d4f0702c3b..a425516909 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.sync.nsclient.extensions import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.database.entities.EffectiveProfileSwitch import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.interfaces.GlucoseUnit diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt index 72803e5e17..d114bfa013 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt @@ -1,9 +1,9 @@ package info.nightscout.plugins.sync.nsclient.extensions import info.nightscout.androidaps.extensions.toTemporaryBasal -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.embedments.InterfaceIDs +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt index 03efb14c17..d6742dd030 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt @@ -1,10 +1,10 @@ package info.nightscout.plugins.sync.nsclient.extensions import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.fromConstant +import info.nightscout.androidaps.extensions.getCustomizedName +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.utils.extensions.fromConstant -import info.nightscout.androidaps.utils.extensions.getCustomizedName -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.database.entities.ProfileSwitch import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.interfaces.utils.JsonHelper diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt index 25e6c352d3..e9e36b708c 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt @@ -1,10 +1,10 @@ package info.nightscout.plugins.sync.nsclient.extensions import info.nightscout.androidaps.extensions.convertedToAbsolute -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.database.entities.TemporaryBasal import info.nightscout.database.entities.TemporaryBasal.Type.Companion.fromString import info.nightscout.database.entities.embedments.InterfaceIDs +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt index 6034f4d930..32c2139919 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt @@ -1,9 +1,11 @@ package info.nightscout.plugins.sync.nsclient.extensions -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TemporaryTarget import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt index 28c5db62d5..372819492d 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.sync.nsclientV3.extensions import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.database.entities.EffectiveProfileSwitch import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.plugins.sync.nsclient.extensions.fromConstant diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt index 2be54849db..4e4f6d5279 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt @@ -1,9 +1,9 @@ package info.nightscout.plugins.sync.nsclientV3.extensions import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.fromConstant +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.utils.extensions.fromConstant -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.database.entities.ProfileSwitch import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.sdk.localmodel.treatment.NSProfileSwitch diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt index b8788db10f..0f4fba4d62 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt @@ -2,8 +2,8 @@ package info.nightscout.plugins.sync.tidepool.elements import com.google.gson.annotations.Expose import info.nightscout.androidaps.extensions.convertedToAbsolute -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.database.entities.TemporaryBasal +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.utils.DateUtil import java.util.UUID diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt index 8ff50b4757..f5b71fe307 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt @@ -1,8 +1,9 @@ package info.nightscout.plugins.sync.tidepool.elements import com.google.gson.annotations.Expose -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TherapyEvent +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.sync.nsclient.extensions.toMainUnit import info.nightscout.shared.utils.DateUtil import java.util.LinkedList diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt index 5bb9a5b151..1cbd5196d6 100644 --- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt +++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt @@ -2,8 +2,8 @@ package info.nightscout.plugins.sync.tidepool.elements import com.google.gson.annotations.Expose import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.database.entities.EffectiveProfileSwitch +import info.nightscout.interfaces.profile.Profile import info.nightscout.plugins.sync.tidepool.comm.TidepoolUploader import info.nightscout.shared.utils.DateUtil import java.util.UUID diff --git a/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index c02f09ecf8..7f76f71a53 100644 --- a/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.entities.EffectiveProfileSwitch diff --git a/plugins/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/plugins/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 7829779b22..7262510558 100644 --- a/plugins/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/plugins/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt index 04ea3c601f..24733b6d1a 100644 --- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt @@ -3,9 +3,9 @@ package info.nightscout.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt index 712a324645..5de54b5ab1 100644 --- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -3,11 +3,11 @@ package info.nightscout.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.database.entities.Bolus import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index b637b05f7b..e152836e10 100644 --- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -4,9 +4,9 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt index 19821a2fc5..e2dae7c718 100644 --- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt @@ -3,9 +3,9 @@ package info.nightscout.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt index 7ca00cd442..adb34b1a60 100644 --- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt @@ -3,9 +3,9 @@ package info.nightscout.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.HardLimits import info.nightscout.interfaces.Config import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/plugins/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt b/plugins/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt index d2a3b94414..52e32bf728 100644 --- a/plugins/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt +++ b/plugins/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt @@ -5,9 +5,9 @@ import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.Config +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.plugins.R import info.nightscout.rx.bus.RxBus diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index 8fdc98efea..4ab39258e2 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -25,11 +25,8 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.extensions.PumpStateExtensionKt; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.Pump; import info.nightscout.androidaps.interfaces.PumpPluginBase; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.pump.combo.events.EventComboPumpUpdateGUI; @@ -50,8 +47,11 @@ import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; +import info.nightscout.interfaces.pump.Pump; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.pump.defs.PumpType; diff --git a/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt index 4aaafda1e6..1ed35f96cf 100644 --- a/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt +++ b/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt @@ -7,11 +7,11 @@ import info.nightscout.androidaps.combo.R import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP diff --git a/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt index f407361604..0b742be32b 100644 --- a/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt +++ b/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt @@ -18,7 +18,6 @@ import info.nightscout.androidaps.dialogs.ProfileViewerDialog import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.alertDialogs.OKDialog @@ -26,6 +25,7 @@ import info.nightscout.androidaps.utils.userEntry.UserEntryMapper.Action import info.nightscout.androidaps.utils.userEntry.UserEntryMapper.Sources import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.pump.Dana +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.AapsSchedulers diff --git a/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt b/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt index 81965fc034..5a437bab4a 100644 --- a/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt +++ b/pump/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt @@ -1,12 +1,12 @@ package info.nightscout.androidaps.dana import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.rx.events.EventOverviewBolusProgress import info.nightscout.rx.logging.AAPSLogger diff --git a/pump/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt b/pump/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt index c4d9a8dc29..934178aacf 100644 --- a/pump/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt +++ b/pump/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt @@ -18,11 +18,12 @@ import info.nightscout.androidaps.dana.databinding.DanarHistoryItemBinding import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.core.profile.toUnitsString import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.AapsSchedulers diff --git a/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 01315c2b72..a21705c778 100644 --- a/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -3,14 +3,14 @@ package info.nightscout.androidaps import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.interfaces.Config +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index 0de5d14033..96648a6732 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -15,13 +15,13 @@ import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.interfaces.PumpSync.TemporaryBasalType import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.PumpSync.TemporaryBasalType import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.utils.Round import info.nightscout.rx.AapsSchedulers diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index ca98c27fb0..c0f4e68047 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -41,14 +41,14 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.interfaces.Constants; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventInitializationChanged; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index dd79780492..628e54b924 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -20,14 +20,14 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage; import info.nightscout.core.fabric.FabricPrivacy; import info.nightscout.interfaces.constraints.Constraint; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.utils.Round; import info.nightscout.rx.AapsSchedulers; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index d7311d4bd5..5c6a6736b3 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -53,15 +53,15 @@ import info.nightscout.androidaps.dialogs.BolusProgressDialog; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.Pump; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.interfaces.Constants; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.profile.Profile; +import info.nightscout.interfaces.pump.Pump; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.Callback; import info.nightscout.interfaces.ui.ActivityNames; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index 655e5573a4..85a25603e3 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -16,10 +16,7 @@ import info.nightscout.androidaps.extensions.PumpStateExtensionKt; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.interfaces.Pump; import info.nightscout.androidaps.interfaces.PumpPluginBase; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.utils.DecimalFormatter; @@ -27,8 +24,11 @@ import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.Dana; +import info.nightscout.interfaces.pump.Pump; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.utils.Round; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index dc03bb6aa0..537681ceff 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -19,12 +19,12 @@ import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.core.fabric.FabricPrivacy; import info.nightscout.interfaces.constraints.Constraint; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.utils.Round; import info.nightscout.rx.AapsSchedulers; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt index 0475485fe9..5b06a7e2d7 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt @@ -9,17 +9,17 @@ import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danar.comm.MessageOriginalNames.getName import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.interfaces.ConfigBuilder import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.androidaps.utils.CRC.getCrc16 -import info.nightscout.shared.utils.DateUtil +import info.nightscout.interfaces.ConfigBuilder +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.utils.DateUtil import org.joda.time.DateTime import org.joda.time.IllegalInstantException import java.nio.charset.StandardCharsets diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index e318218720..acd88f4884 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -42,13 +42,13 @@ import info.nightscout.androidaps.danar.comm.MsgPCCommStop; import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.ActivePlugin; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.utils.ToastUtils; import info.nightscout.core.fabric.FabricPrivacy; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventAppExit; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java index f31c154d06..f5b84790e2 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java @@ -47,14 +47,14 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.dialogs.BolusProgressDialog; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.interfaces.Constants; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.Callback; import info.nightscout.rx.bus.RxBus; diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index c166eb31dc..2449a74ece 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.interfaces.Config diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/pump/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 687981b742..188b00af02 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index 987c8c2c19..455e2589f3 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -8,10 +8,10 @@ import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 1965551c0c..4161765c37 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -12,15 +12,15 @@ import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.interfaces.ConfigBuilder import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.shared.utils.DateUtil +import info.nightscout.interfaces.ConfigBuilder +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil import org.junit.Before import org.mockito.ArgumentMatchers import org.mockito.Mock diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index 62af1423b6..bbfcd78acb 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -8,10 +8,10 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 9d2ea27f0a..b96a51caf8 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -8,12 +8,12 @@ import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.shared.sharedPreferences.SP import org.junit.Before import org.junit.Test diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 4a11212c12..579497f341 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -18,11 +18,8 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage @@ -34,9 +31,12 @@ import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.Dana import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketAPSHistoryEvents.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketAPSHistoryEvents.kt index f844000096..6303fad958 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketAPSHistoryEvents.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketAPSHistoryEvents.kt @@ -4,16 +4,16 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danars.R import info.nightscout.androidaps.danars.encryption.BleEncryption -import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage -import info.nightscout.shared.utils.T +import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.T import org.joda.time.DateTime import org.joda.time.DateTimeZone import javax.inject.Inject diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSet24CIRCFArray.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSet24CIRCFArray.kt index 528c1cfb31..29d8427ad6 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSet24CIRCFArray.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBolusSet24CIRCFArray.kt @@ -3,8 +3,9 @@ package info.nightscout.androidaps.danars.comm import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danars.encryption.BleEncryption +import info.nightscout.core.profile.fromMgdlToUnits import info.nightscout.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.interfaces.profile.Profile import info.nightscout.rx.logging.LTag import javax.inject.Inject diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistory.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistory.kt index 027955337d..4c47477fb2 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistory.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistory.kt @@ -5,11 +5,11 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.dana.comm.RecordTypes import info.nightscout.androidaps.dana.database.DanaHistoryRecord import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.utils.T +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventDanaRSyncStatus import info.nightscout.rx.logging.LTag +import info.nightscout.shared.utils.T import org.joda.time.DateTime import java.util.Calendar import java.util.GregorianCalendar diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyAlarm.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyAlarm.kt index eee8ba10ae..5cbf132187 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyAlarm.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyAlarm.kt @@ -4,12 +4,12 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danars.R import info.nightscout.androidaps.danars.encryption.BleEncryption -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject class DanaRSPacketNotifyAlarm( diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt index 42ebdf60d6..1f0d5a758b 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt @@ -33,18 +33,18 @@ import info.nightscout.androidaps.danars.events.EventDanaRSPairingSuccess import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.extensions.notify import info.nightscout.androidaps.extensions.waitMillis -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification -import info.nightscout.interfaces.notifications.Notification -import info.nightscout.shared.utils.DateUtil -import info.nightscout.shared.utils.T import info.nightscout.androidaps.utils.ToastUtils +import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil +import info.nightscout.shared.utils.T import java.util.UUID import java.util.concurrent.ScheduledFuture import javax.inject.Inject diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt index 3f7679c154..d27da919f8 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt @@ -60,15 +60,15 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.queue.commands.Command import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.Constants import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.AapsSchedulers diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 2d798bb73f..38b8ac51a5 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -3,14 +3,14 @@ package info.nightscout.androidaps import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DefaultValueHelper -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.interfaces.Config +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileStore import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt index f8ecf62623..ee4ba8dac1 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt @@ -4,12 +4,12 @@ import android.content.Context import dagger.android.AndroidInjector import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.interfaces.Constants import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert import org.junit.Before import org.junit.Test diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt index 4c0b6c4dd0..52d2787c96 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt @@ -5,13 +5,14 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage +import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert import org.junit.Test import org.mockito.Mock -import java.util.* +import java.util.Calendar +import java.util.GregorianCalendar class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index 9def3f4307..b701360855 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -7,10 +7,10 @@ import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert import org.junit.Before import org.junit.Test diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt index fabe947464..34829cddaa 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert import org.junit.Test import org.mockito.Mock diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index 176520b296..1b93481e28 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -7,11 +7,11 @@ import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.rx.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert import org.junit.Before import org.junit.Test diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt index 6f68542f21..1f6627d1c1 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt @@ -16,9 +16,9 @@ import info.nightscout.androidaps.diaconn.events.EventDiaconnG8NewStatus import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.utils.WarnColors import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt index e81abac241..e92abc56aa 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt @@ -16,11 +16,8 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage @@ -32,9 +29,12 @@ import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.Diaconn +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Pump.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Pump.kt index b4a5b8a923..bd82ee2759 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Pump.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Pump.kt @@ -1,13 +1,13 @@ package info.nightscout.androidaps.diaconn -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.rx.events.EventOverviewBolusProgress -import info.nightscout.shared.utils.DateUtil import info.nightscout.androidaps.utils.DecimalFormatter -import info.nightscout.shared.utils.T +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.rx.events.EventOverviewBolusProgress import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag +import info.nightscout.shared.utils.DateUtil +import info.nightscout.shared.utils.T import javax.inject.Inject import javax.inject.Singleton import kotlin.math.max diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt index b3ccc3a82a..58002742cd 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt @@ -2,7 +2,6 @@ package info.nightscout.androidaps.diaconn.packet import android.content.Context import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.androidaps.diaconn.DiaconnG8Pump import info.nightscout.androidaps.diaconn.R import info.nightscout.androidaps.diaconn.api.ApiResponse @@ -40,18 +39,19 @@ import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_START_V3 import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_STOP_V3 import info.nightscout.androidaps.diaconn.pumplog.PumplogUtil import info.nightscout.androidaps.events.EventPumpStatusChanged -import info.nightscout.shared.extensions.safeGetPackageInfo import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.pump.defs.PumpDescription -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage +import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType -import info.nightscout.shared.utils.T import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.LTag +import info.nightscout.shared.extensions.safeGetPackageInfo +import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.T import org.apache.commons.lang3.time.DateUtils import org.joda.time.DateTime import retrofit2.Call diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt index a459bdeb53..41aed8c4f7 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt @@ -50,16 +50,16 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.queue.commands.Command import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.Constants import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt index b512cc0884..81e5b51e58 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmManager import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager @@ -21,8 +18,11 @@ import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt index ae422e51c9..c1d60ca9f0 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.Intent import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.eopatch.EONotification import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus @@ -23,6 +22,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManager.java b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManager.java index c9b870d70a..66540edcd1 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManager.java +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManager.java @@ -8,14 +8,10 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import javax.inject.Singleton; -import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.shared.interfaces.ResourceHelper; -import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.androidaps.plugins.pump.eopatch.R; import info.nightscout.androidaps.plugins.pump.eopatch.RxAction; import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode; @@ -45,13 +41,17 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig; import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent; import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState; import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal; -import info.nightscout.shared.utils.DateUtil; +import info.nightscout.interfaces.pump.DetailedBolusInfo; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventCustomActionsChanged; import info.nightscout.rx.events.EventRefreshOverview; import info.nightscout.rx.logging.AAPSLogger; +import info.nightscout.shared.interfaces.ResourceHelper; import info.nightscout.shared.sharedPreferences.SP; +import info.nightscout.shared.utils.DateUtil; import io.reactivex.rxjava3.core.Maybe; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Single; diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManagerImpl.java b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManagerImpl.java index 2a50545bbb..5b23fea22b 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManagerImpl.java +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/PatchManagerImpl.java @@ -33,9 +33,6 @@ import javax.crypto.KeyAgreement; import javax.inject.Inject; import javax.inject.Singleton; -import info.nightscout.interfaces.pump.DetailedBolusInfo; -import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus; import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode; import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.ActivateTask; @@ -93,6 +90,9 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal; import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig; import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState; import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal; +import info.nightscout.interfaces.pump.DetailedBolusInfo; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/InternalSuspendedTask.java b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/InternalSuspendedTask.java index 8bf552accb..a1c3c8c3c7 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/InternalSuspendedTask.java +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/InternalSuspendedTask.java @@ -8,13 +8,13 @@ import javax.inject.Inject; import javax.inject.Singleton; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.UserEntryLogger; import info.nightscout.androidaps.plugins.pump.eopatch.core.api.GetInternalSuspendTime; import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchInternalSuspendTimeResponse; -import info.nightscout.interfaces.queue.Callback; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.userEntry.UserEntryMapper; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.queue.Callback; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; import io.reactivex.rxjava3.core.Observable; diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/PauseBasalTask.java b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/PauseBasalTask.java index 90cde768ca..cd8893019e 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/PauseBasalTask.java +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/PauseBasalTask.java @@ -10,7 +10,6 @@ import javax.inject.Inject; import javax.inject.Singleton; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.UserEntryLogger; import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode; import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmRegistry; @@ -18,9 +17,10 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager; import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BasalPause; import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse; import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState; -import info.nightscout.interfaces.queue.Callback; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.userEntry.UserEntryMapper; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.queue.Callback; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; import io.reactivex.rxjava3.core.Observable; diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/StopBasalTask.java b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/StopBasalTask.java index 6ef8cab40f..083f7fc636 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/StopBasalTask.java +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ble/task/StopBasalTask.java @@ -8,14 +8,14 @@ import javax.inject.Inject; import javax.inject.Singleton; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.logging.UserEntryLogger; import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager; import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BasalStop; import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalStopResponse; -import info.nightscout.interfaces.queue.Callback; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.userEntry.UserEntryMapper; +import info.nightscout.interfaces.pump.PumpSync; +import info.nightscout.interfaces.queue.Callback; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; import io.reactivex.rxjava3.core.Observable; diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/viewmodel/EopatchOverviewViewModel.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/viewmodel/EopatchOverviewViewModel.kt index 26e8d27b61..15b1308e95 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/viewmodel/EopatchOverviewViewModel.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/viewmodel/EopatchOverviewViewModel.kt @@ -4,9 +4,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.androidaps.plugins.pump.eopatch.R import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager @@ -18,11 +15,14 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ui.event.UIEvent import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState -import info.nightscout.shared.utils.DateUtil -import info.nightscout.shared.utils.T +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.utils.DateUtil +import info.nightscout.shared.utils.T import io.reactivex.rxjava3.core.Observable import io.reactivex.rxjava3.disposables.Disposable import java.util.Calendar diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/vo/NormalBasalManager.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/vo/NormalBasalManager.kt index fe85271de9..4cab76e286 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/vo/NormalBasalManager.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/vo/NormalBasalManager.kt @@ -1,10 +1,10 @@ package info.nightscout.androidaps.plugins.pump.eopatch.vo -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.pump.eopatch.CommonUtils import info.nightscout.androidaps.plugins.pump.eopatch.GsonHelper -import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys import info.nightscout.androidaps.plugins.pump.eopatch.code.BasalStatus +import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.core.Observable import io.reactivex.rxjava3.subjects.BehaviorSubject diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt index f747d48f85..8e830eaa84 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt @@ -12,7 +12,6 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice @@ -29,6 +28,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.core.fabric.FabricPrivacy +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.pump.core.defs.PumpDeviceState import info.nightscout.rx.AapsSchedulers diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt index ccafc41165..2788116016 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt @@ -10,10 +10,6 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.interfaces.PumpSync.TemporaryBasalType import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus @@ -56,8 +52,12 @@ import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.PumpSync.TemporaryBasalType import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt index eb034fb824..d00bd435a7 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt @@ -3,11 +3,8 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data import com.google.gson.Gson import com.google.gson.GsonBuilder import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification -import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryBolus import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR @@ -31,6 +28,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpSta import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.pump.core.utils.StringUtil import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt index 914b874bd9..3392cc7a7e 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,13 +3,13 @@ package info.nightscout.androidaps import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index 72074e1868..e6096d5ea9 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -11,11 +11,8 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.extensions.toStringFull import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil @@ -54,8 +51,11 @@ import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/Record.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/Record.kt index 3e2f28ed39..7ccd408b1b 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/Record.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/Record.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo -import info.nightscout.androidaps.interfaces.Profile sealed class Record diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/Converters.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/Converters.kt index 5f90d9b7c8..7c984afab4 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/Converters.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/Converters.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database import androidx.room.TypeConverter import com.google.gson.GsonBuilder -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusType import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.InitialResult import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.ResolvedResult +import info.nightscout.interfaces.profile.Profile class Converters { diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/activation/viewmodel/action/DashInsertCannulaViewModel.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/activation/viewmodel/action/DashInsertCannulaViewModel.kt index d3223f513e..420f7abc04 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/activation/viewmodel/action/DashInsertCannulaViewModel.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/activation/viewmodel/action/DashInsertCannulaViewModel.kt @@ -4,7 +4,6 @@ import androidx.annotation.StringRes import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel @@ -22,6 +21,7 @@ import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/Functions.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/Functions.kt index 59c5f28119..f601c63c51 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/Functions.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/Functions.kt @@ -1,9 +1,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.util -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram -import java.util.* +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.defs.PumpType import kotlin.math.roundToInt fun mapProfileToBasalProgram(profile: Profile): BasalProgram { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt index 03dfebdbe0..1cd65f2d52 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt @@ -1,8 +1,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.util -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Profile.ProfileValue import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.profile.Profile.ProfileValue import org.junit.Assert import org.junit.Assert.assertEquals import org.junit.Test diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index c74d233ee9..10a1741c82 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -38,11 +38,8 @@ import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueue; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.interfaces.Pump; import info.nightscout.androidaps.interfaces.PumpPluginBase; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; @@ -92,8 +89,11 @@ import info.nightscout.core.pumpExtensions.DetailedBolusInfoExtensionKt; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; +import info.nightscout.interfaces.pump.Pump; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.actions.CustomActionType; import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java index a5adbaa938..bfd2576754 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java @@ -16,8 +16,6 @@ import javax.inject.Singleton; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.data.PumpEnactResultImpl; import info.nightscout.androidaps.extensions.PumpStateExtensionKt; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; @@ -69,8 +67,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil; import info.nightscout.core.pumpExtensions.DetailedBolusInfoExtensionKt; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.interfaces.pump.PumpEnactResult; +import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.ui.ActivityNames; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java index 1d6f816f83..9c6a6170cc 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java @@ -23,10 +23,7 @@ import java.util.List; import javax.inject.Inject; import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.shared.interfaces.ResourceHelper; import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup; -import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.R; @@ -34,8 +31,11 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.PodHistor import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory; import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity; import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil; +import info.nightscout.interfaces.profile.Profile; +import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; +import info.nightscout.shared.interfaces.ResourceHelper; public class ErosPodHistoryActivity extends NoSplashAppCompatActivity { diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt index f45c47b3f3..9361ab1fcd 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt @@ -6,11 +6,11 @@ import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.data.PumpEnactResultImpl import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.TestAapsSchedulers diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java index 487c24861c..0083504166 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java @@ -10,10 +10,10 @@ import org.junit.Test; import java.util.List; -import info.nightscout.androidaps.interfaces.Profile; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalScheduleEntry; import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; +import info.nightscout.interfaces.profile.Profile; public class AapsOmnipodErosManagerTest { diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt index bbe9267e45..25a7421f11 100644 --- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt +++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt @@ -13,11 +13,7 @@ import info.nightscout.androidaps.extensions.toStringFull import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump import info.nightscout.androidaps.interfaces.PumpPluginBase -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.interfaces.PumpSync.TemporaryBasalType import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryCarbs @@ -26,8 +22,12 @@ import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.interfaces.plugin.PluginDescription +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync +import info.nightscout.interfaces.pump.PumpSync.TemporaryBasalType import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/di/PumpCommonModule.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/di/PumpCommonModule.kt index e18c7070f6..aec51092f8 100644 --- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/di/PumpCommonModule.kt +++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/di/PumpCommonModule.kt @@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.pump.common.di import dagger.Module import dagger.Provides -import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import javax.inject.Singleton diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt index 5212bd1567..fd720626b5 100644 --- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt +++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.common.sync import info.nightscout.interfaces.pump.DetailedBolusInfo -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType // data class PumpDbEntry constructor(var temporaryId: Long, diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpSyncStorage.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpSyncStorage.kt index c6adc55e4d..cac90a3158 100644 --- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpSyncStorage.kt +++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpSyncStorage.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.sync import com.thoughtworks.xstream.XStream import com.thoughtworks.xstream.security.AnyTypePermission import info.nightscout.interfaces.pump.DetailedBolusInfo -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.kt index 5dbb5bef04..b4a1a14a7e 100644 --- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.kt +++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.kt @@ -1,9 +1,9 @@ package info.nightscout.androidaps.plugins.pump.common.utils -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Profile.ProfileValue +import info.nightscout.interfaces.profile.Profile +import info.nightscout.interfaces.profile.Profile.ProfileValue import info.nightscout.interfaces.pump.defs.PumpType -import java.util.* +import java.util.Locale object ProfileUtil { diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt index 878f8187f3..9ec3f45056 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt @@ -17,21 +17,21 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerFragment import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction import info.nightscout.androidaps.dialogs.ProfileViewerDialog import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged import info.nightscout.androidaps.events.EventNewHistoryData +import info.nightscout.androidaps.extensions.getCustomizedName import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.extensions.getCustomizedName import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction import info.nightscout.interfaces.BuildHelper import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus diff --git a/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfile.kt b/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfile.kt index 1fd363c373..30015a6999 100644 --- a/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfile.kt +++ b/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfile.kt @@ -1,8 +1,10 @@ package info.nightscout.ui.defaultProfile -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson +import info.nightscout.androidaps.extensions.pureProfileFromJson +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.fromMmolToUnits import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.PureProfile import info.nightscout.interfaces.utils.Round import info.nightscout.shared.utils.DateUtil @@ -157,13 +159,13 @@ class DefaultProfile @Inject constructor(val dateUtil: DateUtil) { private fun singleValueArrayFromMmolToUnits(value: Double, sample: Array, units: GlucoseUnit): JSONArray { val array = JSONArray() - array.put(JSONObject().put("time", "00:00").put("value", Profile.fromMmolToUnits(value + sample[0],units)).put("timeAsSeconds", 0 * 3600)) - array.put(JSONObject().put("time", "06:00").put("value", Profile.fromMmolToUnits(value + sample[1],units)).put("timeAsSeconds", 6 * 3600)) - array.put(JSONObject().put("time", "09:00").put("value", Profile.fromMmolToUnits(value + sample[2],units)).put("timeAsSeconds", 9 * 3600)) - array.put(JSONObject().put("time", "11:00").put("value", Profile.fromMmolToUnits(value + sample[3],units)).put("timeAsSeconds", 11 * 3600)) - array.put(JSONObject().put("time", "14:00").put("value", Profile.fromMmolToUnits(value + sample[4],units)).put("timeAsSeconds", 14 * 3600)) - array.put(JSONObject().put("time", "16:00").put("value", Profile.fromMmolToUnits(value + sample[5],units)).put("timeAsSeconds", 16 * 3600)) - array.put(JSONObject().put("time", "19:00").put("value", Profile.fromMmolToUnits(value + sample[6],units)).put("timeAsSeconds", 19 * 3600)) + array.put(JSONObject().put("time", "00:00").put("value", Profile.fromMmolToUnits(value + sample[0], units)).put("timeAsSeconds", 0 * 3600)) + array.put(JSONObject().put("time", "06:00").put("value", Profile.fromMmolToUnits(value + sample[1], units)).put("timeAsSeconds", 6 * 3600)) + array.put(JSONObject().put("time", "09:00").put("value", Profile.fromMmolToUnits(value + sample[2], units)).put("timeAsSeconds", 9 * 3600)) + array.put(JSONObject().put("time", "11:00").put("value", Profile.fromMmolToUnits(value + sample[3], units)).put("timeAsSeconds", 11 * 3600)) + array.put(JSONObject().put("time", "14:00").put("value", Profile.fromMmolToUnits(value + sample[4], units)).put("timeAsSeconds", 14 * 3600)) + array.put(JSONObject().put("time", "16:00").put("value", Profile.fromMmolToUnits(value + sample[5], units)).put("timeAsSeconds", 16 * 3600)) + array.put(JSONObject().put("time", "19:00").put("value", Profile.fromMmolToUnits(value + sample[6], units)).put("timeAsSeconds", 19 * 3600)) return array } } \ No newline at end of file diff --git a/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfileDPV.kt b/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfileDPV.kt index 9d0f0ea1fb..df77b8c459 100644 --- a/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfileDPV.kt +++ b/ui/src/main/java/info/nightscout/ui/defaultProfile/DefaultProfileDPV.kt @@ -1,9 +1,11 @@ package info.nightscout.ui.defaultProfile import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson +import info.nightscout.androidaps.extensions.pureProfileFromJson +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.fromMmolToUnits import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.PureProfile import info.nightscout.shared.utils.DateUtil import org.json.JSONArray diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt index dc9e12f41f..527641deb5 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt @@ -7,16 +7,18 @@ import android.view.ViewGroup import com.google.common.base.Joiner import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dialogs.DialogFragmentWithDate -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.XDripBroadcast import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.alertDialogs.OKDialog +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toCurrentUnitsString import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.ui.R diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt index 891af79f93..dab7c3eaf6 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt @@ -13,7 +13,6 @@ import info.nightscout.androidaps.extensions.formatColor import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider @@ -23,6 +22,7 @@ import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS +import info.nightscout.core.profile.toMgdl import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources @@ -33,6 +33,7 @@ import info.nightscout.interfaces.BolusTimer import info.nightscout.interfaces.CarbTimer import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.constraints.Constraint +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.ui.ActivityNames diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt index a64eccf599..5454e2cae3 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt @@ -10,21 +10,23 @@ import android.view.ViewGroup import androidx.annotation.StringRes import com.google.common.base.Joiner import dagger.android.HasAndroidInjector -import info.nightscout.database.impl.AppRepository -import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.androidaps.dialogs.DialogFragmentWithDate import info.nightscout.androidaps.extensions.fromConstant -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.Translator import info.nightscout.androidaps.utils.alertDialogs.OKDialog +import info.nightscout.core.profile.fromMgdlToUnits +import info.nightscout.core.profile.toCurrentUnitsString import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.database.impl.AppRepository +import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt index 93734121ab..24a9471216 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt @@ -9,10 +9,12 @@ import android.view.WindowManager import dagger.android.support.DaggerDialogFragment import info.nightscout.androidaps.extensions.bolusCalculatorResultFromJson import info.nightscout.androidaps.extensions.toJson -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.core.profile.toUnits +import info.nightscout.core.profile.toUnitsString import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.interfaces.Constants +import info.nightscout.interfaces.profile.Profile import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.ui.R diff --git a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt index 32ecd1c3c1..aff7ef8b8a 100644 --- a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt +++ b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt @@ -20,16 +20,19 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraints import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.Loop -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.TrendCalculator import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider +import info.nightscout.core.profile.toSignedUnitsString +import info.nightscout.core.profile.toTargetRangeString +import info.nightscout.core.profile.toUnits import info.nightscout.database.entities.interfaces.end import info.nightscout.interfaces.Config import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.aps.VariableSensitivityResult +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag diff --git a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index c02f09ecf8..7f76f71a53 100644 --- a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.extensions.pureProfileFromJson import info.nightscout.core.fabric.FabricPrivacy import info.nightscout.core.profile.ProfileStoreObject import info.nightscout.database.entities.EffectiveProfileSwitch diff --git a/ui/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/ui/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index 7829779b22..7262510558 100644 --- a/ui/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/ui/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -2,11 +2,11 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultImpl -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.interfaces.Pump -import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.PumpEnactResult +import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType