python 获取蓝牙设备类型

扫描蓝牙设备获取到的信息中,无法判断扫描到的蓝牙设备属于什么类型的设备。

扫描蓝牙信息使用的是python 里面的bluetooth模块。

首先扫描出来的是这样的信息

('74:60:FA:FD:FC:49','HUAWEI P30',5898764)

可根据5898764来判断是什么蓝牙设备。

收集了一些设备,可以成功的转化为设备类型

def bt_device_type(device_type):

if device_type == 5898764 or device_type == 'Android':

return 'Android'

if device_type == 7078144 or device_type == 'computer_ubuntu14':

return 'computer_ubuntu14'

if device_type == 786700 or device_type == 'computer_ubuntu16':

return 'computer_ubuntu16'

if device_type == 655620 or device_type == 'computer_windows':

return 'computer_windows'

if device_type == 2360324 or device_type == 'headset':

return 'headset' #耳机

if device_type == 2360328 or device_type =='speaker':

return 'speaker' # 扩音器

if device_type == 263208 or device_type == 'SV':

return 'SV' #蓝牙音响

if device_type == 7995916 or device_type == 'phone':

return 'phone' #苹果设备

if device_type == 3670284 or device_type == 'MACBook':

return 'MACBook'

if device_type == 7936 or device_type == 2752780 or device_type == 'PC':

return 'PC'

if device_type == 6947088 or device_type == 'iPad':

return 'iPad'

return 'unknown'

最终是这样的,想显示成中文,那就改为中文的。有帮助请点一下赞

python使用蓝牙功能_python bluetooth蓝牙信息获取蓝牙设备类型的方法相关推荐

  1. python bluetooth蓝牙信息获取蓝牙设备类型

    本篇文章主要介绍了python bluetooth蓝牙信息获取蓝牙设备类型的要领,对大家的学习或者工作具有一定的参考学习价值,感兴趣的小伙伴们可以参考一下. python 获取蓝牙设备类型 扫描蓝牙设 ...

  2. python的主要功能_Python的主要功能是什么?

    原博文 2020-03-13 16:30 − Python是一种解释型语言.与C语言等语言不同,Python不需要在运行之前进行编译. Python是动态语言,当您声明变量或类似变量时,您不需要声明变 ...

  3. python查看模块功能_Python模块Os系统功能

    Os模块简介系统功能 python编程时,经常和文件.目录打交道,这是就离不了os模块.os模块包含普遍的操作系统功能,与具体的平台无关. OS模块使用实例 执行dos命令 Python os.sys ...

  4. python实现翻译功能_Python实现翻译功能

    原博文 2017-11-14 09:27 − 1.打开文件的例子: 1 file=open('D:\\Python\\untitled\\Hello.txt','r',encoding='utf-8' ...

  5. python查看模块功能_Python进阶之inspect模块使用详解

    前几篇内容我们详细探讨了如何从Python中获取帮助信息: 前情回顾 1.查看模块.类提供了哪些接口: 需要帮助吗?dir函数的孪生兄弟,Python中魔法方法__dir__详解 2.查看对象内部属性 ...

  6. python实现日历功能_python学习笔记之—— calendar(日历)模块

    原博文 2017-12-22 14:34 − 内置函数month() #!/usr/bin/python import calendar print calendar.month(2017,12) 输 ...

  7. python解释器的功能_python的解释器是什么?

    python解释器是解释python脚本执行的程序.编写python代码保存后,我们会得到一个以.py为扩展名的文本文件.要运行此文件,就需要python解释器去执行.py文件. python解释器种 ...

  8. python实现登录功能_python实现用户登录功能模块

    python实现登录功能模块#!/usr/bin/env python while True: user = raw_input('Please input username:') if user = ...

  9. [转载] python字典查询功能_Python中的字典功能

    参考链接: Python中的字典dictionary方法 (cmp(), len(), items()-) python字典查询功能 Let's check out some important fu ...

最新文章

  1. PHP无状态对象,(PHP)基于Token的身份验证中对无状态的理解
  2. java之IO整理(中)
  3. BI怎么选?重点看这10个技术指标
  4. 【SLAM】gradslam(∇SLAM)开源:论文、代码全都有
  5. 创建订单 - 填充新订单数据
  6. 今天的你,又被带节奏了吗?
  7. FCKeditor在Asp.Net中的配置
  8. spring boot 整合 mybatis
  9. 软考信息系统项目管理师_管理科学(运筹学)---软考高级之信息系统项目管理师033
  10. “一加一减”的两种说话技巧
  11. yum更新php版本,yum php版本太低怎么办
  12. python怎么画简单图-python中简单易学的绘图:用turtle画太极图
  13. 05Struts2表单
  14. PCIE传输速率详解、Gbps和GB的区分
  15. 几个比较好的app开发框架
  16. [挑战杯] 火焰检测
  17. 游戏任务系统设计思路
  18. Java中获取当天的0点时间和明天的0点时间
  19. TCGA肿瘤样本基因信息库(一)
  20. 浅谈UAC ByPass

热门文章

  1. php mysql 权重_PHP对MySql的常用操作
  2. php debug_print_backtrace,php中debug_backtrace、debug_print_backtrace和匿名函数用法实例
  3. python剑指offer面试题_剑指offer面试题Q10 斐波那契数列 python解法
  4. 风变的python课程怎么样_风的解释|风的意思|汉典“风”字的基本解释
  5. 在C ++中检查一个数组是否是另一个数组的子数组
  6. numpy zeros矩阵_零矩阵使用numpy.zeros()| 使用Python的线性代数
  7. zoj 1005 jugs
  8. Python获取电脑硬件配置的封装类,可以获取CPU序列号、主板序列号、BIOS序列号、硬盘序列号和网卡MAC地址
  9. Android木马分析实验,Android木马简介与分析
  10. 8266 at 驱动_AT、CVT、DCT 变速器,到底哪个更靠谱