Bluetooth BLE service returns status = 10 at onCharacteristicRead

倾然丶 夕夏残阳落幕 提交于 2019-12-02 08:54:36

问题


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

来源:https://stackoverflow.com/questions/23763090/bluetooth-ble-service-returns-status-10-at-oncharacteristicread

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