mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 15:32:04 +02:00
adding a delay of 500 ms between the end of the BLE scan and the beginning of a connection
This commit is contained in:
@@ -517,8 +517,13 @@ public abstract class BluetoothCommunication {
|
|||||||
Timber.d("Stop Le san");
|
Timber.d("Stop Le san");
|
||||||
scanSubscription.dispose();
|
scanSubscription.dispose();
|
||||||
scanSubscription = null;
|
scanSubscription = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handler handler = new Handler();
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Timber.d("Try to connect to BLE device " + macAddress);
|
Timber.d("Try to connect to BLE device " + macAddress);
|
||||||
|
|
||||||
connectionObservable = bleDevice
|
connectionObservable = bleDevice
|
||||||
@@ -540,6 +545,8 @@ public abstract class BluetoothCommunication {
|
|||||||
setBtMachineState(BT_MACHINE_STATE.BT_INIT_STATE);
|
setBtMachineState(BT_MACHINE_STATE.BT_INIT_STATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
private void setBtMonitoringOn() {
|
private void setBtMonitoringOn() {
|
||||||
final Disposable disposableConnectionState = bleDevice.observeConnectionStateChanges()
|
final Disposable disposableConnectionState = bleDevice.observeConnectionStateChanges()
|
||||||
|
Reference in New Issue
Block a user