[+] Ability to close a ble
This commit is contained in:
@@ -86,6 +86,7 @@ class ActivityScan : AppCompatActivity() {
|
|||||||
{
|
{
|
||||||
view.snack("✅ Connected.")
|
view.snack("✅ Connected.")
|
||||||
prefs.chosenDevice = address
|
prefs.chosenDevice = address
|
||||||
|
ble.close()
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,11 @@ internal class BluetoothHandler private constructor(context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun close() {
|
||||||
|
central.close()
|
||||||
|
instance = null
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val decoders = listOf(BatteryDecoder(), BloodPressureDecoder(), GlucoseDecoder(), HeartRateDecoder(),
|
val decoders = listOf(BatteryDecoder(), BloodPressureDecoder(), GlucoseDecoder(), HeartRateDecoder(),
|
||||||
PLXSpotDecoder(), PLXContinuousDecoder(), TemperatureDecoder(), WeightDecoder())
|
PLXSpotDecoder(), PLXContinuousDecoder(), TemperatureDecoder(), WeightDecoder())
|
||||||
|
|||||||
Reference in New Issue
Block a user