gpt4 book ai didi

iOS : Background Bluetooth Low Energy (BLE) scanning rules

转载 作者:可可西里 更新时间:2023-11-01 05:40:30 26 4
gpt4 key购买 nike

在网上花了几个小时,我找不到任何关于 IOS 使用的后台 BLE 扫描规则的文档。

由于在IOS上无法设置扫描窗口,我在寻找IOS在后台扫描时Apple定义的规则。

上下文

我正在开发一种可穿戴外围设备,当手机无法触及它时,它有时会断开连接。目标是在外围设备离手机足够近时快速重新连接(少于 5 秒)。外围设备有电池限制,所以我不能永远每 20 毫秒做一次广告,所以我正在寻找一种巧妙的方法将我的外围设备重新连接到手机。

如果我知道后台扫描模式是如何工作的,我将能够定义一个智能广告间隔以节省电量。

用例

如果我的外围设备每 1285 毫秒广播一次,那么我的 IOS 应用程序在后台模式下发现 10 分钟需要多长时间?

最佳答案

不确定您的问题是什么。

我想您已经阅读了 Apple 的“Apple 产品的蓝牙配件设计指南”?

https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf

他们在其中声明:

3.5 Advertising Interval

The advertising interval of the accessory should be carefully considered, because it affects the time to discovery and connect performance. For a battery-powered accessory, its battery resources should also be considered.

To be discovered by the Apple product, the accessory should first use the recommended advertising interval of 20 ms for at least 30 seconds. If it is not discovered within the initial 30 seconds, Apple recommends using one of the following longer intervals to increase chances of discovery by the Apple product:

  • 152.5 ms
  • 211.25 ms
  • 318.75 ms
  • 417.5 ms
  • 546.25 ms
  • 760 ms
  • 852.5 ms
  • 1022.5 ms
  • 1285 ms

Note: Longer advertising intervals usually result in longer discovery and connect times.

一旦发现 BLE 设备,iOS 将通知正在寻找它的应用程序(基于广告服务 UUID),然后这些应用程序将能够连接到它。

Apple 建议 iBeacon 的间隔为 100 毫秒。

这个(很旧,从 2012 年开始)discussion指出:

the median discovery time when the phone is in standby is about 60 times the advertising interval. The 95-percentile discovery time when the phone is in standby mode is about 300 times the advertising interval

这个(稍微更新一点,但从 2013 年 12 月开始)answer指出:

While scanning in the foreground will likely immediately discover a device advertising next to it, discovery in the background can take up to ~60 times longer.

关于iOS : Background Bluetooth Low Energy (BLE) scanning rules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34157934/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com