You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to look in the documentation and in the code itself for the answer to the question I ask in the title: is it possible to choose whether to subscribe to a characteristic by notification or indication?
(I am in charge of the BLE device firmware, so my knowledge of mobile development is limited. I say this to apologize in advance in case the question is dumb, simple or obvious 😅).
The thing is, I don't know if you can choose whether subscribing to a characteristic via the "subscribeToCharacteristic" method makes use of notifications or indications (i.e. if it will acknowledge or not when receiving data).
I have seen this in the PhilipsHue/flutter_reactive_ble/packages/reactive_ble_mobile/android/src/main/kotlin/com/signify/hue/flutterreactiveble/ble/ReactiveBleClient.kt file:
privatefunsetupNotificationOrIndication(
deviceConnection:EstablishConnectionResult,
characteristicId:UUID,
characteristicInstanceId:Int
): Observable<Observable<ByteArray>> =when (deviceConnection) {
isEstablishedConnection-> {
if (rxBleClient.getBleDevice(deviceConnection.deviceId).bluetoothDevice.bondState ==BOND_BONDING) {
Observable.error(Exception("Bonding is in progress wait for bonding to be finished before executing more operations on the device"))
} else {
deviceConnection.rxConnection.resolveCharacteristic(
characteristicId, characteristicInstanceId
).flatMapObservable { characteristic ->val mode =if (characteristic.descriptors.isEmpty()) {
NotificationSetupMode.COMPAT
} else {
NotificationSetupMode.DEFAULT
}
if ((characteristic.properties andBluetoothGattCharacteristic.PROPERTY_NOTIFY) >0) {
deviceConnection.rxConnection.setupNotification(
characteristic,
mode
)
} else {
deviceConnection.rxConnection.setupIndication(characteristic, mode)
}
}
}
}
isEstablishConnectionFailure-> {
Observable.just(Observable.empty())
}
}
In the iOS implementation I haven't even dared to go in to check it out...
I am supposed to assume that if a characteristic has notification permission enabled it is subscribed by notification and only if notification permission is not enabled then it is subscribed by indication? Which would mean that I can't have both permissions enabled. (My Kotlin knowledge is 0...)
Thanks in advance and apologies if the question is dumb...🙇♂️
The text was updated successfully, but these errors were encountered:
I tried to look in the documentation and in the code itself for the answer to the question I ask in the title: is it possible to choose whether to subscribe to a characteristic by notification or indication?
(I am in charge of the BLE device firmware, so my knowledge of mobile development is limited. I say this to apologize in advance in case the question is dumb, simple or obvious 😅).
The thing is, I don't know if you can choose whether subscribing to a characteristic via the "subscribeToCharacteristic" method makes use of notifications or indications (i.e. if it will acknowledge or not when receiving data).
I have seen this in the
PhilipsHue/flutter_reactive_ble/packages/reactive_ble_mobile/android/src/main/kotlin/com/signify/hue/flutterreactiveble/ble/ReactiveBleClient.kt
file:In the iOS implementation I haven't even dared to go in to check it out...
I am supposed to assume that if a characteristic has notification permission enabled it is subscribed by notification and only if notification permission is not enabled then it is subscribed by indication? Which would mean that I can't have both permissions enabled. (My Kotlin knowledge is 0...)
Thanks in advance and apologies if the question is dumb...🙇♂️
The text was updated successfully, but these errors were encountered: