mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 23:41:45 +02:00
Stop LE scan when services have been discovered
Let us see if this improves #252
This commit is contained in:
@@ -521,11 +521,6 @@ public abstract class BluetoothCommunication {
|
||||
Timber.d("onConnectionStateChange: status=%d, newState=%d", status, newState);
|
||||
|
||||
if (newState == BluetoothProfile.STATE_CONNECTED) {
|
||||
if (leScanCallback != null) {
|
||||
btAdapter.stopLeScan(leScanCallback);
|
||||
leScanCallback = null;
|
||||
}
|
||||
|
||||
connectionEstablished = true;
|
||||
setBtStatus(BT_STATUS_CODE.BT_CONNECTION_ESTABLISHED);
|
||||
gatt.discoverServices();
|
||||
@@ -542,6 +537,11 @@ public abstract class BluetoothCommunication {
|
||||
public void onServicesDiscovered(final BluetoothGatt gatt, int status) {
|
||||
Timber.d("onServicesDiscovered: status=%d", status);
|
||||
|
||||
if (leScanCallback != null) {
|
||||
btAdapter.stopLeScan(leScanCallback);
|
||||
leScanCallback = null;
|
||||
}
|
||||
|
||||
synchronized (lock) {
|
||||
cmdStepNr = 0;
|
||||
initStepNr = 0;
|
||||
|
Reference in New Issue
Block a user