简体   繁体   English

如何限制灯塔的广告范围?

[英]How to limit the advertising range of a beacon?

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. 让我们说例如0.5米区域以外的设备不应该能够看到或连接到信标。 I am using a iOS device as a beacon. 我正在使用iOS设备作为灯塔。 In the Apple's CoreLocation API, there is a method called peripheralDataWithMeasuredPower in the CLBeaconRegion class which says: 在Apple的CoreLocation API中, CLBeaconRegion类中有一个名为peripheralDataWithMeasuredPower的方法,它说:

peripheralDataWithMeasuredPower: Retrieves data that can be used to advertise the current device as a beacon. peripheralDataWithMeasuredPower:检索可用于将当前设备通告为信标的数据。

(NSMutableDictionary *)peripheralDataWithMeasuredPower:(NSNumber *)measuredPower (NSMutableDictionary *)peripheralDataWithMeasuredPower:(NSNumber *)measuredPower

Parameters: 参数:

measuredPower : The received signal strength indicator (RSSI) value (measured in decibels) for the device. measuredPower :设备的接收信号强度指示器(RSSI)值(以分贝为单位)。 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. 指定nil以使用设备的默认值。

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? 如果是,我无法理解如何确定为measurePower参数设置的值? What are they trying to say by ...value represents the measured strength of the beacon from one meter away.. ? 他们想说的是什么...value represents the measured strength of the beacon from one meter away..

Please forgive if this is a very basic question. 如果这是一个非常基本的问题,请原谅。 I've recently started iOS development and will appreciate your help. 我最近开始iOS开发,非常感谢您的帮助。 Thanks. 谢谢。

Unfortunately, there is no easy way to adjust the range of an iBeacon without special hardware. 不幸的是,没有特殊硬件就没有简单的方法来调整iBeacon的范围。

  1. The power field that you mention is simply a calibration value transmitted by an iBeacon. 您提到的功率场只是iBeacon传输的校准值。 It doesn't affect the actual physical radio range of the iBeacon. 它不会影响iBeacon的实际物理无线电范围。 If the transmitter can be seen by an iPhone 50 meters away, altering the power field value will not change this at all. 如果距离50米的iPhone可以看到发射器,那么改变功率场值将不会改变这一点。 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. 它唯一做的是改变是校准常数,它是iOS软件内部距离估计算法(用于精度和接近场)的输入。 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. 改变功率场将影响API返回的估计距离,但不会改变首次检测到iBeacon的实际距离。

  2. Altering the transmit power of a standard bluetooth iBeacon is practically impossible . 改变标准蓝牙iBeacon的发射功率几乎是不可能的 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. 如果你想改变发射功率,你必须让别人建立自定义硬件。

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. 软件替代方案是使用测距API在iBeacon可见时跟踪iBeacon,并且仅在估计距离足够接近时执行操作,比如说你建议的0.5米。 This works great -- only in the foreground. 这很有效 - 只在前台。

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. 您可以做的最好的事情是让监控API在首次检测到iBeacon时唤醒您的应用,然后向用户发送通知并开始测距。 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. 如果用户选择将应用程序带到前台(50米处),您可以继续监控,然后在0.5米处执行所需的操作。 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. 如果用户没有选择将应用程序带到前台,iOS在暂停应用程序之前只会给你大约5秒的时间来继续测距。 It is very unlikely that the distance will change from 50 meters to 0.5 meters in this time. 在这段时间内,距离不太可能从50米变为0.5米。

With most BLE chips I've investigated, there are usually at least four settings for transmission power level that can be used to limit the advertising range. 对于我研究过的大多数BLE芯片,通常至少有四种传输功率级别设置可用于限制广告范围。

The Texas Instruments CC2541 (as used in their SensorTag development device) and CC2540 have +4, 0, -6, and -23 as their power level options. 德州仪器CC2541(用于其SensorTag开发设备)和CC2540具有+ 4,0,-6和-23作为其功率电平选项。 However, changing that in the SensorTag does require a recompile of the firmware. 但是,在SensorTag中更改它确实需要重新编译固件。 As-is, the provided firmware mentions the power level in only one place, but that is just a value that is broadcasted to inform any central listener how loud the beacon is—so that the central device can better calculate an estimated range based on received signal strength (RSSI). 按原样,所提供的固件仅在一个地方提到功率电平,但这只是一个广播的值,以通知任何中央收听者信标有多大 - 这样中央设备可以更好地计算基于接收的估计范围信号强度(RSSI)。 An additional line must be added to the firmware to actually change the transmission power. 必须在固件中添加一条额外的线路才能实际更改传输功率。 For example: 例如:

HCI_EXT_SetTxPowerCmd( HCI_EXT_TX_POWER_0_DBM );

Based on this, there should be two places on an iOS device where you can set the power level: one that just informs the listeners what the level is, and one where the BLE chip's true transmission power is actually changed. 基于此,iOS设备上应该有两个位置可以设置功率级别:一个用于通知监听器级别是什么,另一个用于实际更改BLE芯片的真实传输功率。 However, expect these values to be restricted to only a few enumerated choices which may or may not meet your real-world range needs. 但是,期望这些值仅限于少数列举的选项,这些选择可能会或可能不会满足您的实际范围需求。

(The SensorTag's -23 setting would probably do well for a 0.5 meter detection range. But if you want the SensorTag to always be advertising, it will require an additional firmware change .) (SensorTag的-23设置可能适用于0.5米的检测范围。但如果您希望SensorTag始终进行广告宣传,则需要额外更改固件 。)

Have you looked to see if the proximity property was helpful? 您是否想看看proximity属性是否有用? From the apple docs : 来自苹果文档

CLProximity Constants that reflect the relative distance to a beacon. CLProximity反映与信标相对距离的常量。

typedef {
   CLProximityUnknown,
   CLProximityImmediate,
   CLProximityNear,
   CLProximityFar
} CLProximity;

I would also experiment trying to combine the the proximity with accuracy and rssi . 我也会尝试尝试将proximityaccuracyrssi相结合。

It's gonna vary from beacon to beacon. 从灯塔到灯塔,它会有所不同。 If you use beacons from Radius Networks, they have a transmit power setting that lets you essentially limit the ability of the beacon radio to broadcast to long ranges. 如果您使用Radius Networks的信标,则它们具有发射功率设置,使您可以基本上限制信标无线电广播到远程范围的能力。 I don't know if other brands have it, but most do not from what I've seen. 我不知道其他品牌是否拥有它,但大部分都不是我所见过的。

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

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