EOPATCH: migrate to rx3
This commit is contained in:
parent
e42a21207b
commit
8fe336b3ce
67 changed files with 274 additions and 344 deletions
|
@ -323,7 +323,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
override fun cancelAllBoluses(id: Long) {
|
override fun cancelAllBoluses(id: Long?) {
|
||||||
if (!isRunning(CommandType.BOLUS)) {
|
if (!isRunning(CommandType.BOLUS)) {
|
||||||
rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), id))
|
rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), id))
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface CommandQueue {
|
||||||
fun independentConnect(reason: String, callback: Callback?)
|
fun independentConnect(reason: String, callback: Callback?)
|
||||||
fun bolusInQueue(): Boolean
|
fun bolusInQueue(): Boolean
|
||||||
fun bolus(detailedBolusInfo: DetailedBolusInfo, callback: Callback?): Boolean
|
fun bolus(detailedBolusInfo: DetailedBolusInfo, callback: Callback?): Boolean
|
||||||
fun cancelAllBoluses(id: Long)
|
fun cancelAllBoluses(id: Long?)
|
||||||
fun stopPump(callback: Callback?)
|
fun stopPump(callback: Callback?)
|
||||||
fun startPump(callback: Callback?)
|
fun startPump(callback: Callback?)
|
||||||
fun setTBROverNotification(callback: Callback?, enable: Boolean)
|
fun setTBROverNotification(callback: Callback?, enable: Boolean)
|
||||||
|
|
|
@ -10,28 +10,20 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/jacoco_global.gradle"
|
apply from: "${project.rootDir}/core/jacoco_global.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
namespace 'info.nightscout.androidaps.plugins.pump.eopatch'
|
||||||
dataBinding {
|
dataBinding {
|
||||||
enabled = true
|
enabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
flatDir {
|
|
||||||
dirs 'libs'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation (name: 'eopatch_core', ext: 'aar')
|
implementation (files("libs/eopatch_core.aar"))
|
||||||
// implementation (files("libs/eopatch_core.aar"))
|
|
||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
implementation project(':shared')
|
implementation project(':shared')
|
||||||
implementation project(':database')
|
implementation project(':database')
|
||||||
|
|
||||||
//RxAndroidBle
|
//RxAndroidBle
|
||||||
implementation "com.polidea.rxandroidble2:rxandroidble:1.12.1"
|
implementation "com.polidea.rxandroidble3:rxandroidble:1.16.0"
|
||||||
implementation "com.jakewharton.rx2:replaying-share:2.2.0"
|
implementation "com.jakewharton.rx3:replaying-share:3.0.0"
|
||||||
}
|
}
|
Binary file not shown.
|
@ -1,25 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch
|
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
|
|
||||||
import org.junit.Assert.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumented test, which will execute on an Android device.
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
|
||||||
class ExampleInstrumentedTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun useAppContext() {
|
|
||||||
// Context of the app under test.
|
|
||||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
|
||||||
assertEquals("com.eoflow.patch", appContext.packageName)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="info.nightscout.androidaps.plugins.pump.eopatch">
|
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity android:name=".ui.EopatchActivity" />
|
<activity android:name=".ui.EopatchActivity" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch
|
package info.nightscout.androidaps.plugins.pump.eopatch
|
||||||
|
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch
|
package info.nightscout.androidaps.plugins.pump.eopatch
|
||||||
|
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||||
|
|
||||||
object EoPatchRxBus {
|
object EoPatchRxBus {
|
||||||
private val publishSubject: PublishSubject<Any> = PublishSubject.create()
|
private val publishSubject: PublishSubject<Any> = PublishSubject.create()
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch
|
package info.nightscout.androidaps.plugins.pump.eopatch
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.preference.Preference
|
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.events.EventAppInitialized
|
import info.nightscout.androidaps.events.EventAppInitialized
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.Pump
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpPluginBase
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||||
|
@ -31,13 +34,12 @@ import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.TimeChangeType
|
import info.nightscout.androidaps.utils.TimeChangeType
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.functions.Consumer
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.functions.Consumer
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -78,7 +80,7 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
super.onStart()
|
super.onStart()
|
||||||
mDisposables.add(rxBus
|
mDisposables.add(rxBus
|
||||||
.toObservable(EventPreferenceChange::class.java)
|
.toObservable(EventPreferenceChange::class.java)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({ event: EventPreferenceChange ->
|
.subscribe({ event: EventPreferenceChange ->
|
||||||
if (event.isChanged(rh, SettingKeys.LOW_RESERVOIR_REMINDERS) || event.isChanged(rh, SettingKeys.EXPIRATION_REMINDERS)) {
|
if (event.isChanged(rh, SettingKeys.LOW_RESERVOIR_REMINDERS) || event.isChanged(rh, SettingKeys.EXPIRATION_REMINDERS)) {
|
||||||
patchManager.changeReminderSetting()
|
patchManager.changeReminderSetting()
|
||||||
|
@ -90,7 +92,7 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
mDisposables.add(rxBus
|
mDisposables.add(rxBus
|
||||||
.toObservable(EventAppInitialized::class.java)
|
.toObservable(EventAppInitialized::class.java)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
aapsLogger.debug(LTag.PUMP,"EventAppInitialized")
|
aapsLogger.debug(LTag.PUMP,"EventAppInitialized")
|
||||||
preferenceManager.init()
|
preferenceManager.init()
|
||||||
|
@ -109,35 +111,11 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
return super.specialEnableCondition()
|
return super.specialEnableCondition()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun specialShowInListCondition(): Boolean {
|
|
||||||
return super.specialShowInListCondition()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
aapsLogger.debug(LTag.PUMP, "EOPatchPumpPlugin onStop()")
|
aapsLogger.debug(LTag.PUMP, "EOPatchPumpPlugin onStop()")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStateChange(type: PluginType?, oldState: State?, newState: State?) {
|
|
||||||
super.onStateChange(type, oldState, newState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) {
|
|
||||||
super.preprocessPreferences(preferenceFragment)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updatePreferenceSummary(pref: Preference) {
|
|
||||||
super.updatePreferenceSummary(pref)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds: Long): Boolean {
|
|
||||||
return super.isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setNeutralTempAtFullHour(): Boolean {
|
|
||||||
return super.setNeutralTempAtFullHour()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isInitialized(): Boolean {
|
override fun isInitialized(): Boolean {
|
||||||
return isConnected() && patchManager.isActivated
|
return isConnected() && patchManager.isActivated
|
||||||
}
|
}
|
||||||
|
@ -207,7 +185,7 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
val nb = preferenceManager.getNormalBasalManager().convertProfileToNormalBasal(profile)
|
val nb = preferenceManager.getNormalBasalManager().convertProfileToNormalBasal(profile)
|
||||||
mDisposables.add(patchManager.startBasal(nb)
|
mDisposables.add(patchManager.startBasal(nb)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ response ->
|
.subscribe({ response ->
|
||||||
result.onNext(response.isSuccess)
|
result.onNext(response.isSuccess)
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.os.IBinder;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
|
|
||||||
public class OsAlarmService extends Service {
|
public class OsAlarmService extends Service {
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ package info.nightscout.androidaps.plugins.pump.eopatch
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import io.reactivex.*
|
import io.reactivex.rxjava3.core.Scheduler
|
||||||
|
import io.reactivex.rxjava3.core.Single
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
|
@ -4,15 +4,14 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode.*
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.EONotification
|
import info.nightscout.androidaps.plugins.pump.eopatch.EONotification
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus
|
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.R
|
import info.nightscout.androidaps.plugins.pump.eopatch.R
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode.*
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.AlarmCategory
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.AlarmCategory
|
||||||
|
@ -20,14 +19,14 @@ import info.nightscout.androidaps.plugins.pump.eopatch.event.EventEoPatchAlarm
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -49,6 +48,7 @@ class AlarmManager @Inject constructor() : IAlarmManager {
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
|
||||||
@Inject lateinit var pm: IPreferenceManager
|
@Inject lateinit var pm: IPreferenceManager
|
||||||
@Inject lateinit var mAlarmRegistry: IAlarmRegistry
|
@Inject lateinit var mAlarmRegistry: IAlarmRegistry
|
||||||
|
@ -69,8 +69,8 @@ class AlarmManager @Inject constructor() : IAlarmManager {
|
||||||
.doOnNext { aapsLogger.info(LTag.PUMP,"EventEoPatchAlarm Received") }
|
.doOnNext { aapsLogger.info(LTag.PUMP,"EventEoPatchAlarm Received") }
|
||||||
.concatMap {
|
.concatMap {
|
||||||
Observable.fromArray(it)
|
Observable.fromArray(it)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(aapsSchedulers.main)
|
||||||
.doOnNext { alarmCodes ->
|
.doOnNext { alarmCodes ->
|
||||||
alarmCodes.forEach { alarmCode ->
|
alarmCodes.forEach { alarmCode ->
|
||||||
aapsLogger.info(LTag.PUMP,"alarmCode: ${alarmCode.name}")
|
aapsLogger.info(LTag.PUMP,"alarmCode: ${alarmCode.name}")
|
||||||
|
|
|
@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.event.EventDialog
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventProgressDialog
|
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventProgressDialog
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.extension.takeOne
|
import info.nightscout.androidaps.plugins.pump.eopatch.extension.takeOne
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.CommonDialog
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.CommonDialog
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
|
@ -119,7 +119,6 @@ class AlarmProcess(val patchManager: IPatchManager, val rxBus: RxBus) : IAlarmPr
|
||||||
.filter{ok -> ok}
|
.filter{ok -> ok}
|
||||||
.flatMap { patchManager.resumeBasal().map { it.isSuccess.takeOne(IAlarmProcess.ALARM_HANDLED, IAlarmProcess.ALARM_UNHANDLED) }.toMaybe() }
|
.flatMap { patchManager.resumeBasal().map { it.isSuccess.takeOne(IAlarmProcess.ALARM_HANDLED, IAlarmProcess.ALARM_UNHANDLED) }.toMaybe() }
|
||||||
.defaultIfEmpty(IAlarmProcess.ALARM_UNHANDLED)
|
.defaultIfEmpty(IAlarmProcess.ALARM_UNHANDLED)
|
||||||
.toSingle()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,27 +1,26 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.alarm
|
package info.nightscout.androidaps.plugins.pump.eopatch.alarm
|
||||||
|
|
||||||
import android.app.AlarmManager
|
import android.app.AlarmManager
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode.Companion.getUri
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventEoPatchAlarm
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.app.AlarmManager.AlarmClockInfo
|
import android.app.AlarmManager.AlarmClockInfo
|
||||||
|
import android.app.PendingIntent
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus
|
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.OsAlarmReceiver
|
import info.nightscout.androidaps.plugins.pump.eopatch.OsAlarmReceiver
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode.Companion.getUri
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.PatchAeCode
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.PatchAeCode
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventEoPatchAlarm
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.Maybe
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Maybe
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -109,10 +108,10 @@ class AlarmRegistry @Inject constructor() : IAlarmRegistry {
|
||||||
override fun add(patchAeCodes: Set<PatchAeCode>) {
|
override fun add(patchAeCodes: Set<PatchAeCode>) {
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
Observable.fromIterable(patchAeCodes)
|
Observable.fromIterable(patchAeCodes)
|
||||||
.filter{patchAeCodeItem -> AlarmCode.findByPatchAeCode(patchAeCodeItem.getAeValue()) != null}
|
.filter{patchAeCodeItem -> AlarmCode.findByPatchAeCode(patchAeCodeItem.aeValue) != null}
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.main)
|
||||||
.filter { aeCodes -> AlarmCode.findByPatchAeCode(aeCodes.getAeValue()) != null }
|
.filter { aeCodes -> AlarmCode.findByPatchAeCode(aeCodes.aeValue) != null }
|
||||||
.flatMapMaybe{aeCodeResponse -> add(AlarmCode.findByPatchAeCode(aeCodeResponse.getAeValue())!!,0L, true)}
|
.flatMapMaybe{aeCodeResponse -> add(AlarmCode.findByPatchAeCode(aeCodeResponse.aeValue)!!, 0L, true)}
|
||||||
.subscribe()
|
.subscribe()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
public interface IPatchManager {
|
public interface IPatchManager {
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue;
|
import info.nightscout.androidaps.interfaces.CommandQueue;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.R;
|
import info.nightscout.androidaps.plugins.pump.eopatch.R;
|
||||||
|
@ -47,15 +48,13 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PatchManager implements IPatchManager {
|
public class PatchManager implements IPatchManager {
|
||||||
|
@ -73,6 +72,7 @@ public class PatchManager implements IPatchManager {
|
||||||
@Inject PumpSync pumpSync;
|
@Inject PumpSync pumpSync;
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
@Inject RxAction rxAction;
|
@Inject RxAction rxAction;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
private IPatchScanner patchScanner;
|
private IPatchScanner patchScanner;
|
||||||
private final CompositeDisposable mCompositeDisposable = new CompositeDisposable();
|
private final CompositeDisposable mCompositeDisposable = new CompositeDisposable();
|
||||||
|
@ -104,7 +104,7 @@ public class PatchManager implements IPatchManager {
|
||||||
|
|
||||||
case CONNECTING:
|
case CONNECTING:
|
||||||
mConnectingDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
|
mConnectingDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.getMain())
|
||||||
.takeUntil(n -> getPatchConnectionState().isConnected() || n > 10 * 60)
|
.takeUntil(n -> getPatchConnectionState().isConnected() || n > 10 * 60)
|
||||||
.subscribe(n -> rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING, n.intValue())));
|
.subscribe(n -> rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING, n.intValue())));
|
||||||
break;
|
break;
|
||||||
|
@ -116,8 +116,8 @@ public class PatchManager implements IPatchManager {
|
||||||
);
|
);
|
||||||
mCompositeDisposable.add(rxBus
|
mCompositeDisposable.add(rxBus
|
||||||
.toObservable(EventPatchActivationNotComplete.class)
|
.toObservable(EventPatchActivationNotComplete.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(aapsSchedulers.getMain())
|
||||||
.subscribe(eventPatchActivationNotComplete -> {
|
.subscribe(eventPatchActivationNotComplete -> {
|
||||||
Intent i = new Intent(context, DialogHelperActivity.class);
|
Intent i = new Intent(context, DialogHelperActivity.class);
|
||||||
i.putExtra("title", resourceHelper.gs(R.string.patch_activate_reminder_title));
|
i.putExtra("title", resourceHelper.gs(R.string.patch_activate_reminder_title));
|
||||||
|
@ -383,7 +383,7 @@ public class PatchManager implements IPatchManager {
|
||||||
if(pm.getPatchConfig().getInfoReminder() != buzzer) {
|
if(pm.getPatchConfig().getInfoReminder() != buzzer) {
|
||||||
if (isActivated()) {
|
if (isActivated()) {
|
||||||
mCompositeDisposable.add(infoReminderSet(buzzer)
|
mCompositeDisposable.add(infoReminderSet(buzzer)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.getMain())
|
||||||
.subscribe(patchBooleanResponse -> {
|
.subscribe(patchBooleanResponse -> {
|
||||||
pm.getPatchConfig().setInfoReminder(buzzer);
|
pm.getPatchConfig().setInfoReminder(buzzer);
|
||||||
pm.flushPatchConfig();
|
pm.flushPatchConfig();
|
||||||
|
@ -403,7 +403,7 @@ public class PatchManager implements IPatchManager {
|
||||||
if(pc.getLowReservoirAlertAmount() != doseUnit || pc.getPatchExpireAlertTime() != hours) {
|
if(pc.getLowReservoirAlertAmount() != doseUnit || pc.getPatchExpireAlertTime() != hours) {
|
||||||
if (isActivated()) {
|
if (isActivated()) {
|
||||||
mCompositeDisposable.add(setLowReservoir(doseUnit, hours)
|
mCompositeDisposable.add(setLowReservoir(doseUnit, hours)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.getMain())
|
||||||
.subscribe(patchBooleanResponse -> {
|
.subscribe(patchBooleanResponse -> {
|
||||||
pc.setLowReservoirAlertAmount(doseUnit);
|
pc.setLowReservoirAlertAmount(doseUnit);
|
||||||
pc.setPatchExpireAlertTime(hours);
|
pc.setPatchExpireAlertTime(hours);
|
||||||
|
|
|
@ -10,9 +10,30 @@ import android.content.IntentFilter;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.security.AlgorithmParameters;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyPairGenerator;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.PublicKey;
|
||||||
|
import java.security.interfaces.ECPublicKey;
|
||||||
|
import java.security.spec.ECGenParameterSpec;
|
||||||
|
import java.security.spec.ECParameterSpec;
|
||||||
|
import java.security.spec.ECPoint;
|
||||||
|
import java.security.spec.ECPublicKeySpec;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.crypto.KeyAgreement;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus;
|
import info.nightscout.androidaps.plugins.pump.eopatch.EoPatchRxBus;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode;
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.ActivateTask;
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.ActivateTask;
|
||||||
|
@ -38,10 +59,10 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.SyncBasalHistory
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.TaskBase;
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.TaskBase;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.TaskFunc;
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.TaskFunc;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.UpdateConnectionTask;
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.task.UpdateConnectionTask;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.BleConnectionState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.BolusExDuration;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.IBleDevice;
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.DeactivationStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.Patch;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.Patch;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.PatchSelfTestResult;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BuzzerStop;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BuzzerStop;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.GetTemperature;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.GetTemperature;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.PublicKeySend;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.PublicKeySend;
|
||||||
|
@ -51,35 +72,18 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.AlarmNotification;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.AlarmNotification;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.BaseNotification;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.BaseNotification;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.InfoNotification;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.noti.InfoNotification;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.*;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalScheduleSetResponse;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BaseResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.BolusExDuration;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.DeactivationStatus;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusStopResponse;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.ComboBolusStopResponse;
|
||||||
import java.math.BigInteger;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.KeyResponse;
|
||||||
import java.security.AlgorithmParameters;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse;
|
||||||
import java.security.InvalidKeyException;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TempBasalScheduleSetResponse;
|
||||||
import java.security.KeyFactory;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TemperatureResponse;
|
||||||
import java.security.KeyPair;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.BleConnectionState;
|
||||||
import java.security.KeyPairGenerator;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.IBleDevice;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.scan.PatchSelfTestResult;
|
||||||
import java.security.PrivateKey;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.security.interfaces.ECPublicKey;
|
|
||||||
import java.security.spec.ECGenParameterSpec;
|
|
||||||
import java.security.spec.ECParameterSpec;
|
|
||||||
import java.security.spec.ECPoint;
|
|
||||||
import java.security.spec.ECPublicKeySpec;
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import javax.crypto.KeyAgreement;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventEoPatchAlarm;
|
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventEoPatchAlarm;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.receiver.RxBroadcastReceiver;
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.receiver.RxBroadcastReceiver;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
||||||
|
@ -87,13 +91,16 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Scheduler;
|
import io.reactivex.rxjava3.core.Scheduler;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
import io.reactivex.functions.Consumer;
|
import io.reactivex.rxjava3.functions.Consumer;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PatchManagerImpl{
|
public class PatchManagerImpl{
|
||||||
|
@ -101,6 +108,7 @@ public class PatchManagerImpl{
|
||||||
@Inject Context context;
|
@Inject Context context;
|
||||||
@Inject SP sp;
|
@Inject SP sp;
|
||||||
@Inject AAPSLogger aapsLogger;
|
@Inject AAPSLogger aapsLogger;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
@Inject StartBondTask START_BOND;
|
@Inject StartBondTask START_BOND;
|
||||||
@Inject GetPatchInfoTask GET_PATCH_INFO;
|
@Inject GetPatchInfoTask GET_PATCH_INFO;
|
||||||
|
@ -146,17 +154,19 @@ public class PatchManagerImpl{
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
Observable.combineLatest(patch.observeConnected(), pm.observePatchLifeCycle(),
|
Observable.combineLatest(patch.observeConnected(), pm.observePatchLifeCycle(),
|
||||||
(connected, lifeCycle) -> (connected && lifeCycle.isActivated()))
|
(connected, lifeCycle) -> (connected && lifeCycle.isActivated()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(aapsSchedulers.getIo())
|
||||||
.filter(ok -> ok)
|
.filter(ok -> ok)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.doOnNext(v -> TaskBase.enqueue(TaskFunc.UPDATE_CONNECTION))
|
.doOnNext(v -> TaskBase.enqueue(TaskFunc.UPDATE_CONNECTION))
|
||||||
.retry()
|
.retry()
|
||||||
.subscribe());
|
.subscribe());
|
||||||
|
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
Observable.combineLatest(patch.observeConnected(), pm.observePatchLifeCycle().distinctUntilChanged(), dateTimeChanged.startWith(new Intent()),
|
Observable.combineLatest(patch.observeConnected(),
|
||||||
|
pm.observePatchLifeCycle().distinctUntilChanged(),
|
||||||
|
dateTimeChanged.startWith(Observable.just(new Intent())),
|
||||||
(connected, lifeCycle, value) -> (connected && lifeCycle.isActivated()))
|
(connected, lifeCycle, value) -> (connected && lifeCycle.isActivated()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(aapsSchedulers.getIo())
|
||||||
.doOnNext(v -> aapsLogger.debug(LTag.PUMP,"Has the date or time changed? "+v))
|
.doOnNext(v -> aapsLogger.debug(LTag.PUMP,"Has the date or time changed? "+v))
|
||||||
.filter(ok -> ok)
|
.filter(ok -> ok)
|
||||||
.doOnNext(v -> TaskBase.enqueue(TaskFunc.SET_GLOBAL_TIME))
|
.doOnNext(v -> TaskBase.enqueue(TaskFunc.SET_GLOBAL_TIME))
|
||||||
|
@ -279,7 +289,7 @@ public class PatchManagerImpl{
|
||||||
// synchronized lock
|
// synchronized lock
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
private void updatePatchConfig(Consumer<PatchConfig> consumer, boolean needSave) throws Exception {
|
private void updatePatchConfig(Consumer<PatchConfig> consumer, boolean needSave) throws Throwable {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
consumer.accept(pm.getPatchConfig());
|
consumer.accept(pm.getPatchConfig());
|
||||||
if (needSave) {
|
if (needSave) {
|
||||||
|
@ -549,7 +559,7 @@ public class PatchManagerImpl{
|
||||||
@Inject
|
@Inject
|
||||||
SyncBasalHistoryTask syncBasalHistoryTask;
|
SyncBasalHistoryTask syncBasalHistoryTask;
|
||||||
|
|
||||||
void onAlarmNotification(AlarmNotification notification) throws Exception {
|
void onAlarmNotification(AlarmNotification notification) throws Throwable {
|
||||||
patchStateManager.updatePatchState(PatchState.create(notification.patchState, System.currentTimeMillis()));
|
patchStateManager.updatePatchState(PatchState.create(notification.patchState, System.currentTimeMillis()));
|
||||||
|
|
||||||
if (pm.getPatchConfig().isActivated()) {
|
if (pm.getPatchConfig().isActivated()) {
|
||||||
|
@ -562,7 +572,7 @@ public class PatchManagerImpl{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onInfoNotification(InfoNotification notification) throws Exception {
|
private void onInfoNotification(InfoNotification notification) throws Throwable {
|
||||||
readBolusStatusFromNotification(notification);
|
readBolusStatusFromNotification(notification);
|
||||||
updateInjected(notification, false);
|
updateInjected(notification, false);
|
||||||
if (notification.isBolusDone()) {
|
if (notification.isBolusDone()) {
|
||||||
|
@ -570,7 +580,7 @@ public class PatchManagerImpl{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateInjected(BaseNotification notification, boolean needSave) throws Exception {
|
void updateInjected(BaseNotification notification, boolean needSave) throws Throwable {
|
||||||
updatePatchConfig(patchConfig -> {
|
updatePatchConfig(patchConfig -> {
|
||||||
patchConfig.setInjectCount(notification.getTotalInjected());
|
patchConfig.setInjectCount(notification.getTotalInjected());
|
||||||
patchConfig.setStandardBolusInjectCount(notification.getSB_CNT());
|
patchConfig.setStandardBolusInjectCount(notification.getSB_CNT());
|
||||||
|
|
|
@ -6,6 +6,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue;
|
import info.nightscout.androidaps.interfaces.CommandQueue;
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import info.nightscout.shared.logging.LTag;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
||||||
|
@ -17,9 +18,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
import io.reactivex.Maybe;
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -32,6 +32,7 @@ public class PatchStateManager {
|
||||||
@Inject FetchAlarmTask FETCH_ALARM;
|
@Inject FetchAlarmTask FETCH_ALARM;
|
||||||
@Inject CommandQueue commandQueue;
|
@Inject CommandQueue commandQueue;
|
||||||
@Inject AAPSLogger aapsLogger;
|
@Inject AAPSLogger aapsLogger;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PatchStateManager() {
|
public PatchStateManager() {
|
||||||
|
@ -41,7 +42,7 @@ public class PatchStateManager {
|
||||||
public synchronized void updatePatchState(PatchState newState) {
|
public synchronized void updatePatchState(PatchState newState) {
|
||||||
Maybe.fromCallable(() -> newState).observeOn(Schedulers.single())
|
Maybe.fromCallable(() -> newState).observeOn(Schedulers.single())
|
||||||
.doOnSuccess(patchState -> updatePatchStateInner(patchState))
|
.doOnSuccess(patchState -> updatePatchStateInner(patchState))
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.getMain())
|
||||||
.doOnSuccess(patchState -> aapsLogger.debug(LTag.PUMP, patchState.toString()))
|
.doOnSuccess(patchState -> aapsLogger.debug(LTag.PUMP, patchState.toString()))
|
||||||
.subscribe();
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.*
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.*
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ActivateTask extends TaskBase {
|
public class ActivateTask extends TaskBase {
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
||||||
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.DeactivationStatus;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.DeactivationStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.DeActivation;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.DeActivation;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
import io.reactivex.Observable;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import io.reactivex.Single;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DeactivateTask extends TaskBase {
|
public class DeactivateTask extends TaskBase {
|
||||||
@Inject StopBasalTask stopBasalTask;
|
@Inject StopBasalTask stopBasalTask;
|
||||||
@Inject IPreferenceManager pm;
|
@Inject IPreferenceManager pm;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
private final DeActivation DEACTIVATION;
|
private final DeActivation DEACTIVATION;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class DeactivateTask extends TaskBase {
|
||||||
.concatMapSingle(v ->
|
.concatMapSingle(v ->
|
||||||
DEACTIVATION.start()
|
DEACTIVATION.start()
|
||||||
.doOnSuccess(this::checkResponse)
|
.doOnSuccess(this::checkResponse)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.doOnSuccess(response -> onDeactivated()))
|
.doOnSuccess(response -> onDeactivated()))
|
||||||
.map(response -> DeactivationStatus.of(response.isSuccess(), forced))
|
.map(response -> DeactivationStatus.of(response.isSuccess(), forced))
|
||||||
.firstOrError()
|
.firstOrError()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.AeCodeResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.AeCodeResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FetchAlarmTask extends TaskBase {
|
public class FetchAlarmTask extends TaskBase {
|
||||||
|
|
|
@ -21,8 +21,8 @@ import java.util.Arrays;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GetPatchInfoTask extends TaskBase {
|
public class GetPatchInfoTask extends TaskBase {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InfoReminderTask extends TaskBase {
|
public class InfoReminderTask extends TaskBase {
|
||||||
|
|
|
@ -18,9 +18,9 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchIntern
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InternalSuspendedTask extends BolusTask {
|
public class InternalSuspendedTask extends BolusTask {
|
||||||
|
@ -64,7 +64,7 @@ public class InternalSuspendedTask extends BolusTask {
|
||||||
|
|
||||||
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
||||||
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
||||||
commandQueue.cancelAllBoluses();
|
commandQueue.cancelAllBoluses(null);
|
||||||
SystemClock.sleep(650);
|
SystemClock.sleep(650);
|
||||||
}
|
}
|
||||||
bolusCheckSubject.onNext(true);
|
bolusCheckSubject.onNext(true);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.api.StartNeedleCheck
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import info.nightscout.shared.logging.LTag;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class NeedleSensingTask extends TaskBase {
|
public class NeedleSensingTask extends TaskBase {
|
||||||
|
|
|
@ -23,9 +23,9 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BasalPause;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PauseBasalTask extends BolusTask {
|
public class PauseBasalTask extends BolusTask {
|
||||||
|
@ -71,7 +71,7 @@ public class PauseBasalTask extends BolusTask {
|
||||||
|
|
||||||
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
||||||
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
||||||
commandQueue.cancelAllBoluses();
|
commandQueue.cancelAllBoluses(null);
|
||||||
SystemClock.sleep(650);
|
SystemClock.sleep(650);
|
||||||
}
|
}
|
||||||
bolusCheckSubject.onNext(true);
|
bolusCheckSubject.onNext(true);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.StartPriming;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.StartPriming;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PrimingTask extends TaskBase {
|
public class PrimingTask extends TaskBase {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusFinish
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.BolusCurrent;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ReadBolusFinishTimeTask extends BolusTask {
|
public class ReadBolusFinishTimeTask extends BolusTask {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import javax.inject.Singleton;
|
||||||
import info.nightscout.shared.logging.LTag;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.TempBasalFinishTimeGet;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.TempBasalFinishTimeGet;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TempBasalFinishTimeResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TempBasalFinishTimeResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ReadTempBasalFinishTimeTask extends TaskBase {
|
public class ReadTempBasalFinishTimeTask extends TaskBase {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.PatchBooleanResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ResumeBasalTask extends TaskBase {
|
public class ResumeBasalTask extends TaskBase {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Arrays;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SelfTestTask extends TaskBase {
|
public class SelfTestTask extends TaskBase {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SetGlobalTimeTask extends TaskBase {
|
public class SetGlobalTimeTask extends TaskBase {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SetLowReservoirTask extends TaskBase {
|
public class SetLowReservoirTask extends TaskBase {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.plugins.pump.eopatch.core.api.StartBonding.OPTION_NUMERIC;
|
import static info.nightscout.androidaps.plugins.pump.eopatch.core.api.StartBonding.OPTION_NUMERIC;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StartCalcBolusTask extends BolusTask {
|
public class StartCalcBolusTask extends BolusTask {
|
||||||
|
|
|
@ -1,25 +1,22 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
||||||
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.PatchStateManager;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BasalScheduleSetBig;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.PatchStateManager;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BasalScheduleSetBig;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalScheduleSetResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalScheduleSetResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.NormalBasal;
|
||||||
import io.reactivex.Single;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import info.nightscout.shared.logging.LTag;
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StartNormalBasalTask extends TaskBase {
|
public class StartNormalBasalTask extends TaskBase {
|
||||||
private final BasalScheduleSetBig BASAL_SCHEDULE_SET_BIG;
|
private final BasalScheduleSetBig BASAL_SCHEDULE_SET_BIG;
|
||||||
|
|
||||||
@Inject
|
@Inject PatchStateManager patchStateManager;
|
||||||
PatchStateManager patchStateManager;
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public StartNormalBasalTask() {
|
public StartNormalBasalTask() {
|
||||||
|
@ -34,7 +31,7 @@ public class StartNormalBasalTask extends TaskBase {
|
||||||
public Single<BasalScheduleSetResponse> startJob(NormalBasal basal) {
|
public Single<BasalScheduleSetResponse> startJob(NormalBasal basal) {
|
||||||
return BASAL_SCHEDULE_SET_BIG.set(basal.getDoseUnitPerSegmentArray())
|
return BASAL_SCHEDULE_SET_BIG.set(basal.getDoseUnitPerSegmentArray())
|
||||||
.doOnSuccess(this::checkResponse)
|
.doOnSuccess(this::checkResponse)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.doOnSuccess(v -> onStartNormalBasalResponse(v, basal))
|
.doOnSuccess(v -> onStartNormalBasalResponse(v, basal))
|
||||||
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StartNormalBasalTask error"));
|
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StartNormalBasalTask error"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StartQuickBolusTask extends BolusTask {
|
public class StartQuickBolusTask extends BolusTask {
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager;
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.TempBasalScheduleStart;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.TempBasalScheduleStart;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TempBasalScheduleSetResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.TempBasalScheduleSetResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||||
import io.reactivex.Single;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import info.nightscout.shared.logging.LTag;
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StartTempBasalTask extends TaskBase {
|
public class StartTempBasalTask extends TaskBase {
|
||||||
@Inject IPreferenceManager pm;
|
@Inject IPreferenceManager pm;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
private final TempBasalScheduleStart TEMP_BASAL_SCHEDULE_START;
|
private final TempBasalScheduleStart TEMP_BASAL_SCHEDULE_START;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -29,7 +30,7 @@ public class StartTempBasalTask extends TaskBase {
|
||||||
.concatMapSingle(v -> TEMP_BASAL_SCHEDULE_START.start(tempBasal.getDurationMinutes(), tempBasal.getDoseUnitPerHour(), tempBasal.getPercent()))
|
.concatMapSingle(v -> TEMP_BASAL_SCHEDULE_START.start(tempBasal.getDurationMinutes(), tempBasal.getDoseUnitPerHour(), tempBasal.getPercent()))
|
||||||
.doOnNext(this::checkResponse)
|
.doOnNext(this::checkResponse)
|
||||||
.firstOrError()
|
.firstOrError()
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.doOnSuccess(v -> onTempBasalStarted(tempBasal))
|
.doOnSuccess(v -> onTempBasalStarted(tempBasal))
|
||||||
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StartTempBasalTask error"));
|
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StartTempBasalTask error"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ import info.nightscout.androidaps.interfaces.CommandQueue;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StopBasalTask extends TaskBase {
|
public class StopBasalTask extends TaskBase {
|
||||||
|
@ -59,7 +59,7 @@ public class StopBasalTask extends TaskBase {
|
||||||
|
|
||||||
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
if (commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
||||||
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
uel.log(UserEntryMapper.Action.CANCEL_BOLUS, UserEntryMapper.Sources.EOPatch2);
|
||||||
commandQueue.cancelAllBoluses();
|
commandQueue.cancelAllBoluses(null);
|
||||||
SystemClock.sleep(650);
|
SystemClock.sleep(650);
|
||||||
}
|
}
|
||||||
bolusCheckSubject.onNext(true);
|
bolusCheckSubject.onNext(true);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StopComboBolusTask extends BolusTask {
|
public class StopComboBolusTask extends BolusTask {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StopExtBolusTask extends BolusTask {
|
public class StopExtBolusTask extends BolusTask {
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
package info.nightscout.androidaps.plugins.pump.eopatch.ble.task;
|
||||||
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.define.IPatchConstant;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BolusStop;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusStopResponse;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.BolusStop;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.define.IPatchConstant;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BolusStopResponse;
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StopNowBolusTask extends BolusTask {
|
public class StopNowBolusTask extends BolusTask {
|
||||||
private final BolusStop BOLUS_STOP;
|
private final BolusStop BOLUS_STOP;
|
||||||
|
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public StopNowBolusTask() {
|
public StopNowBolusTask() {
|
||||||
super(TaskFunc.STOP_NOW_BOLUS);
|
super(TaskFunc.STOP_NOW_BOLUS);
|
||||||
|
@ -25,7 +26,7 @@ public class StopNowBolusTask extends BolusTask {
|
||||||
|
|
||||||
public Single<BolusStopResponse> stop() {
|
public Single<BolusStopResponse> stop() {
|
||||||
return isReady()
|
return isReady()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.getMain())
|
||||||
.concatMapSingle(v -> stopJob()).firstOrError()
|
.concatMapSingle(v -> stopJob()).firstOrError()
|
||||||
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StopNowBolusTask error"));
|
.doOnError(e -> aapsLogger.error(LTag.PUMPCOMM, (e.getMessage() != null) ? e.getMessage() : "StopNowBolusTask error"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class StopTempBasalTask extends TaskBase {
|
public class StopTempBasalTask extends TaskBase {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalHistoryIndexResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalHistoryIndexResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalHistoryResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.BasalHistoryResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.plugins.pump.eopatch.core.define.IPatchConstant.BASAL_HISTORY_SIZE_BIG;
|
import static info.nightscout.androidaps.plugins.pump.eopatch.core.define.IPatchConstant.BASAL_HISTORY_SIZE_BIG;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class TaskBase {
|
public class TaskBase {
|
||||||
|
|
|
@ -7,15 +7,16 @@ import java.util.Queue;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import info.nightscout.shared.logging.LTag;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
import io.reactivex.subjects.BehaviorSubject;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class TaskQueue {
|
public class TaskQueue {
|
||||||
@Inject AAPSLogger aapsLogger;
|
@Inject AAPSLogger aapsLogger;
|
||||||
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
|
|
||||||
Queue<PatchTask> queue = new LinkedList<>();
|
Queue<PatchTask> queue = new LinkedList<>();
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public class TaskQueue {
|
||||||
.takeUntil(it -> it.number > v)
|
.takeUntil(it -> it.number > v)
|
||||||
.filter(it -> it.number == v))
|
.filter(it -> it.number == v))
|
||||||
.doOnNext(v -> aapsLogger.debug(LTag.PUMPCOMM, String.format("Task #:%s started func:%s", v.number, v.func.name())))
|
.doOnNext(v -> aapsLogger.debug(LTag.PUMPCOMM, String.format("Task #:%s started func:%s", v.number, v.func.name())))
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(aapsSchedulers.getIo())
|
||||||
.map(it -> it.func)
|
.map(it -> it.func)
|
||||||
.doFinally(this::done);
|
.doFinally(this::done);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.api.UpdateConnection;
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.UpdateConnectionResponse;
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.response.UpdateConnectionResponse;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class UpdateConnectionTask extends TaskBase {
|
public class UpdateConnectionTask extends TaskBase {
|
||||||
|
|
|
@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugins.pump.eopatch.extension
|
||||||
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
|
||||||
fun <T> Observable<T>.observeOnMainThread(): Observable<T> = observeOn(AndroidSchedulers.mainThread())
|
fun <T> Observable<T>.observeOnMainThread(): Observable<T> = observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugins.pump.eopatch.extension
|
||||||
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
|
||||||
fun <T> Single<T>.subscribeDefault(aapsLogger: AAPSLogger, onSuccess: (T) -> Unit): Disposable = subscribe(onSuccess, {
|
fun <T> Single<T>.subscribeDefault(aapsLogger: AAPSLogger, onSuccess: (T) -> Unit): Disposable = subscribe(onSuccess, {
|
||||||
aapsLogger.error(LTag.PUMP, "onError", it)
|
aapsLogger.error(LTag.PUMP, "onError", it)
|
||||||
|
|
|
@ -10,14 +10,15 @@ import info.nightscout.androidaps.plugins.pump.eopatch.event.EventDialog
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventProgressDialog
|
import info.nightscout.androidaps.plugins.pump.eopatch.event.EventProgressDialog
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.AlarmDialog
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.AlarmDialog
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.ProgressDialogHelper
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.ProgressDialogHelper
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AlarmHelperActivity : DialogAppCompatActivity() {
|
class AlarmHelperActivity : DialogAppCompatActivity() {
|
||||||
@Inject lateinit var sp : SP
|
@Inject lateinit var sp : SP
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
private var mProgressDialog: AlertDialog? = null
|
private var mProgressDialog: AlertDialog? = null
|
||||||
|
@ -42,7 +43,7 @@ class AlarmHelperActivity : DialogAppCompatActivity() {
|
||||||
|
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventProgressDialog::class.java)
|
.toObservable(EventProgressDialog::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if(it.show){
|
if(it.show){
|
||||||
showProgressDialog(it.resId)
|
showProgressDialog(it.resId)
|
||||||
|
@ -54,7 +55,7 @@ class AlarmHelperActivity : DialogAppCompatActivity() {
|
||||||
|
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventDialog::class.java)
|
.toObservable(EventDialog::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if(it.show) it.dialog.show(supportFragmentManager, "")
|
if(it.show) it.dialog.show(supportFragmentManager, "")
|
||||||
}, { })
|
}, { })
|
||||||
|
|
|
@ -13,10 +13,8 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchPluginQualifier
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import io.reactivex.rxkotlin.addTo
|
|
||||||
|
|
||||||
abstract class EoBaseActivity<B : ViewDataBinding> : NoSplashAppCompatActivity(), EoBaseNavigator {
|
abstract class EoBaseActivity<B : ViewDataBinding> : NoSplashAppCompatActivity(), EoBaseNavigator {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -66,6 +64,4 @@ abstract class EoBaseActivity<B : ViewDataBinding> : NoSplashAppCompatActivity()
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Disposable.addTo() = addTo(compositeDisposable)
|
|
||||||
}
|
}
|
|
@ -12,10 +12,8 @@ import androidx.databinding.ViewDataBinding
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchPluginQualifier
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import io.reactivex.rxkotlin.addTo
|
|
||||||
|
|
||||||
abstract class EoBaseFragment<B : ViewDataBinding> : DaggerFragment(), EoBaseNavigator {
|
abstract class EoBaseFragment<B : ViewDataBinding> : DaggerFragment(), EoBaseNavigator {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -73,7 +71,4 @@ abstract class EoBaseFragment<B : ViewDataBinding> : DaggerFragment(), EoBaseNav
|
||||||
override fun finish(finishAffinity: Boolean) {
|
override fun finish(finishAffinity: Boolean) {
|
||||||
baseActivity?.finish(finishAffinity)
|
baseActivity?.finish(finishAffinity)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Disposable.addTo() = addTo(compositeDisposable)
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.extension.takeOne
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchOverviewViewModel
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchOverviewViewModel
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class EopatchOverviewFragment: EoBaseFragment<FragmentEopatchOverviewBinding>() {
|
class EopatchOverviewFragment: EoBaseFragment<FragmentEopatchOverviewBinding>() {
|
||||||
|
|
|
@ -4,13 +4,16 @@ import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import dagger.android.support.DaggerDialogFragment
|
import dagger.android.support.DaggerDialogFragment
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmProcess
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode
|
||||||
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmProcess
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmProcess
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmProcess
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.bindingadapters.setOnSafeClickListener
|
import info.nightscout.androidaps.plugins.pump.eopatch.bindingadapters.setOnSafeClickListener
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
||||||
|
@ -19,8 +22,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity
|
||||||
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AlarmDialog : DaggerDialogFragment() {
|
class AlarmDialog : DaggerDialogFragment() {
|
||||||
|
@ -79,7 +82,7 @@ class AlarmDialog : DaggerDialogFragment() {
|
||||||
aapsLogger.debug("USER ENTRY: Alarm dialog ok button pressed")
|
aapsLogger.debug("USER ENTRY: Alarm dialog ok button pressed")
|
||||||
alarmCode?.let { ac ->
|
alarmCode?.let { ac ->
|
||||||
mAlarmProcess.doAction(requireContext(), ac)
|
mAlarmProcess.doAction(requireContext(), ac)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(aapsSchedulers.io)
|
||||||
.subscribe ({ ret ->
|
.subscribe ({ ret ->
|
||||||
aapsLogger.debug("Alarm processing result :${ret}")
|
aapsLogger.debug("Alarm processing result :${ret}")
|
||||||
if (ret == IAlarmProcess.ALARM_HANDLED) {
|
if (ret == IAlarmProcess.ALARM_HANDLED) {
|
||||||
|
@ -92,25 +95,25 @@ class AlarmDialog : DaggerDialogFragment() {
|
||||||
isHolding = true
|
isHolding = true
|
||||||
}else if (ret == IAlarmProcess.ALARM_UNHANDLED) {
|
}else if (ret == IAlarmProcess.ALARM_UNHANDLED) {
|
||||||
if(!isMute){
|
if(!isMute){
|
||||||
startAlarm()
|
startAlarm("ALARM_UNHANDLED")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { t -> aapsLogger.error("${t.printStackTrace()}") })
|
}, { t -> aapsLogger.error("${t.printStackTrace()}") })
|
||||||
}
|
}
|
||||||
stopAlarm()
|
stopAlarm("OK clicked")
|
||||||
}
|
}
|
||||||
binding.mute.setOnSafeClickListener {
|
binding.mute.setOnSafeClickListener {
|
||||||
aapsLogger.debug("USER ENTRY: Error dialog mute button pressed")
|
aapsLogger.debug("USER ENTRY: Error dialog mute button pressed")
|
||||||
isMute = true
|
isMute = true
|
||||||
stopAlarm()
|
stopAlarm("Mute clicked")
|
||||||
}
|
}
|
||||||
binding.mute5min.setOnSafeClickListener {
|
binding.mute5min.setOnSafeClickListener {
|
||||||
aapsLogger.debug("USER ENTRY: Error dialog mute 5 min button pressed")
|
aapsLogger.debug("USER ENTRY: Error dialog mute 5 min button pressed")
|
||||||
stopAlarm()
|
stopAlarm("Mute5m clicked")
|
||||||
isMute = true
|
isMute = true
|
||||||
handler.postDelayed(this::startAlarm, T.mins(5).msecs())
|
handler.postDelayed({ startAlarm("post") }, T.mins(5).msecs())
|
||||||
}
|
}
|
||||||
startAlarm()
|
startAlarm("onViewCreated")
|
||||||
|
|
||||||
disposable = patchManager.observePatchLifeCycle()
|
disposable = patchManager.observePatchLifeCycle()
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
|
@ -137,7 +140,7 @@ class AlarmDialog : DaggerDialogFragment() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if(isHolding && !isMute){
|
if(isHolding && !isMute){
|
||||||
startAlarm()
|
startAlarm("onResume")
|
||||||
}
|
}
|
||||||
binding.status.text = status
|
binding.status.text = status
|
||||||
}
|
}
|
||||||
|
@ -155,17 +158,17 @@ class AlarmDialog : DaggerDialogFragment() {
|
||||||
helperActivity?.finish()
|
helperActivity?.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startAlarm() {
|
private fun startAlarm(reason: String) {
|
||||||
if (sound != 0) {
|
if (sound != 0) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
context?.let { context -> alarmSoundServiceHelper.startAlarm(context, sound) }
|
context?.let { context -> alarmSoundServiceHelper.startAlarm(context, sound, reason) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stopAlarm() {
|
private fun stopAlarm(reason: String) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
context?.let { context -> alarmSoundServiceHelper.stopService(context) }
|
context?.let { context -> alarmSoundServiceHelper.stopService(context, reason) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import androidx.annotation.CheckResult
|
import androidx.annotation.CheckResult
|
||||||
import io.reactivex.android.MainThreadDisposable
|
import io.reactivex.rxjava3.android.MainThreadDisposable
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Observer
|
import io.reactivex.rxjava3.core.Observer
|
||||||
|
|
||||||
class RxBroadcastReceiver private constructor() {
|
class RxBroadcastReceiver private constructor() {
|
||||||
internal class BroadcastReceiverObservable : Observable<Intent> {
|
internal class BroadcastReceiverObservable : Observable<Intent> {
|
||||||
|
|
|
@ -2,9 +2,8 @@ package info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ui.EoBaseNavigator
|
import info.nightscout.androidaps.plugins.pump.eopatch.ui.EoBaseNavigator
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.rxkotlin.addTo
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
abstract class EoBaseViewModel<N : EoBaseNavigator> : ViewModel() {
|
abstract class EoBaseViewModel<N : EoBaseNavigator> : ViewModel() {
|
||||||
|
@ -27,6 +26,6 @@ abstract class EoBaseViewModel<N : EoBaseNavigator> : ViewModel() {
|
||||||
|
|
||||||
fun finish() = navigator?.finish()
|
fun finish() = navigator?.finish()
|
||||||
|
|
||||||
fun Disposable.addTo() = addTo(compositeDisposable)
|
fun Disposable.addTo() = apply { compositeDisposable.add(this) }
|
||||||
|
|
||||||
}
|
}
|
|
@ -15,10 +15,10 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ui.event.UIEvent
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.Alarms
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -28,15 +28,15 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewM
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState
|
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.Maybe
|
import io.reactivex.rxjava3.core.Maybe
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.TimeoutException
|
import java.util.concurrent.TimeoutException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,8 +4,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.GsonHelper
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode
|
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class Alarms: IPreference<Alarms> {
|
class Alarms: IPreference<Alarms> {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.util.FloatAdjusters
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.util.FloatAdjusters
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 볼루스 주입 형태 2가지 모드
|
* 볼루스 주입 형태 2가지 모드
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch.vo
|
package info.nightscout.androidaps.plugins.pump.eopatch.vo
|
||||||
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
|
|
||||||
interface IPreference<T>{
|
interface IPreference<T>{
|
||||||
fun flush(sp: SP)
|
fun flush(sp: SP)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.GsonHelper
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.BasalStatus
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.BasalStatus
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class NormalBasalManager : IPreference<NormalBasalManager> {
|
class NormalBasalManager : IPreference<NormalBasalManager> {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.define.IPatchConstan
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchLifecycle
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
// @Singleton
|
// @Singleton
|
||||||
|
|
|
@ -6,8 +6,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.core.util.FloatAdjusters
|
import info.nightscout.androidaps.plugins.pump.eopatch.core.util.FloatAdjusters
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -6,8 +6,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.GsonHelper
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.SettingKeys
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.code.UnitOrPercent
|
import info.nightscout.androidaps.plugins.pump.eopatch.code.UnitOrPercent
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
|
|
||||||
class TempBasalManager : IPreference<TempBasalManager>{
|
class TempBasalManager : IPreference<TempBasalManager>{
|
||||||
@Transient
|
@Transient
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.eopatch
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
import org.junit.Assert.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class ExampleUnitTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue