iOS如何检测类似于Airpods的蓝牙信号强度? [英] How can iOS detect bluetooth signal strength similar to Airpods?

查看:567
本文介绍了iOS如何检测类似于Airpods的蓝牙信号强度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎AirPods和iPhone可以在非常敏感的水平上进行通信.将AirPods物理上靠近设备(相距1英尺)会触发iPhone做出反应.

It seems that AirPods and iPhone can communicate on a very sensitive level. Moving AirPods physically close to the device (1 foot away) will trigger the iPhone to react.

iPhone真的能以这种精度检测到蓝牙信号吗?我现在正在使用蓝牙,但似乎无法达到此信号灵敏度水平.

Can the iPhone really detect bluetooth signals with such accuracy? I'm using bluetooth right now, but I can't seem to reach this level of signal sensitivity.

推荐答案

他们过去曾采取其他一些措施来找出距离.正如 hotpaw2 在评论中所注意到的

They used to have some additional measures to find out the distance. As noticed by hotpaw2 in comments

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
if let power = advertisementData[CBAdvertisementDataTxPowerLevelKey] as? Double{
   print("Distance is ", pow(10, ((power - Double(truncating: RSSI))/20)))
   }
}


TL:DR;

RSSI读数不是很稳定,并且高度依赖于环境

RSSI readings are not very stable and highly depend on environment

它还可能由于多种因素而变化,包括感测/发射无线电的功率和灵敏度以及环境因素(您在室内,室外?附近有很多人吗?嘈杂的无线环境或否,依此类推).

It may also vary due to a number of factors, including both the power and sensitivity of the sensing / transmitting radios, as well as the environmental stuff (are you inside, outside? are there many people nearby? noisy wireless environment or not, and so on).

但是,问题是信标信号实际上是无线电波,并且可以被金属,墙壁,水等吸收.由于它们在常用的2.4GHz频带中发送无线电信号,因此从信标接收的信号强度会变化广泛是因为干扰.

The problem, however, is that beacon signals are actually radio waves, and can be absorbed by metals, walls, water etc. Since they transmit radio signals in the commonly used 2.4GHz band, the signal strength received from a beacon varies widely because of interference.

找出距离的最常用公式之一是

d = 10 ^((TxPower-RSSI)/20)

d = 10 ^ ((TxPower - RSSI) / 20)

TxPower通常称为发射功率

TxPower is typically known as transmit power

txPower值将在BLE广告数据中可用(仅在广播方(外围设备)提供其Tx功率电平时可用).

The txPower value will be available in BLE advertisement data (available only if the broadcaster (peripheral) provides its Tx power level).

根据Apple文档,CBAdvertisementDataTx

As per apple documentation the value of CBAdvertisementDataTxPowerLevelKey in CBAdvertisementDataTx

访问原始广告数据的委托方法

Delegate method to access the raw advertisement data

optional func centralManager(_ central: CBCentralManager, 
                 didDiscover peripheral: CBPeripheral, 
           advertisementData: [String : Any], 
                        rssi RSSI: NSNumber)

也可以使用 BlueCap API

Can be also accessed by using BlueCap API

要了解AirPlay比传统蓝牙的更多优势

To know more advantages of AirPlay than Classical Bluetooth

https://www.cambridgeaudio.com/blog/airplay

根据下面来自链接

如果您遮盖了信标,RSSI将会下降(例如,有人进入您和信标之间).也就是说,您仍然处于相同的距离,但是RSSI下降了-因此,如果您将距离估算值基于RSSI,则距离会增加,而无需移动英寸.

RSSI will go down if you cover the beacon (e.g., a person comes in between you and the beacon). That is, you're still in the same distance, but RSSI goes down—so where you to base the distance estimate on the RSSI, the distance would go up, without you moving an inch.

上面的许多解释来自其他站点.

Many of the above explanations are taken from other sites.

希望它能满足您的需求!

I Hope it sum up to your need!

这篇关于iOS如何检测类似于Airpods的蓝牙信号强度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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