欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android获取蓝牙设备类型

程序员文章站 2024-03-24 23:18:46
...

蓝牙设备可能是手机、电脑、耳机、游戏手柄等,我们可以调用如下方法,获取大的设备分类:

bluetoothDevice.getBluetoothClass().getMajorDeviceClass()

返回的设备类型有:

/**
 * Defines all major device class constants.
 * <p>See {@link BluetoothClass.Device} for minor classes.
 */
public static class Major {
    private static final int BITMASK           = 0x1F00;

    public static final int MISC              = 0x0000;
    public static final int COMPUTER          = 0x0100;
    public static final int PHONE             = 0x0200;
    public static final int NETWORKING        = 0x0300;
    public static final int AUDIO_VIDEO       = 0x0400;
    public static final int PERIPHERAL        = 0x0500;
    public static final int IMAGING           = 0x0600;
    public static final int WEARABLE          = 0x0700;
    public static final int TOY               = 0x0800;
    public static final int HEALTH            = 0x0900;
    public static final int UNCATEGORIZED     = 0x1F00;
}
相关标签: 蓝牙 Android