Проблема:
Я получаю исключение 133 GATT при попытке прочитать характеристики.
Я сделал задержку для чтения, но, к сожалению, это не работает, а затем возникает ошибка GATT 22.
Это происходит на нескольких устройствах, но я не знаю, как решить эту проблему.
Код:
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);
}
}
Обратный звонок:
@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);
}
}