我刚接触android。我有Raspberry pi 3设备。我可以通过经典的Bluetooth.now将移动设备连接到Raspberry pi 3。我对Raspberry如何通过蓝牙连接移动设备和Raspberry感到困惑。低energy.we可以将BLE设备连接到安卓设备,并可以编写Characteristics.now我想在Raspberry pi 3 like中做同样的事情(心率监视器,MI频段2)
发布于 2017-12-28 19:57:46
您可以使用DBus调用以编程方式完成此操作。DBus是linux中使用的一种进程间通信方法。您可以使用不同语言的DBus绑定来执行DBus调用和操作。以下是帮助您入门的几个链接:
- DBus tutorial - [https://dbus.freedesktop.org/doc/dbus-tutorial.html](https://dbus.freedesktop.org/doc/dbus-tutorial.html)
- BLE DBus API - [https://elinux.org/images/3/32/Doing\_Bluetooth\_Low\_Energy\_on\_Linux.pdf](https://elinux.org/images/3/32/Doing_Bluetooth_Low_Energy_on_Linux.pdf)
从终端使用Gatttool的
Gatttool是一个终端工具,就像hcitool一样。您可以使用以下命令使其正常工作:
- **hcitool lescan** Gives you the list of nearby Low Energy Devices
- **gatttool -b** _**mac\_adress\_of\_le\_device**_ **-I** gives you an interactive session with the mentioned LE device
- _From the interactive session_ give **connect** to connect to the device
- **primary** to get the primary services.
- From this result, you can use the _handle_ values to get the list of characteristics of a specific service. **characteristics** _**handle**_
- To get the _value_ of a characteristic use **char-read-hnd** _**handle**_
- To get the _characteristic descriptor_, use **char-desc** _**handle**_
- to write to a characteristic **char-write-req** _**handle**_ _**value**_希望这能有所帮助!
https://stackoverflow.com/questions/47975263
复制相似问题