connection State To String - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth

Description

connection State To String

Demo Code

import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothProfile;

public class Main{

    public static String connectionStateToString(int state) {
        switch (state) {
        case BluetoothProfile.STATE_CONNECTED:
            return "STATE_CONNECTED";
        case BluetoothProfile.STATE_DISCONNECTED:
            return "STATE_DISCONNECTED";
        case BluetoothProfile.STATE_CONNECTING:
            return "STATE_CONNECTING";
        case BluetoothProfile.STATE_DISCONNECTING:
            return "STATE_DISCONNECTING";
        default://from   w  w w  .j  ava 2  s  .co  m
            return "unknown state:" + state;
        }
    }

}

Related Tutorials