1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 19:49:30 +01:00

OK, just connect(true) is not sufficient #249

(we again get connection problems. Let's try this.)
This commit is contained in:
cpfeiffer 2016-04-07 20:52:26 +02:00
parent a49335fa67
commit 1e5dbb6a23

View File

@ -157,11 +157,12 @@ 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;
synchronized (mGattMonitor) { synchronized (mGattMonitor) {
mBluetoothGatt = remoteDevice.connectGatt(mContext, true, internalGattCallback); mBluetoothGatt = remoteDevice.connectGatt(mContext, true, internalGattCallback);
// result = mBluetoothGatt.connect(); result = mBluetoothGatt.connect();
} }
boolean result = mBluetoothGatt != null; // boolean result = mBluetoothGatt != null;
if (result) { if (result) {
setDeviceConnectionState(State.CONNECTING); setDeviceConnectionState(State.CONNECTING);
} }