Example usage for android.bluetooth BluetoothGattDescriptor getCharacteristic

List of usage examples for android.bluetooth BluetoothGattDescriptor getCharacteristic

Introduction

In this page you can find the example usage for android.bluetooth BluetoothGattDescriptor getCharacteristic.

Prototype

public BluetoothGattCharacteristic getCharacteristic() 

Source Link

Document

Returns the characteristic this descriptor belongs to.

Usage

From source file:com.google.android.apps.forscience.ble.MyBleService.java

public void writeValue(String address, BluetoothGattDescriptor descriptor, byte[] value) {
    BluetoothGatt bluetoothGatt = addressToGattClient.get(address);
    if (bluetoothGatt == null) {
        Log.w(TAG, "No connection found for: " + address);
        sendGattBroadcast(address, BleEvents.WRITE_DESC_FAIL, null);
        return;//from  w w w. j  a v a  2  s  .c om
    }

    if (!descriptor.setValue(value) || !bluetoothGatt.writeDescriptor(descriptor)) {
        sendGattBroadcast(address, BleEvents.WRITE_DESC_FAIL, descriptor.getCharacteristic());
    }
}