Gatt 133 exception on read characteristic and followed by gatt 22

让人想犯罪 __ 提交于 2019-11-27 07:25:34

问题


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);
        }
    }

来源:https://stackoverflow.com/questions/47596419/gatt-133-exception-on-read-characteristic-and-followed-by-gatt-22

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!