This commit is contained in:
Milos Kozak 2020-04-24 22:40:11 +02:00
commit 8db0dbd78d
2 changed files with 6 additions and 5 deletions

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.events package info.nightscout.androidaps.events
class EventBTChange constructor(val state: Change, val deviceName: String?) : Event() { class EventBTChange(val state: Change, val deviceName: String?, val deviceAddress: String? = null) : Event() {
enum class Change { enum class Change {
CONNECT, CONNECT,
DISCONNECT DISCONNECT

View file

@ -17,9 +17,9 @@ class BTReceiver : DaggerBroadcastReceiver() {
when (intent.action) { when (intent.action) {
BluetoothDevice.ACTION_ACL_CONNECTED -> BluetoothDevice.ACTION_ACL_CONNECTED ->
rxBus.send(EventBTChange(EventBTChange.Change.CONNECT, device.name)) rxBus.send(EventBTChange(EventBTChange.Change.CONNECT, deviceName = device.name, deviceAddress = device.address))
BluetoothDevice.ACTION_ACL_DISCONNECTED -> BluetoothDevice.ACTION_ACL_DISCONNECTED ->
rxBus.send(EventBTChange(EventBTChange.Change.DISCONNECT, device.name)) rxBus.send(EventBTChange(EventBTChange.Change.DISCONNECT, deviceName = device.name, deviceAddress = device.address))
} }
} }
} }