python调用蓝牙之前期调研测试

Posted elevenmtb

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python调用蓝牙之前期调研测试相关的知识,希望对你有一定的参考价值。

蓝牙

bluepypybluez

 

文档:

http://ianharvey.github.io/bluepy-doc/

相关:

https://blog.csdn.net/qq_33433070/article/details/78671210

https://www.cnblogs.com/zjutlitao/p/10171913.html

 

bluepy测试demo

 

测试结果

技术图片
 1 Discovered device 2d:b2:1e:xx:xx:xx
 2 Discovered device fc:a4:7a:xx:xx:xx
 3 Discovered device cd:84:6e:xx:xx:xx
 4 Discovered device f3:0a:8f:xx:xx:xx
 5 Discovered device 26:c1:02:xx:xx:xx
 6 Device 2d:b2:1e:xx:xx:xx (random), RSSI=-49 dB
 7   Manufacturer = 060001092002766e7656f589dd3aa0864296828ad6c79b39cbefd016ff
 8 Device fc:a4:7a:xx:xx:xx (public), RSSI=-94 dB
 9   Flags = 06
10   Complete 16b Services = 0000fee7-0000-1000-8000-00805f9b34fb
11   Manufacturer = 0102fca47ab1399e012b001512
12   Complete Local Name = NLB15
13 Device cd:84:6e:xx:xx:xx (random), RSSI=-99 dB
14   Flags = 06
15   Manufacturer = ffffa9d11b6e84cd
16   Complete Local Name = ofo
17 Device f3:0a:8f:xx:xx:xx (random), RSSI=-95 dB
18   Flags = 06
19   Complete Local Name = mobike
20   Manufacturer = b3040160f30a8f3737ff0106847737000000
21 Device 26:c1:02:xx:xx:xx (random), RSSI=-98 dB
22   Manufacturer = 0600010f200207defb54d27d9c4dd97710f629fe20426b9f7240790f53
View Code

无法搜索到自己的手机,和手机对比也有些出入

 

 

bluez测试demo

技术图片
1 import bluetooth
2 
3 nearby_devices = bluetooth.discover_devices(lookup_names=True)
4 print(nearby_devices)
5 for addr, name in nearby_devices:
6     print("  %s - %s" % (addr, name))
View Code

结果

1 [(‘D8:C7:71:xx:xx:xx‘, ‘Honor 9‘)]
2  D8:C7:71:xx:xx:xx - Honor 9

只能搜索到自己的手机。。

 

----------------------------------------------

 

以上是关于python调用蓝牙之前期调研测试的主要内容,如果未能解决你的问题,请参考以下文章

Python测试框架之unittest和pytest

零基础学习 Python 之前期准备

Python测试框架之unittest和pytest

深度学习之前期准备工作--python,pip,numpy,tensorflow安装

Python自动化测试框架之unittest和pytest

python调c++之caffe实现