1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 12:00:51 +02:00

ignore connection state changes with status != GATT_SUCCESS

And add logging. Maybe this helps with #57
This commit is contained in:
cpfeiffer 2015-05-24 23:12:54 +02:00
parent 228e922ce7
commit 75b9fe4c4d

View File

@ -237,10 +237,17 @@ public final class BtLEQueue {
private final BluetoothGattCallback internalGattCallback = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
LOG.debug("connection state change: status: " + status + ", newState: " + newState);
if (!checkCorrectGattInstance(gatt, "connection state event")) {
return;
}
if (status != BluetoothGatt.GATT_SUCCESS) {
LOG.warn("ignoring connection state event with status " + status);
return;
}
switch (newState) {
case BluetoothProfile.STATE_CONNECTED:
LOG.info("Connected to GATT server.");