1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-30 22:12:55 +01:00

OK, revert to connectGatt(false), connect often does not work with true #249

This commit is contained in:
cpfeiffer 2016-04-09 09:53:03 +02:00
parent 42dda911e4
commit 802e9a8235

View File

@ -157,12 +157,13 @@ public final class BtLEQueue {
LOG.info("Attempting to connect to " + mGbDevice.getName()); LOG.info("Attempting to connect to " + mGbDevice.getName());
mBluetoothAdapter.cancelDiscovery(); mBluetoothAdapter.cancelDiscovery();
BluetoothDevice remoteDevice = mBluetoothAdapter.getRemoteDevice(mGbDevice.getAddress()); BluetoothDevice remoteDevice = mBluetoothAdapter.getRemoteDevice(mGbDevice.getAddress());
boolean result; // boolean result;
synchronized (mGattMonitor) { synchronized (mGattMonitor) {
mBluetoothGatt = remoteDevice.connectGatt(mContext, true, internalGattCallback); // connectGatt with true doesn't really work ;( too often connection problems
result = mBluetoothGatt.connect(); mBluetoothGatt = remoteDevice.connectGatt(mContext, false, internalGattCallback);
// result = mBluetoothGatt.connect();
} }
// boolean result = mBluetoothGatt != null; boolean result = mBluetoothGatt != null;
if (result) { if (result) {
setDeviceConnectionState(State.CONNECTING); setDeviceConnectionState(State.CONNECTING);
} }