多长时间需要在iPhone的范围内扫描蓝牙设备? [英] How long does it take to scan for Bluetooth devices in range of an iPhone?

查看:377
本文介绍了多长时间需要在iPhone的范围内扫描蓝牙设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道iPhone的蓝牙功能将无法通过SDK访问,直到3.0,但它需要多长时间来找到在该地区的设备?它是依赖于该地区的设备数量?如果周围有在范围内5台设备,应扫描,发现他们都采取小于5秒或> 30秒?

I know the iPhone Bluetooth capabilities won't be accessible through the SDK until 3.0, but how long should it take to find devices in the area? Is it dependent on the number of devices in the area? If there are around 5 devices in range, should a scan to discover all of them take <5 seconds, or >30 seconds?

我知道有很多未知因素,但我想,以确定是否我可以做一个蓝牙在启动时扫描如果时间是最小的,或者如果我要告诉用户它是关于做一个扫描并有可能是一个较长时间的延迟。我无法测试这个在现实世界中与其他蓝牙设备不可用,但我想获得它如何可以设计感。

I know there are a lot of unknown factors, but I'm trying to determine if I can do a Bluetooth scan on startup if the time is minimal, or if I have to tell the user it is about to do a scan and there could be a long delay. I am unable to test this in the real world as the other Bluetooth devices aren't available, but I am trying to get a sense of how it could be designed.

推荐答案

不知道该API将让你做,但蓝牙主机控制器接口(HCI)的命令,这是查询命令底层

Not sure what the API will let you do but the Bluetooth Host Controller Interface (HCI) command underlying this is the 'Inquiry Command'

这会让你打听设备在指定的时间和/或答复的固定数量。

This will let you inquire about devices either for a fixed time and/or a fixed number of responses.

我是一个新手蓝牙,不是专家,但...

I'm a Bluetooth neophyte, not an expert but...

要得到一个蓝牙设备是处于低功率模式的至少1响应花费1.28秒,所以查询的时间是在该周期的倍数最多61.44秒(48期),所以,时间范围为1(1.28秒),48(61.44秒)。

To get at least 1 response from a Bluetooth device that is in a low power mode takes 1.28 seconds, so inquiry time is in multiples of that period up to a maximum of 61.44 seconds (48 periods), so the time range is 1 (1.28 seconds) to 48 (61.44 seconds).

有可能是能够在一个单一的1.28秒虽然响应时间多台设备。

There might be several devices that could respond in a single 1.28 second period though.

您还可以指定回应你会接受(1..25​​5)无限例如编号或0直到时间耗尽。

You can also specify the number of responses you will accept (1..255) or 0 for unlimited e.g. until the time runs out.

您也可以取消询价,如果你发现你正在寻找一个特定的设备。

You can also cancel an inquiry, if you found a particular device you were looking for.

不科学的测试。然每次查询10次,并采取了结果的平均值:

Unscientific test from my desk using a CSR bluetooth chip with Bluetooth 2.1 +EDR firmware running inquiry on the chip with debug output via the chip UART. Ran each inquiry 10 times and took an average of the results:


  • 1段查询时间(1.28秒),
    yeilded 10个独特的平均
    蓝牙地址。

  • 5期查询
    时间(6.4秒),产生一个平均
    23独特的蓝牙地址。

  • 10
    段查询时间(12.8秒),
    产生29独特的平均
    蓝牙地址。

我说'独特',其实结果在重复很多相同的地址,并且,这可能是实现相关的,虽然和苹果的API只能返回唯一的地址。

I say 'unique', actually the results repeated a lot of the same addresses over and over, this may be implementation dependent though and the Apple API may only return unique addresses.

然而,这不是在这里(我的办公室)重新在现实世界,因为大多数的蓝牙设备的presentative不是在一个低功耗模式。我想,我可以通过设备的分类过滤掉电脑,笔记本电脑和检测试剂盒。这将让移动电话,那名发现等等耳机...

However, this is not representative of the 'real world' as most of the Bluetooth Devices around here (my office) are not in a low power mode. I guess, I could filter out PCs, laptops and test kit by Class of Device. That would get mobile phones, headsets that were discoverable etc...

查询也可以具有RSSI组合以获得具有最强信号的装置,但是它们不一定是最接近

Inquiry can also be combined with RSSI to get the the devices with the strongest signal but they may not necessarily be the closest.

有关您的情况可能要在时间和设备的数量做了一个调查基地例如4 *1.28秒或10台设备。

For your scenario you might want to do an inquiry bases on time and number of devices e.g 4 * 1.28 seconds or 10 devices.

要总结一下:
你可以做一个调查最短的时间为1.28秒,可以让10 +/-?在该地区的设备,如果他们是由清醒附近。

To summarise: The shortest time you can do an inquiry for is 1.28 seconds and that could get 10+/-? devices in the area IF they are awake and near by.

如果你有一个饱和的蓝牙环境或(微波炉在同一个房间去),它可能需要更长的时间来找到范围内的所有设备。

If you've got a saturated Bluetooth environment or (a microwave oven going in the same room) it could take longer to find all the devices within range.

这篇关于多长时间需要在iPhone的范围内扫描蓝牙设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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