1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Log any exceptions during ble callbacks, if any #91

This commit is contained in:
cpfeiffer 2015-10-04 00:00:53 +02:00
parent 5b8bf468f5
commit 9db7d13a94

View File

@ -365,7 +365,11 @@ public final class BtLEQueue {
return; return;
} }
if (getCallbackToUse() != null) { if (getCallbackToUse() != null) {
try {
getCallbackToUse().onCharacteristicRead(gatt, characteristic, status); getCallbackToUse().onCharacteristicRead(gatt, characteristic, status);
} catch (Throwable ex) {
LOG.error("onCharaceristicRead: " + ex.getMessage(), ex);
}
} }
checkWaitingCharacteristic(characteristic, status); checkWaitingCharacteristic(characteristic, status);
} }
@ -377,7 +381,11 @@ public final class BtLEQueue {
return; return;
} }
if (getCallbackToUse() != null) { if (getCallbackToUse() != null) {
try {
getCallbackToUse().onDescriptorRead(gatt, descriptor, status); getCallbackToUse().onDescriptorRead(gatt, descriptor, status);
} catch (Throwable ex) {
LOG.error("onDescriptorRead: " + ex.getMessage(), ex);
}
} }
checkWaitingCharacteristic(descriptor.getCharacteristic(), status); checkWaitingCharacteristic(descriptor.getCharacteristic(), status);
} }
@ -389,7 +397,11 @@ public final class BtLEQueue {
return; return;
} }
if (getCallbackToUse() != null) { if (getCallbackToUse() != null) {
try {
getCallbackToUse().onDescriptorWrite(gatt, descriptor, status); getCallbackToUse().onDescriptorWrite(gatt, descriptor, status);
} catch (Throwable ex) {
LOG.error("onDescriptorWrite: " + ex.getMessage(), ex);
}
} }
checkWaitingCharacteristic(descriptor.getCharacteristic(), status); checkWaitingCharacteristic(descriptor.getCharacteristic(), status);
} }
@ -402,7 +414,11 @@ public final class BtLEQueue {
return; return;
} }
if (getCallbackToUse() != null) { if (getCallbackToUse() != null) {
try {
getCallbackToUse().onCharacteristicChanged(gatt, characteristic); getCallbackToUse().onCharacteristicChanged(gatt, characteristic);
} catch (Throwable ex) {
LOG.error("onCharaceristicChanged: " + ex.getMessage(), ex);
}
} else { } else {
LOG.info("No gattcallback registered, ignoring characteristic change"); LOG.info("No gattcallback registered, ignoring characteristic change");
} }
@ -415,7 +431,11 @@ public final class BtLEQueue {
return; return;
} }
if (getCallbackToUse() != null) { if (getCallbackToUse() != null) {
try {
getCallbackToUse().onReadRemoteRssi(gatt, rssi, status); getCallbackToUse().onReadRemoteRssi(gatt, rssi, status);
} catch (Throwable ex) {
LOG.error("onReadRemoteRssi: " + ex.getMessage(), ex);
}
} }
} }
@ -446,6 +466,4 @@ public final class BtLEQueue {
mTransactionGattCallback = null; mTransactionGattCallback = null;
} }
} }
;
} }