describe BlueTooth Class - Android Bluetooth

Android examples for Bluetooth:Bluetooth State

Description

describe BlueTooth Class

Demo Code


//package com.java2s;
import android.bluetooth.BluetoothClass;

public class Main {
    public static String describeBlueToothClass(
            BluetoothClass bluetoothClass) {
        String ret = "Maj: ";

        switch (bluetoothClass.getMajorDeviceClass()) {
        case BluetoothClass.Device.Major.AUDIO_VIDEO:
            ret += "Audio/Video";
            break;
        case BluetoothClass.Device.Major.COMPUTER:
            ret += "Computer";
            break;
        case BluetoothClass.Device.Major.HEALTH:
            ret += "Health";
            break;
        case BluetoothClass.Device.Major.IMAGING:
            ret += "Imaging";
            break;
        case BluetoothClass.Device.Major.MISC:
            ret += "Misc";
            break;
        case BluetoothClass.Device.Major.NETWORKING:
            ret += "Networking";
            break;
        case BluetoothClass.Device.Major.PERIPHERAL:
            ret += "Peripheral";
            break;
        case BluetoothClass.Device.Major.PHONE:
            ret += "Phone";
            break;
        case BluetoothClass.Device.Major.TOY:
            ret += "TOY";
            break;
        case BluetoothClass.Device.Major.UNCATEGORIZED:
            ret += "Uncategorized";
            break;
        case BluetoothClass.Device.Major.WEARABLE:
            ret += "Wearable";
            break;
        }/*ww w  . j  av  a  2 s.  co m*/

        ret += " Min: ";

        switch (bluetoothClass.getDeviceClass()) {

        case BluetoothClass.Device.AUDIO_VIDEO_CAMCORDER:
            ret += "Camcorder";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO:
            ret += "Car Audio";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE:
            ret += "Handsfree";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES:
            ret += "Headphones";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_HIFI_AUDIO:
            ret += "Hifi";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER:
            ret += "Loudspeaker";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_MICROPHONE:
            ret += "Microphone";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO:
            ret += "Portable audio";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_SET_TOP_BOX:
            ret += "STB";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_UNCATEGORIZED:
            ret += "Unc Audio/Video";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VCR:
            ret += "VCR";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CAMERA:
            ret += "Video Camera";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CONFERENCING:
            ret += "Video Conferencing";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER:
            ret += "Display and Loudspeaker";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_GAMING_TOY:
            ret += "Gaming Toy";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_MONITOR:
            ret += "Video Monitor";
            break;
        case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET:
            ret += "Wearable headset";
            break;
        case BluetoothClass.Device.COMPUTER_DESKTOP:
            ret += "Desktop Comp";
            break;
        case BluetoothClass.Device.COMPUTER_HANDHELD_PC_PDA:
            ret += "Handheld PDA";
            break;
        case BluetoothClass.Device.COMPUTER_LAPTOP:
            ret += "Laptop";
            break;
        case BluetoothClass.Device.COMPUTER_PALM_SIZE_PC_PDA:
            ret += "Palm PDA";
            break;
        case BluetoothClass.Device.COMPUTER_SERVER:
            ret += "Server";
            break;
        case BluetoothClass.Device.COMPUTER_UNCATEGORIZED:
            ret += "Unc Computer";
            break;
        case BluetoothClass.Device.COMPUTER_WEARABLE:
            ret += "Wearable Comp";
            break;
        case BluetoothClass.Device.HEALTH_BLOOD_PRESSURE:
            ret += "Blood Pressure";
            break;
        case BluetoothClass.Device.HEALTH_DATA_DISPLAY:
            ret += "Data Display";
            break;
        case BluetoothClass.Device.HEALTH_GLUCOSE:
            ret += "Glucose";
            break;
        case BluetoothClass.Device.HEALTH_PULSE_OXIMETER:
            ret += "Pulse Oximeter";
            break;
        case BluetoothClass.Device.HEALTH_PULSE_RATE:
            ret += "Pulse rate";
            break;
        case BluetoothClass.Device.HEALTH_THERMOMETER:
            ret += "Thermometer";
            break;
        case BluetoothClass.Device.HEALTH_UNCATEGORIZED:
            ret += "Unc Health";
            break;
        case BluetoothClass.Device.HEALTH_WEIGHING:
            ret += "Weighing";
            break;
        case BluetoothClass.Device.PHONE_CELLULAR:
            ret += "Phone Cellular";
            break;
        case BluetoothClass.Device.PHONE_CORDLESS:
            ret += "Phone Cordless";
            break;
        case BluetoothClass.Device.PHONE_ISDN:
            ret += "Phone ISDN";
            break;
        case BluetoothClass.Device.PHONE_MODEM_OR_GATEWAY:
            ret += "Modem/Gateway";
            break;
        case BluetoothClass.Device.PHONE_SMART:
            ret += "Smartphone";
            break;
        case BluetoothClass.Device.PHONE_UNCATEGORIZED:
            ret += "Unc Phone";
            break;
        case BluetoothClass.Device.TOY_CONTROLLER:
            ret += "Controller";
            break;
        case BluetoothClass.Device.TOY_DOLL_ACTION_FIGURE:
            ret += "Action Figure";
            break;
        case BluetoothClass.Device.TOY_GAME:
            ret += "Toy Game";
            break;
        case BluetoothClass.Device.TOY_ROBOT:
            ret += "Toy Robot";
            break;
        case BluetoothClass.Device.TOY_UNCATEGORIZED:
            ret += "Unc Toy";
            break;
        case BluetoothClass.Device.TOY_VEHICLE:
            ret += "Toy Vehicle";
            break;
        case BluetoothClass.Device.WEARABLE_GLASSES:
            ret += "Wearable glasses";
            break;
        case BluetoothClass.Device.WEARABLE_HELMET:
            ret += "Wearable helmet";
            break;
        case BluetoothClass.Device.WEARABLE_JACKET:
            ret += "Wearable jacket";
            break;
        case BluetoothClass.Device.WEARABLE_PAGER:
            ret += "Wearable pager";
            break;
        case BluetoothClass.Device.WEARABLE_UNCATEGORIZED:
            ret += "Unc wearable";
            break;
        case BluetoothClass.Device.WEARABLE_WRIST_WATCH:
            ret += "Wearable wrist watch";
            break;
        }

        ret += " Services: ";

        if (bluetoothClass.hasService(BluetoothClass.Service.AUDIO)) {
            ret += "/Audio";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.CAPTURE)) {
            ret += "/Capture";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.INFORMATION)) {
            ret += "/Info";
        }

        if (bluetoothClass
                .hasService(BluetoothClass.Service.LIMITED_DISCOVERABILITY)) {
            ret += "/Lim Disc";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.NETWORKING)) {
            ret += "/Networking";
        }

        if (bluetoothClass
                .hasService(BluetoothClass.Service.OBJECT_TRANSFER)) {
            ret += "/Obj Trans";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.POSITIONING)) {
            ret += "/Pos";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.RENDER)) {
            ret += "/Render";
        }

        if (bluetoothClass.hasService(BluetoothClass.Service.TELEPHONY)) {
            ret += "/Tele";
        }

        return ret;
    }
}

Related Tutorials