简体   繁体   English

iOS广告时段(iPhone作为外设)

[英]iOS Advertising Interval (iPhone as Peripheral)

I'm using my iPhone as a Bluetooth peripheral device to share data with a raspberry pi. 我正在使用我的iPhone作为蓝牙外围设备与树莓派共享数据。 When I looked to set the appropriate scan length to ensure I discover the iPhone quickly, I realised I couldn't find any information on what advertising interval my iPhone will use. 当我设置适当的扫描长度以确保我快速发现iPhone时,我意识到我无法找到有关iPhone将使用的广告间隔的任何信息。 Does anyone know the value for this, whether it is a set value or whether it can be changed? 有没有人知道这个值,无论是设定值还是可以改变?

Apparently there's no way given by Apple to change the advertising interval. 显然苹果没有办法改变广告间隔。

What you can do is start and stop advertising based on a timer implementation. 您可以做的是根据计时器实现启动和停止广告。 You can make use of an NSTimer in periodic configuration and turn advertising ON and OFF based on the period you wish using APIs startAdvertising and stopAdvertising. 您可以定期配置使用NSTimer,并根据您希望使用API​​ startAdvertising和stopAdvertising的时间段打开和关闭广告。

For the matter of fact, in my tests I observed the advertising interval to be around 30ms which seems to be the default non-editable value. 事实上,在我的测试中,我观察到广告间隔约为30毫秒,这似乎是默认的不可编辑值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM