diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt index 22217ab614..f959eff033 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.DanaRInterface +import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -16,8 +16,8 @@ class CommandLoadEvents( override fun execute() { val pump = activePlugin.activePump - if (pump is DanaRInterface) { - val danaPump = pump as DanaRInterface + if (pump is Dana) { + val danaPump = pump as Dana val r = danaPump.loadEvents() aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}") callback?.result(r)?.run() diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt index d6980d70c4..431b4fe12e 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.DanaRInterface +import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -17,8 +17,8 @@ class CommandLoadHistory( override fun execute() { val pump = activePlugin.activePump - if (pump is DanaRInterface) { - val danaPump = pump as DanaRInterface + if (pump is Dana) { + val danaPump = pump as Dana val r = danaPump.loadHistory(type) aapsLogger.debug(LTag.PUMPQUEUE, "Result success: " + r.success + " enacted: " + r.enacted) callback?.result(r)?.run() diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt index 4b2fc760e6..abefe7e00e 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.DanaRInterface +import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.queue.Callback import javax.inject.Inject @@ -16,7 +16,7 @@ class CommandSetUserSettings( override fun execute() { val pump = activePlugin.activePump - if (pump is DanaRInterface) { + if (pump is Dana) { val r = pump.setUserOptions() aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}") callback?.result(r)?.run() diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Dana.kt similarity index 83% rename from core/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/Dana.kt index ec2170614d..f2ba34e703 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Dana.kt @@ -2,7 +2,10 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.data.PumpEnactResult -interface DanaRInterface { +/** + * Functionality supported by Dana* pumps only + */ +interface Dana { fun loadHistory(type: Byte): PumpEnactResult // for history browser fun loadEvents(): PumpEnactResult // events history to build treatments from diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt index 2c93443d2d..34968ff475 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt @@ -32,7 +32,7 @@ import info.nightscout.androidaps.utils.userEntry.UserEntryMapper.Sources import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.extensions.toVisibility -import info.nightscout.androidaps.interfaces.DanaRInterface +import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.sharedPreferences.SP @@ -112,7 +112,7 @@ class DanaFragment : DaggerFragment() { activity?.let { OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) { uel.log(Action.CLEAR_PAIRING_KEYS, Sources.Dana) - (activePlugin.activePump as DanaRInterface).clearPairing() + (activePlugin.activePump as Dana).clearPairing() } } true diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index e879369df9..3f29f11fc6 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -19,7 +19,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraints; -import info.nightscout.androidaps.interfaces.DanaRInterface; +import info.nightscout.androidaps.interfaces.Dana; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PumpDescription; @@ -46,7 +46,7 @@ import io.reactivex.disposables.CompositeDisposable; * Created by mike on 28.01.2018. */ -public abstract class AbstractDanaRPlugin extends PumpPluginBase implements PumpInterface, DanaRInterface, Constraints { +public abstract class AbstractDanaRPlugin extends PumpPluginBase implements PumpInterface, Dana, Constraints { protected AbstractDanaRExecutionService sExecutionService; protected CompositeDisposable disposable = new CompositeDisposable(); diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 002cc2d636..ca289a8757 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -71,7 +71,7 @@ class DanaRSPlugin @Inject constructor( .preferencesId(R.xml.pref_danars) .description(R.string.description_pump_dana_rs), injector, aapsLogger, resourceHelper, commandQueue -), PumpInterface, DanaRInterface, Constraints { +), PumpInterface, Dana, Constraints { private val disposable = CompositeDisposable() private var danaRSService: DanaRSService? = null