Skip to content

ble 蓝牙python 开发 #1

@sztangwang

Description

@sztangwang

PyBluez 库
PyBluez Github官网: ---> https://github.com/pybluez/pybluez
from bluetooth.ble import DiscoveryService 缺少gattlib模块,gattlib模块只能linux才行,此方法官方介绍是扫描低功耗蓝牙的
import bluetooth ---->导入此模块正常蓝牙设备可以扫描到,不能扫描到ble设备
windows 放弃

bleson 库
可以扫描到ble设备,
官网API 只有扫描广播功能,没有其他连接api接口:https://bleson.readthedocs.io/en/latest/api_internal.html
放弃

pygatt 库
相关网页:https://draapho.github.io/2016/11/15/1616-python-ble/
windows需要借助: BLED112 来完成
因为BLED112 是4.0的,所以传输只能20个字节传输
已实现发送text,淘宝购买BLED112

bleak库
官网文档:https://github.com/hbldh/bleak
目前来看,这个可以连接成功了,还要熟悉一下
只支持wind10 版本 16299,或以上版本,github有介绍
试过打包后在wind7上面运行也是提示只支持wind10
如果不考虑兼容也可以研究一下,本人因为要考虑wind7 系统,所以也放弃了

gattlib 库
只支持linux 系统,pip install 会报错
放弃

bluepy库
只支持linux 系统,pip install 会报错
放弃

串口实现
购买一个蓝牙串口端口,电脑代码通过串口方式方式连接,再连接ble设备,发送指令操作
已实现,最大可以发送244字节

其他文档:
https://github.com/undera/pylgbst

联系方式:sztangwang@163.com
weixin:tangwang1234562007

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions