python中如何获取蓝牙设备类型-创新互联

这篇文章将为大家详细讲解有关python中如何获取蓝牙设备类型,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

员工经过长期磨合与沉淀,具备了协作精神,得以通过团队的力量开发出优质的产品。成都创新互联公司坚持“专注、创新、易用”的产品理念,因为“专注所以专业、创新互联网站所以易用所以简单”。公司专注于为企业提供成都做网站、成都网站建设、微信公众号开发、电商网站开发,微信小程序定制开发,软件定制网站开发等一站式互联网企业服务。Python主要用来做什么

Python主要应用于:1、Web开发;2、数据科学研究;3、网络爬虫;4、嵌入式应用开发;5、游戏开发;6、桌面应用开发。

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中如何获取蓝牙设备类型-创新互联
本文URL:http://hxwzsj.com/article/ipdoc.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 高端品牌网站建设 成都网站制作 成都网站设计 成都网站建设公司 做网站设计 企业网站制作 营销型网站建设 成都网站建设 成都网站建设公司 营销型网站建设 网站建设 商城网站建设 成都网站设计 成都品牌网站设计 网站建设公司 高端网站设计 成都网站制作 定制网站制作 企业网站建设 上市集团网站建设 网站建设 成都网站建设