[M] Move field declaration to the top
This commit is contained in:
@@ -12,7 +12,9 @@ import java.nio.ByteOrder
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
internal class BluetoothHandler private constructor(context: Context) {
|
internal class BluetoothHandler private constructor(context: Context) {
|
||||||
private var currentTimeCounter = 0
|
var central: BluetoothCentralManager
|
||||||
|
val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||||
|
|
||||||
val batteryChannel = Channel<BatteryMeasurement>(UNLIMITED)
|
val batteryChannel = Channel<BatteryMeasurement>(UNLIMITED)
|
||||||
val heartRateChannel = Channel<HeartRateMeasurement>(UNLIMITED)
|
val heartRateChannel = Channel<HeartRateMeasurement>(UNLIMITED)
|
||||||
val bloodPressureChannel = Channel<BloodPressureMeasurement>(UNLIMITED)
|
val bloodPressureChannel = Channel<BloodPressureMeasurement>(UNLIMITED)
|
||||||
@@ -40,7 +42,6 @@ internal class BluetoothHandler private constructor(context: Context) {
|
|||||||
peripheral.setupNotification(pulseOxSpotChannel, PLXSpotDecoder())
|
peripheral.setupNotification(pulseOxSpotChannel, PLXSpotDecoder())
|
||||||
peripheral.setupNotification(pulseOxContinuousChannel, PLXContinuousDecoder())
|
peripheral.setupNotification(pulseOxContinuousChannel, PLXContinuousDecoder())
|
||||||
setupGLXnotifications(peripheral)
|
setupGLXnotifications(peripheral)
|
||||||
setupCTSnotifications(peripheral)
|
|
||||||
|
|
||||||
peripheral.getCharacteristic(CONTOUR_SERVICE_UUID, CONTOUR_CLOCK)?.let {
|
peripheral.getCharacteristic(CONTOUR_SERVICE_UUID, CONTOUR_CLOCK)?.let {
|
||||||
writeContourClock(peripheral)
|
writeContourClock(peripheral)
|
||||||
@@ -149,15 +150,9 @@ internal class BluetoothHandler private constructor(context: Context) {
|
|||||||
getCharacteristic(decoder.sid, decoder.cid)?.let { decoder.decode(readCharacteristic(it)) }
|
getCharacteristic(decoder.sid, decoder.cid)?.let { decoder.decode(readCharacteristic(it)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmField
|
|
||||||
var central: BluetoothCentralManager
|
|
||||||
|
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Timber.plant(DebugTree())
|
Timber.plant(DebugTree())
|
||||||
central = BluetoothCentralManager(context)
|
central = BluetoothCentralManager(context)
|
||||||
|
|
||||||
central.observeConnectionState { peripheral, state ->
|
central.observeConnectionState { peripheral, state ->
|
||||||
Timber.i("Peripheral '${peripheral.name}' is $state")
|
Timber.i("Peripheral '${peripheral.name}' is $state")
|
||||||
when (state) {
|
when (state) {
|
||||||
@@ -170,8 +165,7 @@ internal class BluetoothHandler private constructor(context: Context) {
|
|||||||
central.autoConnectPeripheral(peripheral)
|
central.autoConnectPeripheral(peripheral)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user