【问题标题】:Raspberryy pi 3 BLE Devices树莓派 3 BLE 设备
【发布时间】:2017-12-26 07:25:35
【问题描述】:
我是 android 新手。我有 Raspberry pi 3 设备。我可以通过经典蓝牙将移动设备连接到 Raspberry pi 3。现在我对 Raspberry 如何通过低功耗蓝牙将移动设备连接到 Raspberry 感到困惑。我们可以连接BLE 设备到 android 设备并获取特性并可以编写特性。现在我想在 Raspberry pi 3 中做同样的事情,比如(心率监测器,MI 波段 2)
【问题讨论】:
标签:
bluetooth-lowenergy
raspberry-pi3
bluez
bluetooth-lowenergy-4.2
【解决方案1】:
-
使用程序来做
您可以使用DBus 调用以编程方式进行。 DBus是linux中使用的一种进程间通信方式。您可以使用不同语言(如 python 或 C)的 DBus 绑定来进行 DBus 调用并执行操作。
一些帮助您入门的链接:
-
从终端使用 Gatttool
Gatttool 和 hcitool 一样是一个终端工具。您可以使用以下命令使事情正常工作:
hcitool lescan为您提供附近的低能耗设备列表
gatttool -b mac_adress_of_le_device -I 为您提供与上述 LE 设备的交互会话
从交互式会话给 connect 以连接到设备
primary 获取主要服务。
从此结果中,您可以使用 handle 值来获取特定服务的特征列表。 特点手柄
要获取特征的 值,请使用 char-read-hnd handle
要获取 特征描述符,请使用 char-desc handle
写入特征char-write-req 句柄 值
希望这有帮助!