Example usage for android.bluetooth BluetoothGattService getType

List of usage examples for android.bluetooth BluetoothGattService getType

Introduction

In this page you can find the example usage for android.bluetooth BluetoothGattService getType.

Prototype

public int getType() 

Source Link

Document

Get the type of this service (primary/secondary)

Usage

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

public void printServices(String address) {
    BluetoothGatt bluetoothGatt = addressToGattClient.get(address);
    if (bluetoothGatt == null) {
        Log.d(TAG, "No connection found for: " + address);
        return;/*from ww w  . jav a  2 s . c om*/
    }
    for (BluetoothGattService service : bluetoothGatt.getServices()) {
        Log.d(TAG, "Service ================================");
        Log.d(TAG, "Service UUID: " + service.getUuid());
        Log.d(TAG, "Service Type: " + service.getType());

        for (BluetoothGattCharacteristic charact : service.getCharacteristics()) {
            Log.d(TAG, "Charact UUID: " + charact.getUuid());
            Log.d(TAG, "Charact prop: " + charact.getProperties());

            if (charact.getValue() != null) {
                Log.d(TAG, "Charact Value: " + new String(charact.getValue()));
            }
        }
    }
}