public Single<BluetoothGattCharacteristic> getCharacteristic(@NonNull final UUID characteristicUuid) {
        return Single.fromCallable(new Callable<BluetoothGattCharacteristic>() {
            @Override
            public BluetoothGattCharacteristic call() throws Exception {
                for (BluetoothGattService service : bluetoothGattServices) {
                    BluetoothGattCharacteristic characteristic = service.getCharacteristic(characteristicUuid);
                    if (characteristic != null) {
                        return characteristic;
                    }
                }
                throw new BleCharacteristicNotFoundException(characteristicUuid);
            }
        });
    }
public Single < BluetoothGattCharacteristic > getCharacteristic ( @ NonNull final UUID characteristicUuid ) { return Single . fromCallable ( new Callable < BluetoothGattCharacteristic > ( ) { @ Override public BluetoothGattCharacteristic call ( ) throws Exception { for ( BluetoothGattService service : bluetoothGattServices ) { BluetoothGattCharacteristic characteristic = service . getCharacteristic ( characteristicUuid ) ; if ( characteristic != null ) { return characteristic ; } } throw new BleCharacteristicNotFoundException ( characteristicUuid ) ; } } ) ; }
Creates an observable emitting {@link BluetoothGattCharacteristic} with matching characteristic UUID.
The observable completes after first emission.
<p>
The main assumption is that characteristics have unique UUID across all services as there is a traversal done
across all of them. For an alternative see RxBleDeviceServices#getCharacteristic(UUID)

@param characteristicUuid Characteristic UUID to be found
@return Observable emitting matching characteristic or error if hasn't been found.
@throws BleCharacteristicNotFoundException if characteristic with given UUID hasn't been found.