private static ObservableTransformer<RxBleInternalScanResult, RxBleInternalScanResult> splitByAddressAndForEach(
            final ObservableTransformer<RxBleInternalScanResult, RxBleInternalScanResult> compose
    ) {
        return new ObservableTransformer<RxBleInternalScanResult, RxBleInternalScanResult>() {
            @Override
            public Observable<RxBleInternalScanResult> apply(Observable<RxBleInternalScanResult> observable) {
                return observable
                        .groupBy(new Function<RxBleInternalScanResult, String>() {
                            @Override
                            public String apply(RxBleInternalScanResult rxBleInternalScanResult) {
                                return rxBleInternalScanResult.getBluetoothDevice().getAddress();
                            }
                        })
                        .flatMap(new Function<GroupedObservable<String, RxBleInternalScanResult>, Observable<RxBleInternalScanResult>>() {
                            @Override
                            public Observable<RxBleInternalScanResult> apply(
                                    GroupedObservable<String, RxBleInternalScanResult> groupedObservable) {
                                return groupedObservable.compose(compose);
                            }
                        });
            }
        };
    }
A convenience method for running a scan for a period of time and repeat in five seconds intervals.

@param windowInMillis window for which the observable should be active
@return Observable.Transformer that will take the original observable for specific time and repeat subscription after 5 seconds
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/scan/ScanSettingsEmulator.java