我正在研究如何在 Linux 中使用低功耗蓝牙调制解调器。我正在为此使用命令行选项,即 hcitool
。我能够使用以下命令找到设备:$ hcitool scan
它对我来说工作正常,我也可以使用以下方式广播我的设备:
sudo hciconfig hci0 leadv
它也工作正常。但是我想将服务和特性添加到可以被其他设备检测到的调制解调器设备。我试过 sdptool add
但它对我不起作用。有谁知道如何在 ubuntu 中使用命令行工具将服务和特性添加到外设?
编辑:我的调制解调器正在广播,但无法探索其他 BLE 设备的服务和特性。现在我可以使用 hcio name 命令
编辑:现在我可以通过同时运行 sudo hcidump
命令来呈现服务和特性。但我无法追踪我从哪里获得这些服务和特征。一项明确的观察是这些服务是从机器呈现的。
最佳答案
BLE 中没有 SDP。改为使用广播/广告帧和 GATT 客户端/服务器。
几个链接:
- BlueZ gatttool: command line tool to run common GATT procedures
- BlueZ GATT's ready profiles
- hint: DBUS
- GATT and DBUS example
- How can I connect to the FitBit Zip over Bluetooth 4.0 LE on Linux with bluez?
- Bluetooth Low Energy: listening for notifications/indications in linux
- http://comments.gmane.org/gmane.linux.bluez.kernel/29547
关于linux - 在 linux 命令行中使用低功耗蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17835469/