日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

發(fā)布時間:2025/3/12 python 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python使用蓝牙功能_python bluetooth蓝牙信息获取蓝牙设备类型的方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

python 獲取藍牙設(shè)備類型

掃描藍牙設(shè)備獲取到的信息中,無法判斷掃描到的藍牙設(shè)備屬于什么類型的設(shè)備。

掃描藍牙信息使用的是python 里面的bluetooth模塊。

首先掃描出來的是這樣的信息

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

可根據(jù)5898764來判斷是什么藍牙設(shè)備。

收集了一些設(shè)備,可以成功的轉(zhuǎn)化為設(shè)備類型

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' #蘋果設(shè)備

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'

最終是這樣的,想顯示成中文,那就改為中文的。有幫助請點一下贊

總結(jié)

以上是生活随笔為你收集整理的python使用蓝牙功能_python bluetooth蓝牙信息获取蓝牙设备类型的方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。