Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright (c) 2016 Vladimir L. Shabanov <virlof@gmail.com>
 *
 * Licensed under the Underdark License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://underdark.io/LICENSE.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import android.bluetooth.BluetoothGatt;

public class Main {
    public static String gattStatusToString(int status) {
        String str = "";
        switch (status) {
        case BluetoothGatt.GATT_SUCCESS:
            str = "GATT_SUCCESS";
            break;
        case BluetoothGatt.GATT_READ_NOT_PERMITTED:
            str = "GATT_READ_NOT_PERMITTED";
            break;
        case BluetoothGatt.GATT_WRITE_NOT_PERMITTED:
            str = "GATT_WRITE_NOT_PERMITTED";
            break;
        case BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION:
            str = "GATT_INSUFFICIENT_AUTHENTICATION";
            break;
        case BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED:
            str = "GATT_REQUEST_NOT_SUPPORTED";
            break;
        case BluetoothGatt.GATT_INSUFFICIENT_ENCRYPTION:
            str = "GATT_INSUFFICIENT_ENCRYPTION";
            break;
        case BluetoothGatt.GATT_INVALID_OFFSET:
            str = "GATT_INVALID_OFFSET";
            break;
        case BluetoothGatt.GATT_INVALID_ATTRIBUTE_LENGTH:
            str = "GATT_INVALID_ATTRIBUTE_LENGTH";
            break;
        case BluetoothGatt.GATT_CONNECTION_CONGESTED:
            str = "GATT_CONNECTION_CONGESTED";
            break;
        case BluetoothGatt.GATT_FAILURE:
            str = "GATT_FAILURE";
            break;
        }

        return str;
    }
}