mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
ignore connection state changes with status != GATT_SUCCESS
And add logging. Maybe this helps with #57
This commit is contained in:
@@ -237,10 +237,17 @@ public final class BtLEQueue {
|
|||||||
private final BluetoothGattCallback internalGattCallback = new BluetoothGattCallback() {
|
private final BluetoothGattCallback internalGattCallback = new BluetoothGattCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
||||||
|
LOG.debug("connection state change: status: " + status + ", newState: " + newState);
|
||||||
|
|
||||||
if (!checkCorrectGattInstance(gatt, "connection state event")) {
|
if (!checkCorrectGattInstance(gatt, "connection state event")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status != BluetoothGatt.GATT_SUCCESS) {
|
||||||
|
LOG.warn("ignoring connection state event with status " + status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case BluetoothProfile.STATE_CONNECTED:
|
case BluetoothProfile.STATE_CONNECTED:
|
||||||
LOG.info("Connected to GATT server.");
|
LOG.info("Connected to GATT server.");
|
||||||
|
Reference in New Issue
Block a user