PumpInterface rename

This commit is contained in:
Milos Kozak 2021-04-14 19:36:13 +02:00
parent eacdbffebc
commit 24164eee98
26 changed files with 161 additions and 64 deletions

View file

@ -186,7 +186,7 @@ class ConfigBuilderPlugin @Inject constructor(
PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileInterface::class.java) PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileInterface::class.java)
PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java) PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java)
PluginType.TREATMENT -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(TreatmentsInterface::class.java) PluginType.TREATMENT -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(TreatmentsInterface::class.java)
PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(PumpInterface::class.java) PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Pump::class.java)
else -> { else -> {
} }

View file

@ -16,7 +16,7 @@ class PluginStore @Inject constructor(
lateinit var plugins: List<@JvmSuppressWildcards PluginBase> lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
private var activeBgSourceStore: BgSource? = null private var activeBgSourceStore: BgSource? = null
private var activePumpStore: PumpInterface? = null private var activePumpStore: Pump? = null
private var activeProfile: ProfileInterface? = null private var activeProfile: ProfileInterface? = null
private var activeAPSStore: APS? = null private var activeAPSStore: APS? = null
private var activeInsulinStore: Insulin? = null private var activeInsulinStore: Insulin? = null
@ -114,9 +114,9 @@ class PluginStore @Inject constructor(
// PluginType.PUMP // PluginType.PUMP
pluginsInCategory = getSpecificPluginsList(PluginType.PUMP) pluginsInCategory = getSpecificPluginsList(PluginType.PUMP)
activePumpStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.PUMP) as PumpInterface? activePumpStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.PUMP) as Pump?
if (activePumpStore == null) { if (activePumpStore == null) {
activePumpStore = getDefaultPlugin(PluginType.PUMP) as PumpInterface activePumpStore = getDefaultPlugin(PluginType.PUMP) as Pump
(activePumpStore as PluginBase).setPluginEnabled(PluginType.PUMP, true) (activePumpStore as PluginBase).setPluginEnabled(PluginType.PUMP, true)
aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface") aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface")
} }
@ -168,7 +168,7 @@ class PluginStore @Inject constructor(
override val activeAPS: APS override val activeAPS: APS
get() = activeAPSStore ?: checkNotNull(activeAPSStore) { "No APS selected" } get() = activeAPSStore ?: checkNotNull(activeAPSStore) { "No APS selected" }
override val activePump: PumpInterface override val activePump: Pump
get() = activePumpStore ?: checkNotNull(activePumpStore) { "No pump selected" } get() = activePumpStore ?: checkNotNull(activePumpStore) { "No pump selected" }
override val activeSensitivity: Sensitivity override val activeSensitivity: Sensitivity

View file

@ -815,7 +815,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
} ?: "" } ?: ""
} }
private fun updateGraph(lastRun: LoopInterface.LastRun?, predictionsAvailable: Boolean, lowLine: Double, highLine: Double, pump: PumpInterface, profile: Profile) { private fun updateGraph(lastRun: LoopInterface.LastRun?, predictionsAvailable: Boolean, lowLine: Double, highLine: Double, pump: Pump, profile: Profile) {
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.Main) { viewLifecycleOwner.lifecycleScope.launch(Dispatchers.Main) {
if (_binding == null) return@launch if (_binding == null) return@launch
val menuChartSettings = overviewMenus.setting val menuChartSettings = overviewMenus.setting

View file

@ -33,7 +33,7 @@ class MDIPlugin @Inject constructor(
.pluginName(R.string.mdi) .pluginName(R.string.mdi)
.description(R.string.description_pump_mdi), .description(R.string.description_pump_mdi),
injector, aapsLogger, resourceHelper, commandQueue injector, aapsLogger, resourceHelper, commandQueue
), PumpInterface { ), Pump {
override val pumpDescription = PumpDescription() override val pumpDescription = PumpDescription()

View file

@ -63,7 +63,7 @@ open class VirtualPumpPlugin @Inject constructor(
.description(R.string.description_pump_virtual) .description(R.string.description_pump_virtual)
.setDefault(), .setDefault(),
injector, aapsLogger, resourceHelper, commandQueue injector, aapsLogger, resourceHelper, commandQueue
), PumpInterface { ), Pump {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
var batteryPercent = 50 var batteryPercent = 50

View file

@ -5,7 +5,7 @@ import android.content.Intent
import com.google.gson.Gson import com.google.gson.Gson
import dagger.android.DaggerBroadcastReceiver import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.BundleLogger import info.nightscout.androidaps.logging.BundleLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
@ -37,7 +37,7 @@ class TimeDateOrTZChangeReceiver : DaggerBroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent) super.onReceive(context, intent)
val action = intent.action val action = intent.action
val activePump: PumpInterface = activePlugin.activePump val activePump: Pump = activePlugin.activePump
aapsLogger.debug(LTag.PUMP, "TimeDateOrTZChangeReceiver::Date, Time and/or TimeZone changed. [action={}]", action) aapsLogger.debug(LTag.PUMP, "TimeDateOrTZChangeReceiver::Date, Time and/or TimeZone changed. [action={}]", action)
aapsLogger.debug(LTag.PUMP, "TimeDateOrTZChangeReceiver::Intent::{}", BundleLogger.log(intent.extras)) aapsLogger.debug(LTag.PUMP, "TimeDateOrTZChangeReceiver::Intent::{}", BundleLogger.log(intent.extras))

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.utils.extensions package info.nightscout.androidaps.utils.extensions
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.DecimalFormatter
fun Double.toSignedString(pump: PumpInterface): String { fun Double.toSignedString(pump: Pump): String {
val formatted = DecimalFormatter.toPumpSupportedBolus(this, pump) val formatted = DecimalFormatter.toPumpSupportedBolus(this, pump)
return if (this > 0) "+$formatted" else formatted return if (this > 0) "+$formatted" else formatted
} }

View file

@ -5,7 +5,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.plugins.common.ManufacturerType
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.TimeChangeType
import org.json.JSONObject import org.json.JSONObject
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
class TestPumpPlugin(val injector: HasAndroidInjector) : PumpInterface { class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
var connected = false var connected = false
var isProfileSet = true var isProfileSet = true

View file

@ -7,7 +7,7 @@ import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginDescription
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.plugins.common.ManufacturerType
@ -23,7 +23,7 @@ class TestPumpPlugin(pluginDescription: PluginDescription,
injector: HasAndroidInjector injector: HasAndroidInjector
) : PluginBase( ) : PluginBase(
pluginDescription, aapsLogger, resourceHelper, injector pluginDescription, aapsLogger, resourceHelper, injector
), PumpInterface { ), Pump {
var connected = false var connected = false
var isProfileSet = true var isProfileSet = true

View file

@ -37,7 +37,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -72,7 +72,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
* Created by mike on 05.08.2016. * Created by mike on 05.08.2016.
*/ */
@Singleton @Singleton
public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constraints { public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
static final String COMBO_TBRS_SET = "combo_tbrs_set"; static final String COMBO_TBRS_SET = "combo_tbrs_set";
static final String COMBO_BOLUSES_DELIVERED = "combo_boluses_delivered"; static final String COMBO_BOLUSES_DELIVERED = "combo_boluses_delivered";

View file

@ -20,7 +20,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.Config; import info.nightscout.androidaps.interfaces.Config;
import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
@ -245,7 +245,7 @@ public class Profile {
if (isValid) { if (isValid) {
// Check for hours alignment // Check for hours alignment
PumpInterface pump = activePlugin.getActivePump(); Pump pump = activePlugin.getActivePump();
if (!pump.getPumpDescription().is30minBasalRatesCapable()) { if (!pump.getPumpDescription().is30minBasalRatesCapable()) {
for (int index = 0; index < basal_v.size(); index++) { for (int index = 0; index < basal_v.size(); index++) {
long secondsFromMidnight = basal_v.keyAt(index); long secondsFromMidnight = basal_v.keyAt(index);

View file

@ -5,7 +5,7 @@ import info.nightscout.androidaps.database.entities.DeviceStatus
import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.LoopInterface import info.nightscout.androidaps.interfaces.LoopInterface
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
@ -31,7 +31,7 @@ fun buildDeviceStatus(
loopPlugin: LoopInterface, loopPlugin: LoopInterface,
iobCobCalculatorPlugin: IobCobCalculator, iobCobCalculatorPlugin: IobCobCalculator,
profileFunction: ProfileFunction, profileFunction: ProfileFunction,
pumpInterface: PumpInterface, pump: Pump,
receiverStatusStore: ReceiverStatusStore, receiverStatusStore: ReceiverStatusStore,
runningConfiguration: RunningConfiguration, runningConfiguration: RunningConfiguration,
version: String version: String
@ -78,7 +78,7 @@ fun buildDeviceStatus(
iob = iob?.toString(), iob = iob?.toString(),
enacted = enacted?.toString(), enacted = enacted?.toString(),
device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL, device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL,
pump = pumpInterface.getJSONStatus(profile, profileName, version).toString(), pump = pump.getJSONStatus(profile, profileName, version).toString(),
uploaderBattery = receiverStatusStore.batteryLevel, uploaderBattery = receiverStatusStore.batteryLevel,
configuration = runningConfiguration.configuration().toString() configuration = runningConfiguration.configuration().toString()
) )

View file

@ -32,7 +32,7 @@ interface ActivePlugin {
* Currently selected Pump plugin * Currently selected Pump plugin
* Default VirtualPump * Default VirtualPump
*/ */
val activePump: PumpInterface val activePump: Pump
/** /**
* Currently selected Sensitivity plugin * Currently selected Sensitivity plugin

View file

@ -17,29 +17,104 @@ import org.json.JSONObject
* *
* Created by mike on 04.06.2016. * Created by mike on 04.06.2016.
*/ */
interface PumpInterface { interface Pump {
fun isInitialized(): Boolean // true if pump status has been read and is ready to accept commands /**
fun isSuspended(): Boolean // true if suspended (not delivering insulin) * @return true if pump status has been read and is ready to accept commands
fun isBusy(): Boolean // if true pump is not ready to accept commands right now */
fun isConnected(): Boolean // true if BT connection is established fun isInitialized(): Boolean
fun isConnecting(): Boolean // true if BT connection is in progress
fun isHandshakeInProgress(): Boolean // true if BT is connected but initial handshake is still in progress /**
@JvmDefault fun finishHandshaking() {} // set initial handshake completed * @return true if suspended (not delivering insulin)
*/
fun isSuspended(): Boolean
/**
* @return true if pump is not ready to accept commands right now
*/
fun isBusy(): Boolean
/**
* @return true if BT connection is established
*/
fun isConnected(): Boolean
/**
* @return true if BT connection is in progress
*/
fun isConnecting(): Boolean
/**
* @return true if BT is connected but initial handshake is still in progress
*/
fun isHandshakeInProgress(): Boolean
/**
* set initial handshake completed (moved to connected state)
*/
@JvmDefault fun finishHandshaking() {}
/**
* Perform BT connect, there is new command waiting in queue
* @param reason originator identification
*/
fun connect(reason: String) fun connect(reason: String)
/**
* Perform BT disconnect, there is NO command waiting in queue
* @param reason originator identification
*/
fun disconnect(reason: String) fun disconnect(reason: String)
@JvmDefault fun waitForDisconnectionInSeconds(): Int = 5 // wait [x] second after last command before sending disconnect
/**
* @return # of second to wait before [disconnect] is send after last command
*/
@JvmDefault fun waitForDisconnectionInSeconds(): Int = 5
/**
* Stop connection process
*/
fun stopConnecting() fun stopConnecting()
/**
* Force reading of full pump status
* @param reason originator identification
*/
fun getPumpStatus(reason: String) fun getPumpStatus(reason: String)
// Upload to pump new basal profile /**
* Upload to pump new basal profile (and IC/ISF if supported by pump)
*
* @param profile new profile
*/
fun setNewBasalProfile(profile: Profile): PumpEnactResult fun setNewBasalProfile(profile: Profile): PumpEnactResult
/**
* @param profile profile to check
*
* @return true if pump is running the same profile as in param
*/
fun isThisProfileSet(profile: Profile): Boolean fun isThisProfileSet(profile: Profile): Boolean
/**
* @return timestamp of last connection to the pump
*/
fun lastDataTime(): Long fun lastDataTime(): Long
val baseBasalRate: Double // base basal rate, not temp basal /**
* Currently running base basal rate [U/h]
*/
val baseBasalRate: Double
/**
* Reservoir level at time of last connection [Units of insulin]
*/
val reservoirLevel: Double val reservoirLevel: Double
val batteryLevel: Int // in percent as integer
/**
* Battery level at time of last connection [%]
*/
val batteryLevel: Int
/** /**
* Request a bolus to be delivered, carbs to be stored on pump or both. * Request a bolus to be delivered, carbs to be stored on pump or both.
@ -137,13 +212,30 @@ interface PumpInterface {
*/ */
fun serialNumber(): String fun serialNumber(): String
// Pump capabilities /**
* Pump capabilities
*/
val pumpDescription: PumpDescription val pumpDescription: PumpDescription
// Short info for SMS, Wear etc /**
* Short info for SMS, Wear etc
*/
fun shortStatus(veryShort: Boolean): String fun shortStatus(veryShort: Boolean): String
/**
* @return true if pump is currently emulating temporary basals by extended boluses (usually to bypass 200% limit)
*/
val isFakingTempsByExtendedBoluses: Boolean val isFakingTempsByExtendedBoluses: Boolean
/**
* Load TDDs and store them to the database
*/
fun loadTDDs(): PumpEnactResult fun loadTDDs(): PumpEnactResult
/**
* @return true if pump handles DST changes by it self. In this case it's not necessary stop the loop
* after DST change
*/
fun canHandleDST(): Boolean fun canHandleDST(): Boolean
/** /**
@ -176,9 +268,14 @@ interface PumpInterface {
*/ */
@JvmDefault fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {} @JvmDefault fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
/* Only used for pump types where hasCustomUnreachableAlertCheck=true */ /**
* Only used for pump types where hasCustomUnreachableAlertCheck=true
*/
@JvmDefault @JvmDefault
fun isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds: Long): Boolean = false fun isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds: Long): Boolean = false
/**
* if true APS set 100% basal before full hour to avoid pump beeping
*/
@JvmDefault fun setNeutralTempAtFullHour(): Boolean = false @JvmDefault fun setNeutralTempAtFullHour(): Boolean = false
} }

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.utils package info.nightscout.androidaps.utils
import info.nightscout.androidaps.core.R import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import java.text.DecimalFormat import java.text.DecimalFormat
@ -20,7 +20,7 @@ object DecimalFormatter {
fun to2Decimal(value: Double, unit: String): String = format2dec.format(value) + unit fun to2Decimal(value: Double, unit: String): String = format2dec.format(value) + unit
fun to3Decimal(value: Double): String = format3dec.format(value) fun to3Decimal(value: Double): String = format3dec.format(value)
fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit
fun toPumpSupportedBolus(value: Double, pump: PumpInterface): String = if (pump.pumpDescription.bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value) fun toPumpSupportedBolus(value: Double, pump: Pump): String = if (pump.pumpDescription.bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value)
fun toPumpSupportedBolus(value: Double, pump: PumpInterface, resourceHelper: ResourceHelper): String = if (pump.pumpDescription.bolusStep <= 0.051) resourceHelper.gs(R.string.formatinsulinunits, value) else resourceHelper.gs(R.string.formatinsulinunits1, value) fun toPumpSupportedBolus(value: Double, pump: Pump, resourceHelper: ResourceHelper): String = if (pump.pumpDescription.bolusStep <= 0.051) resourceHelper.gs(R.string.formatinsulinunits, value) else resourceHelper.gs(R.string.formatinsulinunits1, value)
fun pumpSupportedBolusFormat(pump: PumpInterface): DecimalFormat = if (pump.pumpDescription.bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0") fun pumpSupportedBolusFormat(pump: Pump): DecimalFormat = if (pump.pumpDescription.bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0")
} }

View file

@ -5,7 +5,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.plugins.common.ManufacturerType
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.TimeChangeType
import org.json.JSONObject import org.json.JSONObject
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
class TestPumpPlugin(val injector: HasAndroidInjector) : PumpInterface { class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
var connected = false var connected = false
var isProfileSet = true var isProfileSet = true

View file

@ -17,7 +17,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.events.EventTempBasalChange import info.nightscout.androidaps.events.EventTempBasalChange
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.logging.UserEntryLogger
@ -189,7 +189,7 @@ class DanaFragment : DaggerFragment() {
fun updateGUI() { fun updateGUI() {
if (_binding == null) return if (_binding == null) return
val pump = danaPump val pump = danaPump
val plugin: PumpInterface = activePlugin.activePump val plugin: Pump = activePlugin.activePump
if (pump.lastConnection != 0L) { if (pump.lastConnection != 0L) {
val agoMsec = System.currentTimeMillis() - pump.lastConnection val agoMsec = System.currentTimeMillis() - pump.lastConnection
val agoMin = (agoMsec.toDouble() / 60.0 / 1000.0).toInt() val agoMin = (agoMsec.toDouble() / 60.0 / 1000.0).toInt()

View file

@ -58,7 +58,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
@ -168,7 +168,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
danaPump.setLastConnection(System.currentTimeMillis()); danaPump.setLastConnection(System.currentTimeMillis());
Profile profile = profileFunction.getProfile(); Profile profile = profileFunction.getProfile();
PumpInterface pump = activePlugin.getActivePump(); Pump pump = activePlugin.getActivePump();
if (profile != null && Math.abs(danaPump.getCurrentBasal() - profile.getBasal()) >= pump.getPumpDescription().getBasalStep()) { if (profile != null && Math.abs(danaPump.getCurrentBasal() - profile.getBasal()) >= pump.getPumpDescription().getBasalStep()) {
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings))); rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal(injector)); mSerialIOThread.sendMessage(new MsgSettingBasal(injector));

View file

@ -23,7 +23,7 @@ import info.nightscout.androidaps.interfaces.Dana;
import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -46,7 +46,7 @@ import io.reactivex.disposables.CompositeDisposable;
* Created by mike on 28.01.2018. * Created by mike on 28.01.2018.
*/ */
public abstract class AbstractDanaRPlugin extends PumpPluginBase implements PumpInterface, Dana, Constraints { public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump, Dana, Constraints {
protected AbstractDanaRExecutionService sExecutionService; protected AbstractDanaRExecutionService sExecutionService;
protected CompositeDisposable disposable = new CompositeDisposable(); protected CompositeDisposable disposable = new CompositeDisposable();

View file

@ -5,7 +5,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpInterface import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.plugins.common.ManufacturerType
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.TimeChangeType
import org.json.JSONObject import org.json.JSONObject
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
class TestPumpPlugin(val injector: HasAndroidInjector) : PumpInterface { class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
var connected = false var connected = false
var isProfileSet = true var isProfileSet = true

View file

@ -71,7 +71,7 @@ class DanaRSPlugin @Inject constructor(
.preferencesId(R.xml.pref_danars) .preferencesId(R.xml.pref_danars)
.description(R.string.description_pump_dana_rs), .description(R.string.description_pump_dana_rs),
injector, aapsLogger, resourceHelper, commandQueue injector, aapsLogger, resourceHelper, commandQueue
), PumpInterface, Dana, Constraints { ), Pump, Dana, Constraints {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
private var danaRSService: DanaRSService? = null private var danaRSService: DanaRSService? = null

View file

@ -52,7 +52,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
@ -138,7 +138,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
@Singleton @Singleton
public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, Constraints, InsightConnectionService.StateCallback { public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constraints, InsightConnectionService.StateCallback {
private final AAPSLogger aapsLogger; private final AAPSLogger aapsLogger;
private final RxBusWrapper rxBus; private final RxBusWrapper rxBus;

View file

@ -25,7 +25,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraints; import info.nightscout.androidaps.interfaces.Constraints;
import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -50,7 +50,7 @@ import io.reactivex.disposables.CompositeDisposable;
// When using this class, make sure that your first step is to create mConnection (see MedtronicPumpPlugin) // When using this class, make sure that your first step is to create mConnection (see MedtronicPumpPlugin)
public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpInterface, Constraints { public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump, Constraints {
private final CompositeDisposable disposable = new CompositeDisposable(); private final CompositeDisposable disposable = new CompositeDisposable();
protected HasAndroidInjector injector; protected HasAndroidInjector injector;

View file

@ -39,7 +39,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
@ -97,7 +97,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
* @author Andy Rozman (andy.rozman@gmail.com) * @author Andy Rozman (andy.rozman@gmail.com)
*/ */
@Singleton @Singleton
public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInterface, RileyLinkPumpDevice { public class MedtronicPumpPlugin extends PumpPluginAbstract implements Pump, RileyLinkPumpDevice {
private final SP sp; private final SP sp;
private final MedtronicUtil medtronicUtil; private final MedtronicUtil medtronicUtil;

View file

@ -20,7 +20,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -35,7 +35,7 @@ import info.nightscout.androidaps.utils.TimeChangeType;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
@Singleton @Singleton
public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterface { public class OmnipodDashPumpPlugin extends PumpPluginBase implements Pump {
private static final PumpDescription PUMP_DESCRIPTION = new PumpDescription(PumpType.OMNIPOD_DASH); private static final PumpDescription PUMP_DESCRIPTION = new PumpDescription(PumpType.OMNIPOD_DASH);
private final AAPSLogger aapsLogger; private final AAPSLogger aapsLogger;

View file

@ -46,7 +46,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync; import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -116,7 +116,7 @@ import io.reactivex.disposables.CompositeDisposable;
* @author Andy Rozman (andy.rozman@gmail.com) * @author Andy Rozman (andy.rozman@gmail.com)
*/ */
@Singleton @Singleton
public class OmnipodErosPumpPlugin extends PumpPluginBase implements PumpInterface, RileyLinkPumpDevice { public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, RileyLinkPumpDevice {
private static final long RILEY_LINK_CONNECT_TIMEOUT_MILLIS = 3 * 60 * 1_000L; // 3 minutes private static final long RILEY_LINK_CONNECT_TIMEOUT_MILLIS = 3 * 60 * 1_000L; // 3 minutes
private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1_000L; // 1 minute private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1_000L; // 1 minute
public static final int STARTUP_STATUS_REQUEST_TRIES = 2; public static final int STARTUP_STATUS_REQUEST_TRIES = 2;