android 蓝牙连接设备的一些常量

public class ListAdapter extends CommonAdapter<BluetoothDevice> {
 
 
    public ListAdapter(Context context, List<BluetoothDevice> data, int layoutId) {
        super(context, data, layoutId);
    }
 
    @Override
    public void setItemContent(ViewHolder holder, BluetoothDevice bluetoothBean) {
        holder.setText(R.id.bluetooth_name,bluetoothBean.getName());
        holder.setText(R.id.bluetooth_bundle,getBundleContent(bluetoothBean.getBondState()));
        holder.setText(R.id.bluetooth_style,getString(bluetoothBean) + "----" );
        holder.setText(R.id.bluetooth_connect,getStyleContent(bluetoothBean));
 
    }
    private String getBundleContent(int bundle){
        String content= null;
        switch (bundle){
            case BluetoothDevice.BOND_BONDED:
                content = "匹配完成";
                break;
            case BluetoothDevice.BOND_BONDING:
                content = "正在匹配";
                break;
            case BluetoothDevice.BOND_NONE:
                content = "未匹配";
                break;
 
        }
        return content;
    }
 
    private String getStyleContent(BluetoothDevice device){
        int styleMajor = device.getBluetoothClass().getMajorDeviceClass();
        String content = "未知....";
        switch (styleMajor){
            case BluetoothClass.Device.Major.AUDIO_VIDEO://音频设备
                content = "音配设备";
                break;
            case BluetoothClass.Device.Major.COMPUTER://电脑
                content = "电脑";
                break;
            case BluetoothClass.Device.Major.HEALTH://健康状况
                content = "健康状况";
                break;
            case BluetoothClass.Device.Major.IMAGING://镜像,映像
                content = "镜像";
                break;
            case BluetoothClass.Device.Major.MISC://麦克风
                content = "麦克风";
                break;
            case BluetoothClass.Device.Major.NETWORKING://网络
                content = "网络";
                break;
            case BluetoothClass.Device.Major.PERIPHERAL://外部设备
                content = "外部设备";
                break;
            case BluetoothClass.Device.Major.PHONE://电话
                content = "电话";
                break;
            case BluetoothClass.Device.Major.TOY://玩具
                content = "玩具";
                break;
            case BluetoothClass.Device.Major.UNCATEGORIZED://未知的
                content = "未知的";
                break;
            case BluetoothClass.Device.Major.WEARABLE://穿戴设备
                content = "穿戴设备";
                break;
        }
        return content;
    }
    private String getString(BluetoothDevice device){
        int a =device.getBluetoothClass().getDeviceClass();
        String name = null;
        switch (a){
            case BluetoothClass.Device.AUDIO_VIDEO_CAMCORDER://录像机
                name = "录像机";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO:
                name = "车载设备";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE:
                name = "蓝牙耳机";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER:
                name = "扬声器";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_MICROPHONE:
                name = "麦克风";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO:
                name = "打印机";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_SET_TOP_BOX:
                name = "BOX";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_UNCATEGORIZED:
                name = "未知的";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VCR:
                name = "录像机";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CAMERA:
                name = "照相机录像机";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CONFERENCING:
                name = "conferencing";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER:
                name = "显示器和扬声器";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_GAMING_TOY:
                name = "游戏";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_MONITOR:
                name = "显示器";
                break;
            case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET:
                name = "可穿戴设备";
                break;
            case BluetoothClass.Device.PHONE_CELLULAR:
                name = "手机";
                break;
            case BluetoothClass.Device.PHONE_CORDLESS:
                name = "无线电设备";
                break;
            case BluetoothClass.Device.PHONE_ISDN:
                name = "手机服务数据网";
                break;
            case BluetoothClass.Device.PHONE_MODEM_OR_GATEWAY:
                name = "手机调节器";
                break;
            case BluetoothClass.Device.PHONE_SMART:
                name = "手机卫星";
                break;
            case BluetoothClass.Device.PHONE_UNCATEGORIZED:
                name = "未知手机";
                break;
            case BluetoothClass.Device.WEARABLE_GLASSES:
                name = "可穿戴眼睛";
                break;
            case BluetoothClass.Device.WEARABLE_HELMET:
                name = "可穿戴头盔";
                break;
            case BluetoothClass.Device.WEARABLE_JACKET:
                name = "可穿戴上衣";
                break;
            case BluetoothClass.Device.WEARABLE_PAGER:
                name = "客串点寻呼机";
                break;
            case BluetoothClass.Device.WEARABLE_UNCATEGORIZED:
                name = "未知的可穿戴设备";
                break;
            case BluetoothClass.Device.WEARABLE_WRIST_WATCH:
                name = "手腕监听设备";
                break;
            case BluetoothClass.Device.TOY_CONTROLLER:
                name = "可穿戴设备";
                break;
            case BluetoothClass.Device.TOY_DOLL_ACTION_FIGURE:
                name = "玩具doll_action_figure";
                break;
            case BluetoothClass.Device.TOY_GAME:
                name = "游戏";
                break;
            case BluetoothClass.Device.TOY_ROBOT:
                name = "玩具遥控器";
                break;
            case BluetoothClass.Device.TOY_UNCATEGORIZED:
                name = "玩具未知设备";
                break;
            case BluetoothClass.Device.TOY_VEHICLE:
                name = "vehicle";
                break;
            case BluetoothClass.Device.HEALTH_BLOOD_PRESSURE:
                name = "健康状态-血压";
                break;
            case BluetoothClass.Device.HEALTH_DATA_DISPLAY:
                name = "健康状态数据";
                break;
            case BluetoothClass.Device.HEALTH_GLUCOSE:
                name = "健康状态葡萄糖";
                break;
            case BluetoothClass.Device.HEALTH_PULSE_OXIMETER:
                name = "健康状态脉搏血氧计";
                break;
            case BluetoothClass.Device.HEALTH_PULSE_RATE:
                name = "健康状态脉搏速率";
                break;
            case BluetoothClass.Device.HEALTH_THERMOMETER:
                name = "健康状态体温计";
                break;
            case BluetoothClass.Device.HEALTH_WEIGHING:
                name = "健康状态体重";
                break;
            case BluetoothClass.Device.HEALTH_UNCATEGORIZED:
                name = "未知健康状态设备";
                break;
            case BluetoothClass.Device.COMPUTER_DESKTOP:
                name = "电脑桌面";
                break;
            case BluetoothClass.Device.COMPUTER_HANDHELD_PC_PDA:
                name = "手提电脑或Pad";
                break;
            case BluetoothClass.Device.COMPUTER_LAPTOP:
                name = "便携式电脑";
                break;
            case BluetoothClass.Device.COMPUTER_PALM_SIZE_PC_PDA:
                name = "微型电脑";
                break;
            case BluetoothClass.Device.COMPUTER_SERVER:
                name = "电脑服务";
                break;
            case BluetoothClass.Device.COMPUTER_UNCATEGORIZED:
                name = "未知的电脑设备";
                break;
            case BluetoothClass.Device.COMPUTER_WEARABLE:
                name = "可穿戴的电脑";
                break;
        }
        return name;
    }


原文:https://blog.csdn.net/strivebus/article/details/65628628 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值