fix receivers

This commit is contained in:
Milos Kozak 2020-03-18 00:22:21 +01:00
parent 46efb92d3d
commit 000cf31deb
2 changed files with 6 additions and 2 deletions

View file

@ -5,17 +5,19 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import javax.inject.Inject
class RileyLinkBluetoothStateReceiver : BroadcastReceiver() {
class RileyLinkBluetoothStateReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var activePlugin: ActivePluginProvider
override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
val action = intent.action
if (action != null) {
val state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR)

View file

@ -4,17 +4,19 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.PumpInterface
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import javax.inject.Inject
class TimeDateOrTZChangeReceiver : BroadcastReceiver() {
class TimeDateOrTZChangeReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var activePlugin: ActivePluginProvider
override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
val action = intent.action
val activePump: PumpInterface = activePlugin.getActivePump()
aapsLogger.debug(LTag.PUMP, "Date, Time and/or TimeZone changed.")