in rx-central-ble/src/main/java/com/uber/rxcentralble/core/CorePeripheral.java [316:343]
private void processRegisterNotification(
SingleSubject<UUID> scopedSubject, UUID svc, UUID chr, @Nullable Preprocessor preprocessor) {
synchronized (syncRoot) {
PeripheralError error = subscribeChecks();
if (error != null) {
scopedSubject.onError(error);
return;
}
BluetoothGattCharacteristic characteristic = getCharacteristic(svc, chr);
if (characteristic == null) {
scopedSubject.onError(new PeripheralError(MISSING_CHARACTERISTIC));
return;
}
registerNotificationSubject = scopedSubject;
currentOperation = registerNotificationSubject;
if (bluetoothGatt != null) {
error = setCharacteristicNotification(bluetoothGatt, characteristic, true);
if (error != null) {
registerNotificationSubject.onError(new PeripheralError(REGISTER_NOTIFICATION_FAILED, error));
} else {
preprocessorMap.put(chr, preprocessor);
}
}
}
}