Callback -> kt
This commit is contained in:
parent
50a89a7890
commit
67ab3fc0df
|
@ -15,9 +15,10 @@ class CommandCustomCommand(
|
|||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
|
||||
override fun execute() {
|
||||
val result = activePlugin.activePump.executeCustomCommand(customCommand)
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${result?.success} enacted: ${result?.enacted}")
|
||||
callback?.result(result)?.run()
|
||||
activePlugin.activePump.executeCustomCommand(customCommand)?.let {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${it.success} enacted: ${it.enacted}")
|
||||
callback?.result(it)?.run()
|
||||
}
|
||||
}
|
||||
|
||||
override fun status(): String = customCommand.statusDescription
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package info.nightscout.androidaps.queue;
|
||||
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
|
||||
/**
|
||||
* Created by mike on 09.11.2017.
|
||||
*/
|
||||
public abstract class Callback implements Runnable {
|
||||
public PumpEnactResult result;
|
||||
|
||||
public Callback result(PumpEnactResult result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package info.nightscout.androidaps.queue
|
||||
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
|
||||
abstract class Callback : Runnable {
|
||||
|
||||
lateinit var result: PumpEnactResult
|
||||
fun result(result: PumpEnactResult): Callback {
|
||||
this.result = result
|
||||
return this
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue