Objective-C iOS 6 BLE(蓝牙4.0)距离计算 [英] Objective-C iOS 6 BLE (Bluetooth 4.0) Distance calculation

查看:172
本文介绍了Objective-C iOS 6 BLE(蓝牙4.0)距离计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以计算设备与iPhone之间的距离,或者至少可以了解强度,以便我可以检查距离是否越来越小。我想构建某种系统,这样可以更容易地在近距离内找到丢失的东西。

Is it possible to calculate the distance between the device and the iPhone, or at least, have an idea of the strength so I can check if the distance is getting smaller or bigger as I move. I would like to build some sort of system which makes it easier to find "lost" things in a close perimeter.

这样的事情可能吗?如果是这样,最好的方法是什么。

Is such thing possible? And if so, what is the best way to do this.

我认为这两个设备之间没有障碍。

I assume that there is no obstruction between the two devices.

推荐答案

是的,绝对!

实际上它是Core Bluetooth提供的基本功能。参考提供的链接通过之前的回答:

Actually it's basic functionality provided by Core Bluetooth. To reference a link provided by a previous answer:


在扫描期间发现外围设备时,Central
委托会收到以下回调:

As soon as a Peripheral is discovered during the scanning, the Central delegate receives the following callback:


  • (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral
    advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber
    *)RSSI

此调用通知中央经理代表(视图控制器)
发现了具有广告数据和RSSI的外围设备。
RSSI代表接收信号强度指示器。这是一个很酷的
参数,因为知道发送信号的强度和RSSI的
,你可以估计中央
和外围设备之间的当前距离。因此,你可以使用距离作为
给定服务的过滤器:只有当中心足够接近外围设备时,
然后你的应用程序会做一些事情。

This call notifies the Central Manager delegate (the view controller) that a peripheral with advertisement data and RSSI was discovered. RSSI stands for Received Signal Strength Indicator. This is a cool parameter, because knowing the strength of the transmitting signal and the RSSI, you can estimate the current distance between the Central and the Peripheral. So, you can use the distance as a filter for a given service: only if the Central is close enough to the Peripheral, then your app does something.

RSSI值允许您估算距离,创建虚拟栅栏,还可以通过将新RSSI测量与前一个RSSI测量进行比较,用于在BLE设备上进行归零。

The RSSI value allows you to estimate the distance, create virtual fences and can also be used to zero-in on a BLE device by comparing the new RSSI measurement to the previous one.

这篇关于Objective-C iOS 6 BLE(蓝牙4.0)距离计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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