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

here
cpfeiffer 2016-04-09 09:53:03 +02:00
parent 42dda911e4
commit 802e9a8235
1 changed files with 5 additions and 4 deletions

View File

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