BluetoothGatt status To String - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth

Description

BluetoothGatt status To String

Demo Code

import android.bluetooth.BluetoothGatt;

public class Main{


    public static String statusToString(int status) {
        switch (status) {
        case BluetoothGatt.GATT_SUCCESS:
            return "GATT_SUCCESS";
        case BluetoothGatt.GATT_READ_NOT_PERMITTED:
            return "GATT_READ_NOT_PERMITTED";
        case BluetoothGatt.GATT_WRITE_NOT_PERMITTED:
            return "GATT_WRITE_NOT_PERMITTED";
        case BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED:
            return "GATT_REQUEST_NOT_SUPPORTED";
        case BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION:
            return "GATT_INSUFFICIENT_AUTHENTICATION";
        case BluetoothGatt.GATT_INSUFFICIENT_ENCRYPTION:
            return "GATT_INSUFFICIENT_ENCRYPTION";
        case BluetoothGatt.GATT_INVALID_OFFSET:
            return "GATT_INVALID_OFFSET";
        case BluetoothGatt.GATT_INVALID_ATTRIBUTE_LENGTH:
            return "GATT_INVALID_ATTRIBUTE_LENGTH";
        case BluetoothGatt.GATT_FAILURE:
            return "GATT_FAILURE";
        default:/*from   ww  w. ja  v  a2s .c o  m*/
            return "unknown state:" + status;
        }
    }

}

Related Tutorials