Example usage for android.bluetooth BluetoothGatt readDescriptor

List of usage examples for android.bluetooth BluetoothGatt readDescriptor

Introduction

In this page you can find the example usage for android.bluetooth BluetoothGatt readDescriptor.

Prototype

public boolean readDescriptor(BluetoothGattDescriptor descriptor) 

Source Link

Document

Reads the value for a given descriptor from the associated remote device.

Usage

From source file:com.nbplus.iotapp.bluetooth.BluetoothLeService.java

public void readClientCharacteristicConfig(String address, BluetoothGattCharacteristic characteristic) {
    if (StringUtils.isEmptyString(address)) {
        Log.w(TAG, "Unknown address");
    }/*from  ww w . jav a  2s  .c om*/
    BluetoothGatt bluetoothGatt = mConnectedBluetoothGattMap.get(address);
    BluetoothGattDescriptor descriptor = characteristic
            .getDescriptor(UUID.fromString(GattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
    boolean readDescriptorResult = bluetoothGatt.readDescriptor(descriptor);
    Log.d(TAG, "readDescriptorResult = " + readDescriptorResult);
}