Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...