make it compile
This commit is contained in:
parent
8d23df61bd
commit
bf889793f0
1 changed files with 7 additions and 3 deletions
|
@ -27,10 +27,14 @@ class ServiceDiscoverer(
|
||||||
fun discoverServices(connectionWaitCond: ConnectionWaitCondition): Map<CharacteristicType, BluetoothGattCharacteristic> {
|
fun discoverServices(connectionWaitCond: ConnectionWaitCondition): Map<CharacteristicType, BluetoothGattCharacteristic> {
|
||||||
logger.debug(LTag.PUMPBTCOMM, "Discovering services")
|
logger.debug(LTag.PUMPBTCOMM, "Discovering services")
|
||||||
bleCallbacks.startServiceDiscovery()
|
bleCallbacks.startServiceDiscovery()
|
||||||
|
try {
|
||||||
val discover = gatt.discoverServices()
|
val discover = gatt.discoverServices()
|
||||||
if (!discover) {
|
if (!discover) {
|
||||||
throw ConnectException("Could not start discovering services`")
|
throw ConnectException("Could not start discovering services`")
|
||||||
}
|
}
|
||||||
|
} catch (ex: SecurityException) {
|
||||||
|
throw ConnectException("Missing bluetooth permission")
|
||||||
|
}
|
||||||
connectionWaitCond.timeoutMs?.let {
|
connectionWaitCond.timeoutMs?.let {
|
||||||
bleCallbacks.waitForServiceDiscovery(it)
|
bleCallbacks.waitForServiceDiscovery(it)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue