如何限制灯塔的广告范围? [英] How to limit the advertising range of a beacon?

查看:124
本文介绍了如何限制灯塔的广告范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以限制信标的范围,以便只有特定近距离(或接近度)范围内的设备才能识别并连接到信标?让我们说例如0.5米区域以外的设备不应该能够看到或连接到信标。我正在使用iOS设备作为灯塔。在Apple的 CoreLocation API中,有一个名为 peripheralDataWithMeasuredPower /ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/Reference/Reference.html\"rel =noreferrer> CLBeaconRegion 类说:

Is it possible to limit the ranging of the beacon, so that only devices within a certain close range(or proximity) can identify and connect to the beacon? Lets say for example the devices outside 0.5 meter zone shouldn't be able to see or connect to the beacon. I am using a iOS device as a beacon. In the Apple's CoreLocation API, there is a method called peripheralDataWithMeasuredPower in the CLBeaconRegion class which says:


peripheralDataWithMeasuredPower:
检索可用于将当前设备宣传为信标的数据。

peripheralDataWithMeasuredPower: Retrieves data that can be used to advertise the current device as a beacon.

(NSMutableDictionary * )peripheralDataWithMeasuredPower:(NSNumber *)measuredPower

(NSMutableDictionary *)peripheralDataWithMeasuredPower:(NSNumber *)measuredPower

参数:

measuredPower
开发站的接收信号强度指示器(RSSI)值(以分贝为单位)冰。该值表示距离一米远的信标的测量强度,并在测距期间使用。指定 nil 以使用设备的默认值。

measuredPower: The received signal strength indicator (RSSI) value (measured in decibels) for the device. This value represents the measured strength of the beacon from one meter away and is used during ranging. Specify nil to use the default value for the device.

这可以是用来限制信标的范围?如果是,我无法理解如何确定为 measurePower 参数设置的值?他们试图通过 ...表示从一米远处测量信标的强度..

Can this be used to limit the range of beacon? If yes, I am unable to understand how to decide the value to set for measurePower parameter? What are they trying to say by ...value represents the measured strength of the beacon from one meter away..?

如果这是一个非常基本的问题,请原谅。我最近开始iOS开发,非常感谢您的帮助。谢谢。

Please forgive if this is a very basic question. I've recently started iOS development and will appreciate your help. Thanks.

推荐答案

不幸的是,没有特殊硬件就没有简单的方法来调整iBeacon的范围。

Unfortunately, there is no easy way to adjust the range of an iBeacon without special hardware.


  1. 您提到的电源字段只是iBeacon传输的校准值。它不会影响iBeacon的实际物理无线电范围。 如果距离iPhone 50米远的地方可以看到发射器,那么改变功率场值就不会改变这一点。它唯一能做的就是改变是校准常数,它是距离的输入iOS软件内部的估计算法(用于精度和邻近域)。改变功率场会影响API返回的估计距离,但不会改变首次检测到iBeacon的实际距离。

  1. The power field that you mention is simply a calibration value transmitted by an iBeacon. It doesn't affect the actual physical radio range of the iBeacon. If the transmitter can be seen by an iPhone 50 meters away, altering the power field value will not change this at all. The only thing it does is change is the calibration constant which is an input to the distance estimation algorithm (used for the accuracy and proximity fields) inside the iOS software. Altering the power field will affect the estimated distance returned by the API, but it won't change the actual distance at which the iBeacon is first detected.

改变标准蓝牙的传输功率iBeacon实际上是不可能的。从理论上讲,你可以使用金属屏蔽在发射器周围构建一个法拉第笼来静音它的功率,但我的经验是它不是很有效,而且很容易受到屏蔽中的微小缺陷的影响。如果你想改变发射功率,你必须让别人建立自定义硬件。

Altering the transmit power of a standard bluetooth iBeacon is practically impossible. In theory you can use metal shielding to construct a "faraday cage" around the transmitter to mute its power, but my experience is that it isn't very effective and it is highly susceptible to tiny imperfections in the shielding. If you want to change the transmit power you have to have somebody build you custom hardware.

软件替代方案是使用测距API在iBeacon可见时跟踪它,并且只在估计的距离足够接近时执行动作,比如你建议的0.5米。这很有效 - 仅限于前台。

The software alternative is to use the ranging API to track an iBeacon while it is visible, and only perform an action when the estimated distance is close enough, say 0.5 meters as you suggest. This works great -- only in the foreground.

如果您需要在近距离内实际唤醒您的应用程序,这将无效。您可以做的最好的事情是让监控API在首次检测到iBeacon时唤醒您的应用,然后向用户发送通知并开始测距。如果用户选择将应用程序带到前台(50米),您可以继续监控,然后在0.5米处执行所需的操作。如果用户没有选择将应用程序带到前台,iOS在暂停应用程序之前只会给你大约5秒的时间来继续测试。此时距离不太可能从50米变为0.5米。

If you require actually waking up your app in the background at a close range, this won't work. The best you can do is have the monitoring API wake up your app when the iBeacon is first detected, and then send a notification to the user and start ranging. If the user elects to bring the app to the foreground (at 50 meters) you can keep monitoring and then perform your desired action at 0.5 meters. If the user does not elect to bring the app to the foreground, iOS will only give you about 5 seconds of time to continue ranging before it suspends your app. It is very unlikely that the distance will change from 50 meters to 0.5 meters in this time.

这篇关于如何限制灯塔的广告范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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