cleaner way to find ble services

This commit is contained in:
geeksville
2020-02-25 08:23:26 -08:00
parent 6f9316ce99
commit dac3610f7d

View File

@@ -170,7 +170,12 @@ class RadioInterfaceService : Service(), Logging {
// Both of these are created in onCreate()
private var safe: SafeBluetooth? = null
val service get() = safe!!.gatt!!.services.find { it.uuid == BTM_SERVICE_UUID }!!
/// Our BLE device
val device get() = safe!!.gatt!!
/// Our service
val service get() = device.getService(BTM_SERVICE_UUID)
//.services.find { it.uuid == BTM_SERVICE_UUID }!!
private lateinit var fromNum: BluetoothGattCharacteristic