pumpcommon: remove core dependency

This commit is contained in:
Milos Kozak 2022-11-26 00:21:50 +01:00
parent da14175da4
commit e47cdded0b
60 changed files with 149 additions and 140 deletions

View file

@ -11,7 +11,6 @@ import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
import info.nightscout.androidaps.insight.di.InsightModule
import info.nightscout.androidaps.plugin.general.openhumans.di.OpenHumansModule
import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule
import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule
import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchModule
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
@ -26,6 +25,7 @@ import info.nightscout.plugins.aps.di.ApsModule
import info.nightscout.plugins.di.PluginsModule
import info.nightscout.pump.combo.di.ComboModule
import info.nightscout.pump.combov2.di.ComboV2Module
import info.nightscout.pump.common.di.PumpCommonModule
import info.nightscout.pump.dana.di.DanaHistoryModule
import info.nightscout.pump.dana.di.DanaModule
import info.nightscout.rx.di.RxModule
@ -78,7 +78,7 @@ import javax.inject.Singleton
OmnipodDashModule::class,
OmnipodErosModule::class,
PumpCommonModule::class,
RileyLinkModule::class,
RileyLinkModule::class
]
)

View file

@ -140,7 +140,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config)
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames)
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames)
danaRSPlugin =
DanaRSPlugin(
injector,

View file

@ -0,0 +1,7 @@
package info.nightscout.interfaces.pump
import androidx.appcompat.app.AppCompatActivity
interface BlePreCheck {
fun prerequisitesCheck(activity: AppCompatActivity): Boolean
}

View file

@ -25,6 +25,7 @@ import info.nightscout.implementation.profile.ProfileStoreObject
import info.nightscout.implementation.profiling.ProfilerImpl
import info.nightscout.implementation.protection.PasswordCheckImpl
import info.nightscout.implementation.protection.ProtectionCheckImpl
import info.nightscout.implementation.pump.BlePreCheckImpl
import info.nightscout.implementation.pump.DetailedBolusInfoStorageImpl
import info.nightscout.implementation.pump.PumpSyncImplementation
import info.nightscout.implementation.pump.TemporaryBasalStorageImpl
@ -52,6 +53,7 @@ import info.nightscout.interfaces.profile.ProfileInstantiator
import info.nightscout.interfaces.profiling.Profiler
import info.nightscout.interfaces.protection.PasswordCheck
import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.TemporaryBasalStorage
@ -95,6 +97,7 @@ abstract class ImplementationModule {
@Binds fun bindHardLimits(hardLimitsImpl: HardLimitsImpl): HardLimits
@Binds fun bindResourceHelper(resourceHelperImpl: ResourceHelperImpl): ResourceHelper
@Binds fun bindProfileStoreInstantiator(profileStoreInstantiatorImpl: ProfileInstantiatorImpl): ProfileInstantiator
@Binds fun bindBlePreCheck(blePreCheckImpl: BlePreCheckImpl): BlePreCheck
@Binds fun bindTrendCalculatorInterface(trendCalculator: TrendCalculatorImpl): TrendCalculator
@Binds fun bindTddCalculatorInterface(tddCalculator: TddCalculatorImpl): TddCalculator

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.ble
package info.nightscout.implementation.pump
import android.Manifest
import android.bluetooth.BluetoothManager
@ -14,15 +14,16 @@ import androidx.core.content.ContextCompat
import info.nightscout.core.main.R
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.extensions.safeEnable
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class BlePreCheck @Inject constructor(
class BlePreCheckImpl @Inject constructor(
private val context: Context,
private val rh: ResourceHelper
) {
) : BlePreCheck {
companion object {
@ -30,7 +31,7 @@ class BlePreCheck @Inject constructor(
private const val PERMISSION_REQUEST_BLUETOOTH = 30242 // arbitrary.
}
fun prerequisitesCheck(activity: AppCompatActivity): Boolean {
override fun prerequisitesCheck(activity: AppCompatActivity): Boolean {
if (!activity.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
OKDialog.show(activity, rh.gs(R.string.message), rh.gs(R.string.ble_not_supported))
return false

View file

@ -33,13 +33,13 @@ import java.util.List;
import javax.inject.Inject;
import info.nightscout.androidaps.insight.R;
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.core.activities.NoSplashAppCompatActivity;
import info.nightscout.core.utils.extensions.BluetoothAdapterExtensionKt;
import info.nightscout.core.utils.extensions.IntentExtensionKt;
import info.nightscout.interfaces.pump.BlePreCheck;
import info.nightscout.interfaces.pump.PumpSync;
public class InsightPairingActivity extends NoSplashAppCompatActivity implements InsightConnectionService.StateCallback, View.OnClickListener, InsightConnectionService.ExceptionCallback {

View file

@ -23,10 +23,10 @@ import androidx.core.app.ActivityCompat
import info.nightscout.androidaps.danars.R
import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBinding
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.core.activities.NoSplashAppCompatActivity
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.extensions.safeEnable
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.shared.sharedPreferences.SP
import java.util.regex.Pattern
import javax.inject.Inject

View file

@ -26,10 +26,10 @@ import androidx.core.app.ActivityCompat
import info.nightscout.androidaps.diaconn.R
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8BlescannerActivityBinding
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.core.activities.NoSplashAppCompatActivity
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.extensions.safeEnable
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.shared.sharedPreferences.SP
import java.util.UUID
import javax.inject.Inject

View file

@ -7,9 +7,6 @@ import android.os.IBinder
import android.os.SystemClock
import androidx.preference.Preference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract
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.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
@ -19,10 +16,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryResult
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData
@ -64,6 +57,11 @@ import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.TimeChangeType
import info.nightscout.pump.common.data.PumpStatus
import info.nightscout.pump.common.defs.PumpDriverState
import info.nightscout.pump.common.sync.PumpDbEntryTBR
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.pump.common.utils.ProfileUtil
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshButtonState
@ -109,7 +107,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsSchedulers: AapsSchedulers,
pumpSync: PumpSync,
pumpSyncStorage: PumpSyncStorage
) : PumpPluginAbstract(
) : info.nightscout.pump.common.PumpPluginAbstract(
PluginDescription() //
.mainType(PluginType.PUMP) //
.fragmentClass(MedtronicFragment::class.java.name) //
@ -120,7 +118,7 @@ class MedtronicPumpPlugin @Inject constructor(
.description(R.string.description_pump_medtronic), //
PumpType.MEDTRONIC_522_722, // we default to most basic model, correct model from config is loaded later
injector, rh, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil, aapsSchedulers, pumpSync, pumpSyncStorage
), Pump, RileyLinkPumpDevice, PumpSyncEntriesCreator {
), Pump, RileyLinkPumpDevice, info.nightscout.pump.common.sync.PumpSyncEntriesCreator {
private var rileyLinkMedtronicService: RileyLinkMedtronicService? = null

View file

@ -1,8 +1,7 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import java.util.*
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
/**
* This file was taken from GGC - GNU Gluco Control (ggc.sourceforge.net), application for diabetes

View file

@ -3,10 +3,6 @@ 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.androidaps.plugins.pump.common.sync.PumpDbEntry
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryBolus
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.androidaps.plugins.pump.medtronic.R
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
@ -31,6 +27,11 @@ import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.pump.common.sync.PumpDbEntry
import info.nightscout.pump.common.sync.PumpDbEntryBolus
import info.nightscout.pump.common.sync.PumpDbEntryCarbs
import info.nightscout.pump.common.sync.PumpDbEntryTBR
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.pump.core.utils.StringUtil
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
@ -580,13 +581,15 @@ class MedtronicHistoryData @Inject constructor(
if (bolus.containsDecodedData("Estimate")) {
val bolusWizard = bolus.decodedData["Estimate"] as BolusWizardDTO
pumpSyncStorage.addCarbs(info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryCarbs(
pumpSyncStorage.addCarbs(
PumpDbEntryCarbs(
tryToGetByLocalTime(bolus.atechDateTime),
bolusWizard.carbs.toDouble(),
medtronicPumpStatus.pumpType,
medtronicPumpStatus.serialNumber,
bolus.pumpId
))
)
)
}
}

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.pump.common.defs.TempBasalPair
import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag

View file

@ -12,12 +12,11 @@ import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.DaggerActivity
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.androidaps.plugins.pump.medtronic.R
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.shared.interfaces.ResourceHelper
import java.util.*
import javax.inject.Inject
class MedtronicHistoryActivity : DaggerActivity() {

View file

@ -1,15 +1,16 @@
package info.nightscout.androidaps.plugins.pump.medtronic.driver
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.pump.common.data.PumpStatus
import info.nightscout.pump.common.sync.PumpDbEntryTBR
import info.nightscout.pump.core.defs.PumpDeviceState
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
@ -27,7 +28,7 @@ class MedtronicPumpStatus @Inject constructor(private val rh: ResourceHelper,
private val sp: SP,
private val rxBus: RxBus,
private val rileyLinkUtil: RileyLinkUtil
) : info.nightscout.androidaps.plugins.pump.common.data.PumpStatus(PumpType.MEDTRONIC_522_722) {
) : PumpStatus(PumpType.MEDTRONIC_522_722) {
var errorDescription: String? = null
lateinit var serialNumber: String //? = null

View file

@ -3,13 +3,13 @@ package info.nightscout.androidaps
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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.plugin.ActivePlugin
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.TestAapsSchedulers

View file

@ -11,8 +11,6 @@ import android.widget.Spinner
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.DashHistory
@ -25,6 +23,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.TempBas
import info.nightscout.core.activities.NoSplashAppCompatActivity
import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.pump.common.utils.ProfileUtil
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.logging.LTag
import java.util.Calendar

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activation
import android.os.Bundle
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
import info.nightscout.interfaces.pump.BlePreCheck
import javax.inject.Inject
class DashPodActivationWizardActivity : PodActivationWizardActivity() {

View file

@ -31,7 +31,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
@ -98,6 +97,7 @@ import info.nightscout.interfaces.ui.ActivityNames;
import info.nightscout.interfaces.utils.DecimalFormatter;
import info.nightscout.interfaces.utils.Round;
import info.nightscout.interfaces.utils.TimeChangeType;
import info.nightscout.pump.common.defs.TempBasalPair;
import info.nightscout.rx.AapsSchedulers;
import info.nightscout.rx.bus.RxBus;
import info.nightscout.rx.events.EventAppExit;
@ -1079,17 +1079,17 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@NonNull @Override public PumpEnactResult setExtendedBolus(double insulin, int durationInMinutes) {
aapsLogger.debug(LTag.PUMP, "setExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
return getOperationNotSupportedWithCustomText(info.nightscout.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
}
@NonNull @Override public PumpEnactResult cancelExtendedBolus() {
aapsLogger.debug(LTag.PUMP, "cancelExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
return getOperationNotSupportedWithCustomText(info.nightscout.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
}
@NonNull @Override public PumpEnactResult loadTDDs() {
aapsLogger.debug(LTag.PUMP, "loadTDDs [OmnipodPumpPlugin] - Not implemented.");
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
return getOperationNotSupportedWithCustomText(info.nightscout.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
}
@Override

View file

@ -5,8 +5,8 @@ import androidx.annotation.StringRes;
import java.util.HashMap;
import java.util.Map;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup;
/**
* Created by andy on 24.11.2019

View file

@ -14,7 +14,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.OmnipodErosStorageKeys;
@ -71,6 +70,7 @@ 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.common.defs.TempBasalPair;
import info.nightscout.pump.core.utils.ByteUtil;
import info.nightscout.rx.AapsSchedulers;
import info.nightscout.rx.bus.RxBus;

View file

@ -22,9 +22,6 @@ import java.util.List;
import javax.inject.Inject;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
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;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.PodHistoryEntryType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory;
@ -33,6 +30,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil
import info.nightscout.core.activities.NoSplashAppCompatActivity;
import info.nightscout.interfaces.profile.Profile;
import info.nightscout.interfaces.pump.defs.PumpType;
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.pump.common.defs.TempBasalPair;
import info.nightscout.pump.common.utils.ProfileUtil;
import info.nightscout.rx.logging.AAPSLogger;
import info.nightscout.rx.logging.LTag;
import info.nightscout.shared.interfaces.ResourceHelper;

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
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.plugin.ActivePlugin
@ -13,6 +12,7 @@ import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.common.defs.TempBasalPair
import info.nightscout.rx.TestAapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -12,11 +12,10 @@ apply from: "${project.rootDir}/core/core-main/allopen_dependencies.gradle"
apply from: "${project.rootDir}/core/core-main/test_dependencies.gradle"
apply from: "${project.rootDir}/core/core-main/jacoco_global.gradle"
android {
namespace 'info.nightscout.androidaps.plugins.pump.common'
namespace 'info.nightscout.pump.common'
}
dependencies {
implementation project(':core:core-main')
implementation project(':core:interfaces')
implementation project(':core:utils')
implementation project(':app-wear-shared:shared')

View file

@ -1,11 +0,0 @@
package info.nightscout.androidaps.plugins.pump.common.driver
import info.nightscout.androidaps.plugins.pump.common.driver.history.PumpHistoryDataProvider
interface PumpDriverConfiguration {
fun getPumpBLESelector(): PumpBLESelector
fun getPumpHistoryDataProvider(): PumpHistoryDataProvider
}

View file

@ -1,4 +0,0 @@
package info.nightscout.androidaps.plugins.pump.common.driver.history
interface PumpDataConverter {
}

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common
package info.nightscout.pump.common
import android.content.Context
import android.content.Intent
@ -6,10 +6,6 @@ import android.content.ServiceConnection
import android.text.format.DateFormat
import com.google.gson.GsonBuilder
import dagger.android.HasAndroidInjector
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
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.plugin.ActivePlugin
@ -27,6 +23,10 @@ import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.utils.DecimalFormatter.to0Decimal
import info.nightscout.interfaces.utils.DecimalFormatter.to2Decimal
import info.nightscout.pump.common.data.PumpStatus
import info.nightscout.pump.common.defs.PumpDriverState
import info.nightscout.pump.common.sync.PumpDbEntryCarbs
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
@ -61,7 +61,7 @@ abstract class PumpPluginAbstract protected constructor(
var aapsSchedulers: AapsSchedulers,
var pumpSync: PumpSync,
var pumpSyncStorage: PumpSyncStorage
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, Constraints, info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator {
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, Constraints, info.nightscout.pump.common.sync.PumpSyncEntriesCreator {
protected val disposable = CompositeDisposable()

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.ble
package info.nightscout.pump.common.ble
import android.bluetooth.BluetoothDevice
import android.content.Context
@ -6,8 +6,8 @@ import android.content.Intent
import androidx.annotation.StringRes
import com.google.gson.Gson
import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.plugins.pump.common.events.EventPumpConnectionParametersChanged
import info.nightscout.core.utils.extensions.safeGetParcelableExtra
import info.nightscout.pump.common.events.EventPumpConnectionParametersChanged
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.common.data
package info.nightscout.pump.common.data
import info.nightscout.androidaps.plugins.pump.common.defs.PumpRunningState
import info.nightscout.interfaces.pump.defs.PumpType
import java.util.*
import info.nightscout.pump.common.defs.PumpRunningState
import java.util.Date
/**
* Created by andy on 4/28/18.

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.data
package info.nightscout.pump.common.data
import org.joda.time.DateTime
import org.joda.time.Seconds

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.defs;
package info.nightscout.pump.common.defs;
/**
* Created by andy on 1/20/19.

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.pump.common.R
// TODO there are 3 classes now, that do similar things, sort of, need to define exact rules: PumpDeviceState, PumpDriverState, PumpStatusState

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.pump.common.R
import info.nightscout.shared.interfaces.ResourceHelper
import kotlin.streams.toList

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
// TODO there are 3 classes now, that do similar things, sort of, need to define exact rules: PumpDeviceState, PumpDriverState, PumpStatusState

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
enum class PumpStatusType(val status: String) {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
enum class PumpTypeGroupConfig {
All,

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
import java.util.*
import java.util.Arrays
enum class PumpUpdateFragmentType {
None,

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.defs
package info.nightscout.pump.common.defs
import com.google.gson.annotations.Expose

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.common.di
package info.nightscout.pump.common.di
import dagger.Module
import dagger.Provides
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Singleton

View file

@ -0,0 +1,12 @@
package info.nightscout.pump.common.driver
import info.nightscout.pump.common.driver.ble.PumpBLESelector
import info.nightscout.pump.common.driver.history.PumpHistoryDataProvider
interface PumpDriverConfiguration {
fun getPumpBLESelector(): PumpBLESelector
fun getPumpHistoryDataProvider(): PumpHistoryDataProvider
}

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.driver
package info.nightscout.pump.common.driver
interface PumpDriverConfigurationCapable {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.driver
package info.nightscout.pump.common.driver.ble
import android.bluetooth.BluetoothDevice
import android.bluetooth.le.ScanFilter

View file

@ -1,16 +1,15 @@
package info.nightscout.androidaps.plugins.pump.common.driver.ble
package info.nightscout.pump.common.driver.ble
import android.bluetooth.BluetoothDevice
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanSettings
import android.content.Context
import android.widget.Toast
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.androidaps.plugins.pump.common.driver.PumpBLESelector
import info.nightscout.pump.common.R
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
abstract class PumpBLESelectorAbstract constructor(

View file

@ -0,0 +1,4 @@
package info.nightscout.pump.common.driver.history
interface PumpDataConverter {
}

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.common.driver.history
package info.nightscout.pump.common.driver.history
import androidx.annotation.StringRes
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.pump.common.R
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
interface PumpHistoryDataProvider {

View file

@ -1,7 +1,8 @@
package info.nightscout.androidaps.plugins.pump.common.driver.history
package info.nightscout.pump.common.driver.history
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import java.util.*
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
import java.util.Calendar
import java.util.GregorianCalendar
abstract class PumpHistoryDataProviderAbstract : PumpHistoryDataProvider {

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.driver.history
package info.nightscout.pump.common.driver.history
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.shared.interfaces.ResourceHelper
interface PumpHistoryEntry {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.events
package info.nightscout.pump.common.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.events
package info.nightscout.pump.common.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.events
package info.nightscout.pump.common.events
import info.nightscout.rx.events.Event

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.events
package info.nightscout.pump.common.events
import info.nightscout.androidaps.plugins.pump.common.defs.PumpUpdateFragmentType
import info.nightscout.pump.common.defs.PumpUpdateFragmentType
import info.nightscout.rx.events.Event
class EventPumpFragmentValuesChanged : Event {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.sync
package info.nightscout.pump.common.sync
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpSync
@ -77,7 +77,8 @@ data class PumpDbEntryCarbs(var date: Long,
var pumpId: Long? = null) {
constructor(detailedBolusInfo: DetailedBolusInfo,
creator: PumpSyncEntriesCreator) : this(detailedBolusInfo.timestamp,
creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator
) : this(detailedBolusInfo.timestamp,
detailedBolusInfo.carbs,
creator.model(),
creator.serialNumber())

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.sync;
package info.nightscout.pump.common.sync;
import info.nightscout.interfaces.pump.defs.PumpType;

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.sync
package info.nightscout.pump.common.sync
import com.thoughtworks.xstream.XStream
import com.thoughtworks.xstream.security.AnyTypePermission
@ -108,7 +108,7 @@ class PumpSyncStorage @Inject constructor(
return pumpSyncStorageTBR
}
fun addBolusWithTempId(detailedBolusInfo: DetailedBolusInfo, writeToInternalHistory: Boolean, creator: PumpSyncEntriesCreator): Boolean {
fun addBolusWithTempId(detailedBolusInfo: DetailedBolusInfo, writeToInternalHistory: Boolean, creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator): Boolean {
val temporaryId = creator.generateTempId(detailedBolusInfo.timestamp)
val result = pumpSync.addBolusWithTempId(
detailedBolusInfo.timestamp,
@ -155,7 +155,7 @@ class PumpSyncStorage @Inject constructor(
"carbs=${carbsDto.carbs}, pumpSerial=${carbsDto.serialNumber}] - Result: $result")
}
fun addTemporaryBasalRateWithTempId(temporaryBasal: PumpDbEntryTBR, writeToInternalHistory: Boolean, creator: PumpSyncEntriesCreator): Boolean {
fun addTemporaryBasalRateWithTempId(temporaryBasal: PumpDbEntryTBR, writeToInternalHistory: Boolean, creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator): Boolean {
val timeNow: Long = System.currentTimeMillis()
val temporaryId = creator.generateTempId(timeNow)

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.ui
package info.nightscout.pump.common.ui
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
@ -21,18 +21,17 @@ import android.widget.AdapterView.OnItemClickListener
import android.widget.BaseAdapter
import android.widget.TextView
import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.plugins.pump.common.databinding.PumpBleConfigActivityBinding
import info.nightscout.androidaps.plugins.pump.common.driver.PumpBLESelector
import info.nightscout.androidaps.plugins.pump.common.driver.PumpBLESelectorText
import info.nightscout.androidaps.plugins.pump.common.driver.PumpDriverConfigurationCapable
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.pump.common.R
import info.nightscout.pump.common.databinding.PumpBleConfigActivityBinding
import info.nightscout.pump.common.driver.PumpDriverConfigurationCapable
import info.nightscout.pump.common.driver.ble.PumpBLESelector
import info.nightscout.pump.common.driver.ble.PumpBLESelectorText
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 org.apache.commons.lang3.StringUtils
import javax.inject.Inject
@ -40,7 +39,6 @@ import javax.inject.Inject
@SuppressLint("MissingPermission")
class PumpBLEConfigActivity : DaggerAppCompatActivity() {
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var sp: SP
@Inject lateinit var blePreCheck: BlePreCheck

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.ui
package info.nightscout.pump.common.ui
import android.content.Context
import android.os.Bundle
@ -12,14 +12,14 @@ import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.androidaps.plugins.pump.common.R
import info.nightscout.androidaps.plugins.pump.common.databinding.PumpHistoryActivityBinding
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.androidaps.plugins.pump.common.driver.PumpDriverConfigurationCapable
import info.nightscout.androidaps.plugins.pump.common.driver.history.PumpHistoryDataProvider
import info.nightscout.androidaps.plugins.pump.common.driver.history.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.common.driver.history.PumpHistoryText
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.pump.common.R
import info.nightscout.pump.common.databinding.PumpHistoryActivityBinding
import info.nightscout.pump.common.defs.PumpHistoryEntryGroup
import info.nightscout.pump.common.driver.PumpDriverConfigurationCapable
import info.nightscout.pump.common.driver.history.PumpHistoryDataProvider
import info.nightscout.pump.common.driver.history.PumpHistoryEntry
import info.nightscout.pump.common.driver.history.PumpHistoryText
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.common.utils
package info.nightscout.pump.common.utils
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.Profile.ProfileValue

View file

@ -39,9 +39,9 @@
<TextView
android:id="@+id/pump_history_text"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_gravity="end"
android:layout_marginEnd="20dp"
android:layout_weight="1"
android:background="@drawable/pillborder"

View file

@ -27,7 +27,6 @@ import android.widget.TextView
import android.widget.Toast
import androidx.core.app.ActivityCompat
import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
@ -36,6 +35,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.databinding.R
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.BlePreCheck
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -2,17 +2,16 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task
import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.pump.defs.ManufacturerType
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.interfaces.pump.defs.ManufacturerType
import info.nightscout.interfaces.utils.Round.isSame
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
import kotlin.math.roundToLong