RS: reset isConnected & isConnecting on error
This commit is contained in:
parent
52e4496add
commit
4d474ddbdb
1 changed files with 8 additions and 0 deletions
|
@ -257,6 +257,8 @@ public class BLEComm {
|
||||||
log.debug("setCharacteristicNotification");
|
log.debug("setCharacteristicNotification");
|
||||||
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
||||||
log.debug("BluetoothAdapter not initialized_ERROR");
|
log.debug("BluetoothAdapter not initialized_ERROR");
|
||||||
|
isConnecting = false;
|
||||||
|
isConnected = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
|
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
|
||||||
|
@ -266,6 +268,8 @@ public class BLEComm {
|
||||||
log.debug("readCharacteristic");
|
log.debug("readCharacteristic");
|
||||||
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
||||||
log.debug("BluetoothAdapter not initialized_ERROR");
|
log.debug("BluetoothAdapter not initialized_ERROR");
|
||||||
|
isConnecting = false;
|
||||||
|
isConnected = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mBluetoothGatt.readCharacteristic(characteristic);
|
mBluetoothGatt.readCharacteristic(characteristic);
|
||||||
|
@ -274,6 +278,8 @@ public class BLEComm {
|
||||||
public void writeCharacteristic_NO_RESPONSE(final BluetoothGattCharacteristic characteristic, final byte[] data) {
|
public void writeCharacteristic_NO_RESPONSE(final BluetoothGattCharacteristic characteristic, final byte[] data) {
|
||||||
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
||||||
log.debug("BluetoothAdapter not initialized_ERROR");
|
log.debug("BluetoothAdapter not initialized_ERROR");
|
||||||
|
isConnecting = false;
|
||||||
|
isConnected = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +312,8 @@ public class BLEComm {
|
||||||
log.debug("getSupportedGattServices");
|
log.debug("getSupportedGattServices");
|
||||||
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
||||||
log.debug("BluetoothAdapter not initialized_ERROR");
|
log.debug("BluetoothAdapter not initialized_ERROR");
|
||||||
|
isConnecting = false;
|
||||||
|
isConnected = false;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue