连接bluez后继续投放广告 [英] continue advertising after connection bluez

查看:71
本文介绍了连接bluez后继续投放广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 hcitool 在bluez中设置了广告,该设备按预期播种了.

设置如下:

 <代码> #advertisingsudo hcitool -i hci0 cmd 0x08 0x0008 18 02 01 06 02 0a 00 11 07 9e ca dc 24 0e e5 a9 e0 93 f3 a3 b5 01 00 40 6e 00 00 00 00 00 00 00 00#扫描回应须藤hcitool -i hci0 cmd 0x08 0x0009 0d 0c 09 6f 6f#setup广告间隔须藤hcitool -i hci0 cmd 0x08 0x0006 80 02 c0 03 00 00 00 00 00 00 00 00 00 00 00 00 00#打开广告须藤hcitool -i hci0 cmd 0x08 0x000a 01 

在设备连接后,广​​告消失了.我该如何继续进行广告宣传?

我做了一个变通办法,反复调用 sudo hcitool -i hci0 cmd 0x08 0x000a 01 .

另一个问题是如何使用d-bus界面设置上面的广告.

ps.在

但是,一旦建立连接,您就可以像手动完成广告一样重新启动广告.请查看下面的答案以获取更多信息:-

一个以上的链接层状态同时连接

我希望这会有所帮助.

I have setup advertising in bluez using hcitool The device sow up as expected.

The setup is done as follow:

#advertising
sudo hcitool -i hci0 cmd 0x08 0x0008 18 02 01 06 02 0a 00 11 07 9e ca dc 24 0e e5 a9 e0 93 f3 a3 b5 01 00 40 6e 00 00 00 00 00 00 00
#scan response
sudo hcitool -i hci0 cmd 0x08 0x0009 0d 0c 09 6f 6f
#setup advertising interval
sudo hcitool -i hci0 cmd 0x08 0x0006 80 02 c0 03 00 00 00 00 00 00 00 00 00 07 00
#turn advertising on
sudo hcitool -i hci0 cmd 0x08 0x000a 01

After a devie connect the advertising is gone. How kan I keep continuing advertising?

I did a workaround calling sudo hcitool -i hci0 cmd 0x08 0x000a 01 repeatedly.

Another question is how setup the advertising above using the d-bus interface.

ps. Many info have been found in Bluetooth specification 5.0 (Core_v5.0.pdf), 7.8.5 LE Set Advertising Parameters command p.1321

解决方案

Most stacks/implementations (including BlueZ) will automatically switch off adverts when a device's state switches from advertising to accepting an incoming connection. The reason for this is that according to the stack Link Layer states (Please see picture below which is available Bluetooth specification v5.1, Vol 6, Part B, Section 1.1: Link Layer States), the state of the device should change from Advertising to Connected as the device cannot be in two different states at the same time.

However, once you are in a connection you can restart your adverts as you have done manually. Please have a look at the answer below for more information:-

Link Layer state for more than one simultaneous connection

I hope this helps.

这篇关于连接bluez后继续投放广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆