与iOS获取蓝牙LE扫描响应数据 [英] Obtaining Bluetooth LE scan response data with iOS

查看:1564
本文介绍了与iOS获取蓝牙LE扫描响应数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与蓝牙低功耗设备的工作,我想知道是否有可能无需连接读取扫描响应数据与iOS和核心蓝牙广告。

I am working with Bluetooth Low Energy devices, and I was wondering whether it is possible to read the Scan Response Data to an advertisement with iOS and Core Bluetooth without connecting.

据我所知,读取通告报文后,可以从周边的31个字节扫描响应的格式要求额外的数据。我知道,核心蓝牙表明,如果广告包满了,你可以在扫描响应包把本地的名字,但它可以让你看到整个数据包?

I understand that after reading an advertisement packet, you can request additional data from the peripheral in the format of a 31 byte scan response. I know that Core Bluetooth suggests that if the ad packet is full, you can put the local name in the scan response packet, but does it allow you to see the whole packet?

推荐答案

是的,你可以使用 CoreBluetooth 阅读BLE广告的完整字节的只要因为它不是一个iBeacon显示广告。的如果是iBeacon显示广告, CoreBluetooth 将阻止你看到字节的能力。您使用的回调如下:

Yes, you can use CoreBluetooth to read the full bytes of a BLE advertisement as long as it is NOT an iBeacon advertisement. If it is an iBeacon advertisement, CoreBluetooth will block your ability to see the bytes. The callback you use is as follows:

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

原始字节将是的NSDictionary * advertisementData 里面present。但它们密钥保持这些数据将被操作系统用于iBeacons被移除。

The raw bytes will be present inside the NSDictionary *advertisementData. But they key holding those data will be removed by the operating system for iBeacons.

下面是你在advertisementData 的NSDictionary 在回调中得到的一个例子。这个例子是用于检测AltBeacon广告(一个开源的灯塔标准),使用标识符2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 2

Here's an example of what you get in the advertisementData NSDictionary in the callback. This example is for detecting an AltBeacon advertisement (an open-source beacon standard), with identifiers 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 2

{
    kCBAdvDataIsConnectable = 0;
    kCBAdvDataManufacturerData = <1801beac 2f234454 cf6d4a0f adf2f491 1ba9ffa6 00010002 be00>;
}

您可以看到如何通过看AltBeacon规范这里去code以上的字节。

You can see how to decode the above bytes by looking at the AltBeacon spec here.

有关你为什么不能额外code向您展示如何设置此陪读iBeacon显示数据的详细信息,请参见这里:

For more details about why you can't read iBeacon data along with additional code showing how you set this up, see here:

http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html

这篇关于与iOS获取蓝牙LE扫描响应数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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