Problem:
I am getting a GATT exception 133 when trying to read the characteristics.
I made a delay to read but unfortunately it doesn't works followed by the GATT 22 error.
It happens on few devices but i don't know how to solve this problem.
Code:
public void performRead() {
printMessage("\nperform READ started...");
UUID serviceuid = UUID.fromString(UUID_SERVICE);
if (BDA.getmBluetoothGatt() == null)
return;
BluetoothGattService service = BDA.getmBluetoothGatt().getService(
serviceuid);
UUID characteristicuid = UUID.fromString(UUID_CHARACTERISTIC_STATUS);
BluetoothGattCharacteristic characteristic = null;
if (service != null) {
characteristic = service.getCharacteristic(characteristicuid);
}
if (characteristic != null) {
boolean isSuccess = BDA.getmBluetoothGatt().readCharacteristic(characteristic);
printMessage("isSuccess fire = " + isSuccess);
}
}
Callback:
@Override
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicRead(gatt, characteristic, status);
String intentAction = "";
if (status == BluetoothGatt.GATT_SUCCESS) {
intentAction = MyUtils.ACTION_READ_SUCCESS;
broadcastNotifyUpdate(characteristic,intentAction);
} else {//**status - 133
intentAction = MyUtils.ACTION_GATT_CHARACTERISTIC_ERROR;
broadcastUpdate(intentAction,""+status);
}
}