Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
553 views
in Technique[技术] by (71.8m points)

android - Gatt 133 exception on read characteristic and followed by gatt 22

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("
perform 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);
        }
    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...