Log Worker results
This commit is contained in:
parent
8dc346e4c8
commit
bd35007f44
|
@ -26,5 +26,6 @@ enum class LTag(val tag: String, val defaultValue : Boolean = true, val requires
|
||||||
TIDEPOOL("TIDEPOOL"),
|
TIDEPOOL("TIDEPOOL"),
|
||||||
UI("UI", defaultValue = false),
|
UI("UI", defaultValue = false),
|
||||||
WEAR("WEAR"),
|
WEAR("WEAR"),
|
||||||
WIDGET("WIDGET")
|
WIDGET("WIDGET"),
|
||||||
|
WORKER("WORKER")
|
||||||
}
|
}
|
|
@ -7,16 +7,15 @@ import androidx.work.OneTimeWorkRequest
|
||||||
import androidx.work.WorkInfo
|
import androidx.work.WorkInfo
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import androidx.work.WorkQuery
|
import androidx.work.WorkQuery
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import com.google.common.util.concurrent.ListenableFuture
|
import com.google.common.util.concurrent.ListenableFuture
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.BuildConfig
|
import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||||
import info.nightscout.core.profile.ProfileSealed
|
import info.nightscout.core.profile.ProfileSealed
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.LocalAlertUtils
|
import info.nightscout.interfaces.LocalAlertUtils
|
||||||
|
@ -31,7 +30,6 @@ import info.nightscout.interfaces.queue.CommandQueue
|
||||||
import info.nightscout.interfaces.receivers.ReceiverStatusStore
|
import info.nightscout.interfaces.receivers.ReceiverStatusStore
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -45,9 +43,8 @@ import kotlin.math.abs
|
||||||
class KeepAliveWorker(
|
class KeepAliveWorker(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var localAlertUtils: LocalAlertUtils
|
@Inject lateinit var localAlertUtils: LocalAlertUtils
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var config: Config
|
@Inject lateinit var config: Config
|
||||||
|
@ -65,10 +62,6 @@ class KeepAliveWorker(
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private val STATUS_UPDATE_FREQUENCY = T.mins(15).msecs()
|
private val STATUS_UPDATE_FREQUENCY = T.mins(15).msecs()
|
||||||
|
@ -83,7 +76,7 @@ class KeepAliveWorker(
|
||||||
private const val KA_10 = "KeepAlive_10"
|
private const val KA_10 = "KeepAlive_10"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
aapsLogger.debug(LTag.CORE, "KeepAlive received from: " + inputData.getString("schedule"))
|
aapsLogger.debug(LTag.CORE, "KeepAlive received from: " + inputData.getString("schedule"))
|
||||||
|
|
||||||
// 15 min interval is WorkManager minimum so schedule another instances to have 5 min interval
|
// 15 min interval is WorkManager minimum so schedule another instances to have 5 min interval
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package info.nightscout.core.utils.worker
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.work.Worker
|
||||||
|
import androidx.work.WorkerParameters
|
||||||
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
import info.nightscout.rx.logging.LTag
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
abstract class LoggingWorker(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) {
|
||||||
|
|
||||||
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
|
|
||||||
|
init {
|
||||||
|
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun doWork(): Result =
|
||||||
|
doWorkAndLog().also {
|
||||||
|
aapsLogger.debug(LTag.WORKER, "Worker result ${it::class.java.simpleName.uppercase()} for ${this::class.java}")
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract fun doWorkAndLog(): Result
|
||||||
|
}
|
|
@ -16,7 +16,6 @@ import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.work.ExistingWorkPolicy
|
import androidx.work.ExistingWorkPolicy
|
||||||
import androidx.work.OneTimeWorkRequest
|
import androidx.work.OneTimeWorkRequest
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -28,6 +27,7 @@ import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.core.ui.dialogs.TwoMessagesAlertDialog
|
import info.nightscout.core.ui.dialogs.TwoMessagesAlertDialog
|
||||||
import info.nightscout.core.ui.dialogs.WarningDialog
|
import info.nightscout.core.ui.dialogs.WarningDialog
|
||||||
import info.nightscout.core.ui.toast.ToastUtils
|
import info.nightscout.core.ui.toast.ToastUtils
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.UserEntry
|
import info.nightscout.database.entities.UserEntry
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import info.nightscout.database.entities.UserEntry.Action
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
import info.nightscout.database.entities.UserEntry.Sources
|
||||||
|
@ -381,10 +381,9 @@ class ImportExportPrefsImpl @Inject constructor(
|
||||||
class CsvExportWorker(
|
class CsvExportWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var prefFileList: PrefFileListProvider
|
@Inject lateinit var prefFileList: PrefFileListProvider
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
|
@ -392,11 +391,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
||||||
@Inject lateinit var storage: Storage
|
@Inject lateinit var storage: Storage
|
||||||
@Inject lateinit var persistenceLayer: PersistenceLayer
|
@Inject lateinit var persistenceLayer: PersistenceLayer
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
val entries = persistenceLayer.getUserEntryFilteredDataFromTime(MidnightTime.calc() - T.days(90).msecs()).blockingGet()
|
val entries = persistenceLayer.getUserEntryFilteredDataFromTime(MidnightTime.calc() - T.days(90).msecs()).blockingGet()
|
||||||
prefFileList.ensureExportDirExists()
|
prefFileList.ensureExportDirExists()
|
||||||
val newFile = prefFileList.newExportCsvFile()
|
val newFile = prefFileList.newExportCsvFile()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.plugins.general.food
|
package info.nightscout.plugins.general.food
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.extensions.foodFromJson
|
import info.nightscout.core.extensions.foodFromJson
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.Food
|
import info.nightscout.database.entities.Food
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.SyncNsFoodTransaction
|
import info.nightscout.database.impl.transactions.SyncNsFoodTransaction
|
||||||
|
@ -43,19 +43,14 @@ class FoodPlugin @Inject constructor(
|
||||||
class FoodWorker(
|
class FoodWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
val foods = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
val foods = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
aapsLogger.debug(LTag.DATABASE, "Received Food Data: $foods")
|
aapsLogger.debug(LTag.DATABASE, "Received Food Data: $foods")
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.text.TextUtils
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -19,6 +18,7 @@ import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.core.iob.round
|
import info.nightscout.core.iob.round
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.validators.ValidatingEditTextPreference
|
import info.nightscout.core.validators.ValidatingEditTextPreference
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import info.nightscout.database.entities.OfflineEvent
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import info.nightscout.database.entities.TemporaryTarget
|
||||||
|
@ -196,16 +196,12 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
class SmsCommunicatorWorker(
|
class SmsCommunicatorWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
|
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
val bundle = dataWorkerStorage.pickupBundle(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
val bundle = dataWorkerStorage.pickupBundle(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
val format = bundle.getString("format")
|
val format = bundle.getString("format")
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.plugins.profile
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -13,6 +12,7 @@ import info.nightscout.core.profile.ProfileSealed
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.core.ui.toast.ToastUtils
|
import info.nightscout.core.ui.toast.ToastUtils
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
import info.nightscout.interfaces.GlucoseUnit
|
import info.nightscout.interfaces.GlucoseUnit
|
||||||
|
@ -434,10 +434,9 @@ class ProfilePlugin @Inject constructor(
|
||||||
class NSProfileWorker(
|
class NSProfileWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
@ -447,11 +446,7 @@ class ProfilePlugin @Inject constructor(
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
@Inject lateinit var profileInstantiator: ProfileInstantiator
|
@Inject lateinit var profileInstantiator: ProfileInstantiator
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
val profileJson = dataWorkerStorage.pickupJSONObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
val profileJson = dataWorkerStorage.pickupJSONObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
xDripBroadcast.sendProfile(profileJson)
|
xDripBroadcast.sendProfile(profileJson)
|
||||||
|
@ -471,5 +466,4 @@ class ProfilePlugin @Inject constructor(
|
||||||
return Result.success(workDataOf("Result" to "Sync not enabled"))
|
return Result.success(workDataOf("Result" to "Sync not enabled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -61,18 +61,13 @@ class AidexPlugin @Inject constructor(
|
||||||
class AidexWorker(
|
class AidexWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var aidexPlugin: AidexPlugin
|
@Inject lateinit var aidexPlugin: AidexPlugin
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!aidexPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!aidexPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -4,12 +4,12 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.extensions.fromConstant
|
import info.nightscout.core.extensions.fromConstant
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import info.nightscout.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import info.nightscout.database.entities.UserEntry.Action
|
||||||
|
@ -85,9 +85,8 @@ class DexcomPlugin @Inject constructor(
|
||||||
class DexcomWorker(
|
class DexcomWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var dexcomPlugin: DexcomPlugin
|
@Inject lateinit var dexcomPlugin: DexcomPlugin
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
@ -97,11 +96,7 @@ class DexcomPlugin @Inject constructor(
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!dexcomPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!dexcomPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import info.nightscout.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
|
@ -54,21 +54,16 @@ class EversensePlugin @Inject constructor(
|
||||||
class EversenseWorker(
|
class EversenseWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var eversensePlugin: EversensePlugin
|
@Inject lateinit var eversensePlugin: EversensePlugin
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!eversensePlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!eversensePlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -45,19 +45,14 @@ class GlimpPlugin @Inject constructor(
|
||||||
class GlimpWorker(
|
class GlimpWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var glimpPlugin: GlimpPlugin
|
@Inject lateinit var glimpPlugin: GlimpPlugin
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!glimpPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!glimpPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -46,21 +46,16 @@ class MM640gPlugin @Inject constructor(
|
||||||
class MM640gWorker(
|
class MM640gWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var mM640gPlugin: MM640gPlugin
|
@Inject lateinit var mM640gPlugin: MM640gPlugin
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!mM640gPlugin.isEnabled()) return Result.success()
|
if (!mM640gPlugin.isEnabled()) return Result.success()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.transactions.TransactionGlucoseValue
|
import info.nightscout.database.transactions.TransactionGlucoseValue
|
||||||
|
@ -87,11 +87,11 @@ class NSClientSourcePlugin @Inject constructor(
|
||||||
class NSClientSourceWorker(
|
class NSClientSourceWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) :
|
||||||
|
LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var nsClientSourcePlugin: NSClientSourcePlugin
|
@Inject lateinit var nsClientSourcePlugin: NSClientSourcePlugin
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -101,10 +101,6 @@ class NSClientSourcePlugin @Inject constructor(
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDb
|
@Inject lateinit var storeDataForDb: StoreDataForDb
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun toGv(jsonObject: JSONObject): TransactionGlucoseValue? {
|
private fun toGv(jsonObject: JSONObject): TransactionGlucoseValue? {
|
||||||
val sgv = NSSgv(jsonObject)
|
val sgv = NSSgv(jsonObject)
|
||||||
return TransactionGlucoseValue(
|
return TransactionGlucoseValue(
|
||||||
|
@ -132,7 +128,7 @@ class NSClientSourcePlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
val sgvs = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
val sgvs = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -47,19 +47,14 @@ class PoctechPlugin @Inject constructor(
|
||||||
class PoctechWorker(
|
class PoctechWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var poctechPlugin: PoctechPlugin
|
@Inject lateinit var poctechPlugin: PoctechPlugin
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!poctechPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!poctechPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -44,21 +44,16 @@ class TomatoPlugin @Inject constructor(
|
||||||
class TomatoWorker(
|
class TomatoWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var tomatoPlugin: TomatoPlugin
|
@Inject lateinit var tomatoPlugin: TomatoPlugin
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!tomatoPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!tomatoPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.source
|
package info.nightscout.plugins.source
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||||
|
@ -62,18 +62,13 @@ class XdripPlugin @Inject constructor(
|
||||||
class XdripWorker(
|
class XdripWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var xdripPlugin: XdripPlugin
|
@Inject lateinit var xdripPlugin: XdripPlugin
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
if (!xdripPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
if (!xdripPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
|
||||||
|
|
|
@ -2,9 +2,8 @@ package info.nightscout.plugins.sync.nsShared
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import dagger.android.HasAndroidInjector
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.Bolus
|
import info.nightscout.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
import info.nightscout.database.entities.BolusCalculatorResult
|
||||||
import info.nightscout.database.entities.Carbs
|
import info.nightscout.database.entities.Carbs
|
||||||
|
@ -102,18 +101,14 @@ class StoreDataForDbImpl @Inject constructor(
|
||||||
class StoreBgWorker(
|
class StoreBgWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
storeDataForDb.storeGlucoseValuesToDb()
|
storeDataForDb.storeGlucoseValuesToDb()
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> HashMap<T, Long>.inc(key: T) =
|
fun <T> HashMap<T, Long>.inc(key: T) =
|
||||||
|
|
|
@ -2,11 +2,10 @@ package info.nightscout.plugins.sync.nsclient.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.DeviceStatus
|
import info.nightscout.database.entities.DeviceStatus
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.UpdateNsIdBolusCalculatorResultTransaction
|
import info.nightscout.database.impl.transactions.UpdateNsIdBolusCalculatorResultTransaction
|
||||||
|
@ -41,7 +40,6 @@ import info.nightscout.plugins.sync.nsclient.acks.NSAddAck
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientNewLog
|
import info.nightscout.rx.events.EventNSClientNewLog
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -49,17 +47,16 @@ import javax.inject.Inject
|
||||||
class NSClientAddAckWorker(
|
class NSClientAddAckWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
val ack = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as NSAddAck?
|
val ack = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as NSAddAck?
|
||||||
|
@ -323,8 +320,4 @@ class NSClientAddAckWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,12 +1,11 @@
|
||||||
package info.nightscout.plugins.sync.nsclient.workers
|
package info.nightscout.plugins.sync.nsclient.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.extensions.bolusCalculatorResultFromJson
|
import info.nightscout.core.extensions.bolusCalculatorResultFromJson
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import info.nightscout.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
|
@ -28,7 +27,6 @@ import info.nightscout.plugins.sync.nsclient.extensions.temporaryBasalFromJson
|
||||||
import info.nightscout.plugins.sync.nsclient.extensions.temporaryTargetFromJson
|
import info.nightscout.plugins.sync.nsclient.extensions.temporaryTargetFromJson
|
||||||
import info.nightscout.plugins.sync.nsclient.extensions.therapyEventFromJson
|
import info.nightscout.plugins.sync.nsclient.extensions.therapyEventFromJson
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
|
@ -37,10 +35,9 @@ import javax.inject.Inject
|
||||||
class NSClientAddUpdateWorker(
|
class NSClientAddUpdateWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var config: Config
|
@Inject lateinit var config: Config
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -51,7 +48,7 @@ class NSClientAddUpdateWorker(
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
val treatments = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
val treatments = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
||||||
|
@ -171,8 +168,4 @@ class NSClientAddUpdateWorker(
|
||||||
xDripBroadcast.sendTreatments(treatments)
|
xDripBroadcast.sendTreatments(treatments)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.plugins.sync.nsclient.workers
|
package info.nightscout.plugins.sync.nsclient.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
||||||
import info.nightscout.plugins.sync.nsclient.data.NSMbg
|
import info.nightscout.plugins.sync.nsclient.data.NSMbg
|
||||||
|
@ -16,14 +15,14 @@ import javax.inject.Inject
|
||||||
class NSClientMbgWorker(
|
class NSClientMbgWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var config: Config
|
@Inject lateinit var config: Config
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
val ret = Result.success()
|
val ret = Result.success()
|
||||||
|
|
||||||
val acceptNSData = sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT
|
val acceptNSData = sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT
|
||||||
|
@ -39,8 +38,4 @@ class NSClientMbgWorker(
|
||||||
// storeDataForDb.storeTreatmentsToDb() don't do this. It will be stored along with other treatments
|
// storeDataForDb.storeTreatmentsToDb() don't do this. It will be stored along with other treatments
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.plugins.sync.nsclient.workers
|
package info.nightscout.plugins.sync.nsclient.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.sync.DataSyncSelector
|
import info.nightscout.interfaces.sync.DataSyncSelector
|
||||||
import info.nightscout.interfaces.sync.DataSyncSelector.PairBolus
|
import info.nightscout.interfaces.sync.DataSyncSelector.PairBolus
|
||||||
|
@ -24,22 +23,20 @@ import info.nightscout.plugins.sync.nsclient.acks.NSUpdateAck
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientNewLog
|
import info.nightscout.rx.events.EventNSClientNewLog
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class NSClientUpdateRemoveAckWorker(
|
class NSClientUpdateRemoveAckWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
val ack = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as NSUpdateAck?
|
val ack = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as NSUpdateAck?
|
||||||
|
@ -157,8 +154,4 @@ class NSClientUpdateRemoveAckWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import android.content.Context
|
||||||
import androidx.work.ExistingWorkPolicy
|
import androidx.work.ExistingWorkPolicy
|
||||||
import androidx.work.OneTimeWorkRequest
|
import androidx.work.OneTimeWorkRequest
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.workflow.WorkerClasses
|
import info.nightscout.interfaces.workflow.WorkerClasses
|
||||||
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
||||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientNewLog
|
import info.nightscout.rx.events.EventNSClientNewLog
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
@ -22,9 +20,8 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class LoadBgWorker(
|
class LoadBgWorker(
|
||||||
context: Context, params: WorkerParameters
|
context: Context, params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
@ -38,7 +35,7 @@ class LoadBgWorker(
|
||||||
val JOB_NAME: String = this::class.java.simpleName
|
val JOB_NAME: String = this::class.java.simpleName
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -91,8 +88,4 @@ class LoadBgWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,16 +1,14 @@
|
||||||
package info.nightscout.plugins.sync.nsclientV3.workers
|
package info.nightscout.plugins.sync.nsclientV3.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.plugins.sync.nsclient.data.NSDeviceStatusHandler
|
import info.nightscout.plugins.sync.nsclient.data.NSDeviceStatusHandler
|
||||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientNewLog
|
import info.nightscout.rx.events.EventNSClientNewLog
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
import info.nightscout.shared.utils.T
|
import info.nightscout.shared.utils.T
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
@ -19,9 +17,8 @@ import javax.inject.Inject
|
||||||
class LoadDeviceStatusWorker(
|
class LoadDeviceStatusWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
|
@ -29,7 +26,7 @@ class LoadDeviceStatusWorker(
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var nsDeviceStatusHandler: NSDeviceStatusHandler
|
@Inject lateinit var nsDeviceStatusHandler: NSDeviceStatusHandler
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -50,8 +47,4 @@ class LoadDeviceStatusWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,23 +1,20 @@
|
||||||
package info.nightscout.plugins.sync.nsclientV3.workers
|
package info.nightscout.plugins.sync.nsclientV3.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LoadLastModificationWorker(
|
class LoadLastModificationWorker(
|
||||||
context: Context, params: WorkerParameters
|
context: Context, params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var nsClientV3Plugin: NSClientV3Plugin
|
@Inject lateinit var nsClientV3Plugin: NSClientV3Plugin
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -32,8 +29,4 @@ class LoadLastModificationWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,23 +1,20 @@
|
||||||
package info.nightscout.plugins.sync.nsclientV3.workers
|
package info.nightscout.plugins.sync.nsclientV3.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LoadStatusWorker(
|
class LoadStatusWorker(
|
||||||
context: Context, params: WorkerParameters
|
context: Context, params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var nsClientV3Plugin: NSClientV3Plugin
|
@Inject lateinit var nsClientV3Plugin: NSClientV3Plugin
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -31,8 +28,4 @@ class LoadStatusWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,14 @@ import android.content.Context
|
||||||
import androidx.work.ExistingWorkPolicy
|
import androidx.work.ExistingWorkPolicy
|
||||||
import androidx.work.OneTimeWorkRequest
|
import androidx.work.OneTimeWorkRequest
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
import info.nightscout.interfaces.nsclient.StoreDataForDb
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
|
||||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientNewLog
|
import info.nightscout.rx.events.EventNSClientNewLog
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -22,9 +19,8 @@ import javax.inject.Inject
|
||||||
class LoadTreatmentsWorker(
|
class LoadTreatmentsWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
|
@ -32,7 +28,7 @@ class LoadTreatmentsWorker(
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
var ret = Result.success()
|
var ret = Result.success()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -88,8 +84,4 @@ class LoadTreatmentsWorker(
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.plugins.sync.nsclientV3.workers
|
package info.nightscout.plugins.sync.nsclientV3.workers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
|
@ -25,7 +24,6 @@ import info.nightscout.plugins.sync.nsclientV3.extensions.toTemporaryBasal
|
||||||
import info.nightscout.plugins.sync.nsclientV3.extensions.toTemporaryTarget
|
import info.nightscout.plugins.sync.nsclientV3.extensions.toTemporaryTarget
|
||||||
import info.nightscout.plugins.sync.nsclientV3.extensions.toTherapyEvent
|
import info.nightscout.plugins.sync.nsclientV3.extensions.toTherapyEvent
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.sdk.localmodel.treatment.NSBolus
|
import info.nightscout.sdk.localmodel.treatment.NSBolus
|
||||||
import info.nightscout.sdk.localmodel.treatment.NSBolusWizard
|
import info.nightscout.sdk.localmodel.treatment.NSBolusWizard
|
||||||
|
@ -45,10 +43,9 @@ import javax.inject.Inject
|
||||||
class ProcessTreatmentsWorker(
|
class ProcessTreatmentsWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var config: Config
|
@Inject lateinit var config: Config
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -59,7 +56,7 @@ class ProcessTreatmentsWorker(
|
||||||
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
@Inject lateinit var xDripBroadcast: XDripBroadcast
|
||||||
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
@Inject lateinit var storeDataForDb: StoreDataForDbImpl
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val treatments = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as List<NSTreatment>?
|
val treatments = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as List<NSTreatment>?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
@ -147,8 +144,4 @@ class ProcessTreatmentsWorker(
|
||||||
// xDripBroadcast.sendTreatments(treatments)
|
// xDripBroadcast.sendTreatments(treatments)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
|
|
||||||
class DummyWorker(
|
class DummyWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
override fun doWork(): Result = Result.success()
|
override fun doWorkAndLog(): Result = Result.success()
|
||||||
}
|
}
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.aps.Loop
|
import info.nightscout.interfaces.aps.Loop
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
|
@ -15,16 +14,12 @@ import javax.inject.Inject
|
||||||
class InvokeLoopWorker(
|
class InvokeLoopWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||||
@Inject lateinit var loop: Loop
|
@Inject lateinit var loop: Loop
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class InvokeLoopData(
|
class InvokeLoopData(
|
||||||
val cause: Event?
|
val cause: Event?
|
||||||
)
|
)
|
||||||
|
@ -36,7 +31,7 @@ class InvokeLoopWorker(
|
||||||
the event causing the calculation is not EventNewBg.
|
the event causing the calculation is not EventNewBg.
|
||||||
<p>
|
<p>
|
||||||
*/
|
*/
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as InvokeLoopData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as InvokeLoopData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.aps.AutosensDataStore
|
import info.nightscout.interfaces.aps.AutosensDataStore
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
|
@ -20,18 +19,13 @@ import javax.inject.Inject
|
||||||
class LoadBgDataWorker(
|
class LoadBgDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class LoadBgData(
|
class LoadBgData(
|
||||||
val iobCobCalculator: IobCobCalculator,
|
val iobCobCalculator: IobCobCalculator,
|
||||||
val end: Long
|
val end: Long
|
||||||
|
@ -53,7 +47,7 @@ class LoadBgDataWorker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as LoadBgData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as LoadBgData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.workflow
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.DashPathEffect
|
import android.graphics.DashPathEffect
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import com.jjoe64.graphview.series.LineGraphSeries
|
import com.jjoe64.graphview.series.LineGraphSeries
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.graph.data.ScaledDataPoint
|
import info.nightscout.core.graph.data.ScaledDataPoint
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
|
@ -22,7 +21,7 @@ import javax.inject.Inject
|
||||||
class PrepareBasalDataWorker(
|
class PrepareBasalDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
|
@ -30,7 +29,6 @@ class PrepareBasalDataWorker(
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
private var ctx: Context
|
private var ctx: Context
|
||||||
init {
|
init {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
ctx = rh.getThemedCtx(context)
|
ctx = rh.getThemedCtx(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +37,7 @@ class PrepareBasalDataWorker(
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBasalData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBasalData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
||||||
import info.nightscout.core.graph.data.GlucoseValueDataPoint
|
import info.nightscout.core.graph.data.GlucoseValueDataPoint
|
||||||
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.GlucoseUnit
|
import info.nightscout.interfaces.GlucoseUnit
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
|
@ -23,7 +22,7 @@ import javax.inject.Inject
|
||||||
class PrepareBgDataWorker(
|
class PrepareBgDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
|
@ -31,16 +30,12 @@ class PrepareBgDataWorker(
|
||||||
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class PrepareBgData(
|
class PrepareBgData(
|
||||||
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBgData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBgData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,41 +1,34 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
||||||
import info.nightscout.core.graph.data.InMemoryGlucoseValueDataPoint
|
import info.nightscout.core.graph.data.InMemoryGlucoseValueDataPoint
|
||||||
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PrepareBucketedDataWorker(
|
class PrepareBucketedDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class PrepareBucketedData(
|
class PrepareBucketedData(
|
||||||
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBucketedData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareBucketedData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -3,12 +3,10 @@ package info.nightscout.workflow
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.DashPathEffect
|
import android.graphics.DashPathEffect
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import com.jjoe64.graphview.series.BarGraphSeries
|
import com.jjoe64.graphview.series.BarGraphSeries
|
||||||
import com.jjoe64.graphview.series.LineGraphSeries
|
import com.jjoe64.graphview.series.LineGraphSeries
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
||||||
|
@ -21,6 +19,7 @@ import info.nightscout.core.iob.combine
|
||||||
import info.nightscout.core.iob.copy
|
import info.nightscout.core.iob.copy
|
||||||
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.database.ValueWrapper
|
import info.nightscout.database.ValueWrapper
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
|
@ -32,7 +31,6 @@ import info.nightscout.interfaces.overview.OverviewMenus
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.utils.DecimalFormatter
|
import info.nightscout.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
|
@ -44,20 +42,18 @@ import kotlin.math.min
|
||||||
class PrepareIobAutosensGraphDataWorker(
|
class PrepareIobAutosensGraphDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var overviewMenus: OverviewMenus
|
@Inject lateinit var overviewMenus: OverviewMenus
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
private var ctx: Context
|
private var ctx: Context
|
||||||
|
|
||||||
init {
|
init {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
ctx = rh.getThemedCtx(context)
|
ctx = rh.getThemedCtx(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +112,7 @@ class PrepareIobAutosensGraphDataWorker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareIobAutosensData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareIobAutosensData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_IOB_AUTOSENS_DATA, 0, null))
|
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_IOB_AUTOSENS_DATA, 0, null))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -10,6 +9,7 @@ import info.nightscout.core.graph.data.DataPointWithLabelInterface
|
||||||
import info.nightscout.core.graph.data.GlucoseValueDataPoint
|
import info.nightscout.core.graph.data.GlucoseValueDataPoint
|
||||||
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.aps.Loop
|
import info.nightscout.interfaces.aps.Loop
|
||||||
|
@ -29,7 +29,7 @@ import kotlin.math.min
|
||||||
class PreparePredictionsWorker(
|
class PreparePredictionsWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var overviewData: OverviewData
|
@Inject lateinit var overviewData: OverviewData
|
||||||
|
@ -44,15 +44,11 @@ class PreparePredictionsWorker(
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class PreparePredictionsData(
|
class PreparePredictionsData(
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PreparePredictionsData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PreparePredictionsData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import com.jjoe64.graphview.series.DataPoint
|
import com.jjoe64.graphview.series.DataPoint
|
||||||
import com.jjoe64.graphview.series.LineGraphSeries
|
import com.jjoe64.graphview.series.LineGraphSeries
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.extensions.target
|
import info.nightscout.core.extensions.target
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.database.ValueWrapper
|
import info.nightscout.database.ValueWrapper
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
|
@ -25,7 +24,7 @@ import kotlin.math.max
|
||||||
class PrepareTemporaryTargetDataWorker(
|
class PrepareTemporaryTargetDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
|
@ -35,7 +34,6 @@ class PrepareTemporaryTargetDataWorker(
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
private var ctx: Context
|
private var ctx: Context
|
||||||
init {
|
init {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
ctx = rh.getThemedCtx(context)
|
ctx = rh.getThemedCtx(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +41,7 @@ class PrepareTemporaryTargetDataWorker(
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareTemporaryTargetData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareTemporaryTargetData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.graph.data.BolusDataPoint
|
import info.nightscout.core.graph.data.BolusDataPoint
|
||||||
|
@ -15,6 +13,7 @@ import info.nightscout.core.graph.data.ExtendedBolusDataPoint
|
||||||
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
||||||
import info.nightscout.core.graph.data.TherapyEventDataPoint
|
import info.nightscout.core.graph.data.TherapyEventDataPoint
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.database.entities.Bolus
|
import info.nightscout.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import info.nightscout.database.entities.TherapyEvent
|
||||||
|
@ -34,7 +33,7 @@ import javax.inject.Inject
|
||||||
class PrepareTreatmentsDataWorker(
|
class PrepareTreatmentsDataWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
|
@ -45,15 +44,11 @@ class PrepareTreatmentsDataWorker(
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class PrepareTreatmentsData(
|
class PrepareTreatmentsData(
|
||||||
val overviewData: OverviewData
|
val overviewData: OverviewData
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareTreatmentsData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as PrepareTreatmentsData?
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
@ -14,16 +13,12 @@ import javax.inject.Inject
|
||||||
class UpdateGraphWorker(
|
class UpdateGraphWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
if (inputData.getString(CalculationWorkflow.JOB) == CalculationWorkflow.MAIN_CALCULATION)
|
if (inputData.getString(CalculationWorkflow.JOB) == CalculationWorkflow.MAIN_CALCULATION)
|
||||||
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewGraph("UpdateGraphWorker"))
|
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewGraph("UpdateGraphWorker"))
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package info.nightscout.workflow
|
package info.nightscout.workflow
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import dagger.android.HasAndroidInjector
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventUpdateOverviewIobCob
|
import info.nightscout.rx.events.EventUpdateOverviewIobCob
|
||||||
|
@ -13,16 +12,12 @@ import javax.inject.Inject
|
||||||
class UpdateIobCobSensWorker(
|
class UpdateIobCobSensWorker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
|
|
||||||
init {
|
override fun doWorkAndLog(): Result {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doWork(): Result {
|
|
||||||
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewIobCob("UpdateIobCobSensWorker"))
|
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewIobCob("UpdateIobCobSensWorker"))
|
||||||
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewSensitivity("UpdateIobCobSensWorker"))
|
activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewSensitivity("UpdateIobCobSensWorker"))
|
||||||
return Result.success()
|
return Result.success()
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.workflow.iob
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -11,6 +10,7 @@ import info.nightscout.core.extensions.target
|
||||||
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.database.ValueWrapper
|
import info.nightscout.database.ValueWrapper
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
|
@ -27,7 +27,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.fromCarbs
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -44,9 +43,8 @@ import kotlin.math.roundToLong
|
||||||
class IobCobOref1Worker(
|
class IobCobOref1Worker(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
@ -60,10 +58,6 @@ class IobCobOref1Worker(
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class IobCobOref1WorkerData(
|
class IobCobOref1WorkerData(
|
||||||
val injector: HasAndroidInjector,
|
val injector: HasAndroidInjector,
|
||||||
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
val iobCobCalculator: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
||||||
|
@ -73,7 +67,7 @@ class IobCobOref1Worker(
|
||||||
val cause: Event?
|
val cause: Event?
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
|
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as IobCobOref1WorkerData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as IobCobOref1WorkerData?
|
||||||
?: return Result.success(workDataOf("Error" to "missing input data"))
|
?: return Result.success(workDataOf("Error" to "missing input data"))
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.workflow.iob
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.work.Worker
|
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -10,6 +9,7 @@ import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
|
import info.nightscout.core.utils.worker.LoggingWorker
|
||||||
import info.nightscout.core.workflow.CalculationWorkflow
|
import info.nightscout.core.workflow.CalculationWorkflow
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
|
@ -25,7 +25,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.fromCarbs
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -40,9 +39,8 @@ import kotlin.math.roundToLong
|
||||||
class IobCobOrefWorker @Inject internal constructor(
|
class IobCobOrefWorker @Inject internal constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
params: WorkerParameters
|
params: WorkerParameters
|
||||||
) : Worker(context, params) {
|
) : LoggingWorker(context, params) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
@ -56,10 +54,6 @@ class IobCobOrefWorker @Inject internal constructor(
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||||
|
|
||||||
init {
|
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class IobCobOrefWorkerData(
|
class IobCobOrefWorkerData(
|
||||||
val injector: HasAndroidInjector,
|
val injector: HasAndroidInjector,
|
||||||
val iobCobCalculatorPlugin: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
val iobCobCalculatorPlugin: IobCobCalculator, // cannot be injected : HistoryBrowser uses different instance
|
||||||
|
@ -69,7 +63,7 @@ class IobCobOrefWorker @Inject internal constructor(
|
||||||
val cause: Event?
|
val cause: Event?
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWorkAndLog(): Result {
|
||||||
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as IobCobOrefWorkerData?
|
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) as IobCobOrefWorkerData?
|
||||||
?: return Result.success(workDataOf("Error" to "missing input data"))
|
?: return Result.success(workDataOf("Error" to "missing input data"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue