1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 11:05:49 +01:00

Small improvement to connect()

This commit is contained in:
cpfeiffer 2015-10-22 00:32:16 +02:00
parent 3b94a96060
commit ac120dc7d6

View File

@ -155,12 +155,15 @@ public final class BtLEQueue {
} }
LOG.info("Attempting to connect to " + mGbDevice.getName()); LOG.info("Attempting to connect to " + mGbDevice.getName());
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);
mBluetoothGatt.connect(); result = mBluetoothGatt.connect();
} }
if (result) {
setDeviceConnectionState(State.CONNECTING); setDeviceConnectionState(State.CONNECTING);
return true; }
return result;
} }
private void setDeviceConnectionState(State newState) { private void setDeviceConnectionState(State newState) {