Bluetooth BLE service returns status = 10 at onCha

2020-04-21 01:27发布

I try to read some configurations from a device I'm connected to, but on the callback - onCharacteristicRead the parameter status=10.

I noticed that status == 0 meas BluetoothGatt.GATT_SUCCESS.

WHAT DOES 10 STANDS FOR????

My code is as follows:

    public boolean read(byte[] bytes, String action) {
    // is copied from android website example
    if (mBluetoothAdapter == null || mBluetoothGatt == null) {
        Log.w(TAG, "BluetoothAdapter not initialized");
        return false;
    }
    BluetoothGattService mCC2540_service = mBluetoothGatt.getService(UUID.fromString(mCC2540_SERVICE_UUID));
    if (mCC2540_service == null){
        Log.e(TAG, "mCC2540_service == null");
        return false;
    }
    BluetoothGattCharacteristic bluetoothGattCharacteristic = mCC2540_service.getCharacteristic(UUID.fromString("0000fffc-0000-1000-8000-00805f9b34fb"));
    bluetoothGattCharacteristic.setValue(bytes);


    if ((bluetoothGattCharacteristic.getProperties() | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
        mBluetoothGatt.setCharacteristicNotification(bluetoothGattCharacteristic, true);
    }

    boolean status = mBluetoothGatt.readCharacteristic(bluetoothGattCharacteristic);
    Log.d(TAG, "read() command sent");
    return status;
}

0条回答
登录 后发表回答