in rx-central-ble/src/main/java/com/uber/rxcentralble/core/CoreConnectionManager.java [120:134]
public Observable<Peripheral> connect(BluetoothDevice bluetoothDevice, int connectionTimeoutMs) {
if (sharedPeripheralObservable != null) {
return sharedPeripheralObservable;
}
this.connectionTimeoutMs = connectionTimeoutMs;
this.sharedPeripheralObservable = bluetoothDetector
.enabled()
.distinctUntilChanged()
.filter(enabled -> enabled)
.switchMap(enabled -> connect(bluetoothDevice))
.compose(shareConnection());
return sharedPeripheralObservable;
}