bluetooth - 如何使用 hci 命令将我的 Linux 笔记本电脑设置为 BLE 外设以通告具有指定 UUID 的服务?

标签 bluetooth bluetooth-lowenergy bluez gatt

我需要将我的 Linux 笔记本电脑设置为 BLE 外设,以通告具有指定设备名称和服务 UUID 的服务。我可以使用以下命令集来实现此目的,

sudo hciconfig 0 reset
sudo hcitool -i hci0 cmd 0x08 0x0008 15 02 01 1a 11 07 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 00 00 00 00 00 00 00 00 00 00
sudo btmgmt -i hci0 le on
sudo btmgmt -i hci0 connectable on
sudo btmgmt -i hci0 name MYNAME
sudo btmgmt -i hci0 advertising on
sudo btmgmt -i hci0 power on

(请注意,btmgmt 是从 bluez5.37 构建的)

效果很好,我的 iPhone 可以扫描并发现名称为“MYNAME”且服务 UUID 为 504f4e4d-4c4b-4a49-4847-464544434241 的外围设备。

我的问题是,我需要用 hciconfig 和/或 hcitool 替换上述 btmgmt 命令,这可能吗?如果是的话,每个命令的参数如何设置?

提前致谢。

最佳答案

您应该能够用此替换 btmgmt 命令来开始广告:

sudo hciconfig hci0 leadv 0

关于bluetooth - 如何使用 hci 命令将我的 Linux 笔记本电脑设置为 BLE 外设以通告具有指定 UUID 的服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36780370/

相关文章:

android - 以编程方式连接到配对的蓝牙设备

ios - AVAudioSession 在某些蓝牙设备上不工作

c# - 如何通过蓝牙从 Leica DISTO 读取数据?

Android BLE 特性 setValue 无法写入正确的数据

android - 如何识别Eddystone URL和uid?

android - 蓝牙脉搏血氧仪

linux - 通过命令行将蓝牙文件设备设置为广播模式

bluetooth - 树莓派iBeacon未检测到

Android:我可以使用 MIME 类型 vnd.bluetooth.ep.oob 过滤 NFC 标签吗?

Linux Bluez 蓝牙过载?