DanaRInterface rename

This commit is contained in:
Milos Kozak 2021-04-14 19:03:50 +02:00
parent 176fc4bb47
commit 6ac01a26cd
7 changed files with 17 additions and 14 deletions

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePlugin 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.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import javax.inject.Inject import javax.inject.Inject
@ -16,8 +16,8 @@ class CommandLoadEvents(
override fun execute() { override fun execute() {
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (pump is DanaRInterface) { if (pump is Dana) {
val danaPump = pump as DanaRInterface val danaPump = pump as Dana
val r = danaPump.loadEvents() val r = danaPump.loadEvents()
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}") aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
callback?.result(r)?.run() callback?.result(r)?.run()

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePlugin 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.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import javax.inject.Inject import javax.inject.Inject
@ -17,8 +17,8 @@ class CommandLoadHistory(
override fun execute() { override fun execute() {
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (pump is DanaRInterface) { if (pump is Dana) {
val danaPump = pump as DanaRInterface val danaPump = pump as Dana
val r = danaPump.loadHistory(type) val r = danaPump.loadHistory(type)
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: " + r.success + " enacted: " + r.enacted) aapsLogger.debug(LTag.PUMPQUEUE, "Result success: " + r.success + " enacted: " + r.enacted)
callback?.result(r)?.run() callback?.result(r)?.run()

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePlugin 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.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import javax.inject.Inject import javax.inject.Inject
@ -16,7 +16,7 @@ class CommandSetUserSettings(
override fun execute() { override fun execute() {
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (pump is DanaRInterface) { if (pump is Dana) {
val r = pump.setUserOptions() val r = pump.setUserOptions()
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}") aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
callback?.result(r)?.run() callback?.result(r)?.run()

View file

@ -2,7 +2,10 @@ package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.PumpEnactResult 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 loadHistory(type: Byte): PumpEnactResult // for history browser
fun loadEvents(): PumpEnactResult // events history to build treatments from fun loadEvents(): PumpEnactResult // events history to build treatments from

View file

@ -32,7 +32,7 @@ import info.nightscout.androidaps.utils.userEntry.UserEntryMapper.Sources
import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.toVisibility 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.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -112,7 +112,7 @@ class DanaFragment : DaggerFragment() {
activity?.let { activity?.let {
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) { OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) {
uel.log(Action.CLEAR_PAIRING_KEYS, Sources.Dana) uel.log(Action.CLEAR_PAIRING_KEYS, Sources.Dana)
(activePlugin.activePump as DanaRInterface).clearPairing() (activePlugin.activePump as Dana).clearPairing()
} }
} }
true true

View file

@ -19,7 +19,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.Constraints; 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.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;
@ -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, DanaRInterface, Constraints { public abstract class AbstractDanaRPlugin extends PumpPluginBase implements PumpInterface, Dana, Constraints {
protected AbstractDanaRExecutionService sExecutionService; protected AbstractDanaRExecutionService sExecutionService;
protected CompositeDisposable disposable = new CompositeDisposable(); protected CompositeDisposable disposable = new CompositeDisposable();

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, DanaRInterface, Constraints { ), PumpInterface, Dana, Constraints {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
private var danaRSService: DanaRSService? = null private var danaRSService: DanaRSService? = null