ignore connection state changes with status != GATT_SUCCESS
And add logging. Maybe this helps with #57
This commit is contained in:
parent
228e922ce7
commit
75b9fe4c4d
|
@ -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.");
|
||||||
|
|
Loading…
Reference in New Issue