本文介绍了蓝牙4.0低能耗和iOS:如何检测设备是否可绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用corebluetooth框架检测外围设备是否可绑定?

Is it possible, using corebluetooth framework, to detect if peripheral is bondable?

我应该执行连接失败的委托吗?

Should I implement the failed to connect to delegate?

推荐答案

目前没有任何东西。在更高版本的BLE中,绑定信息(GAP模式)位于GAP配置文件中,但CoreBluetooth不能提供其中的一点信息。除了一些广告数据和有限的扫描响应数据外,它仅提供GATT信息及以下信息。

There is nothing at this time. With later versions of BLE, bonding information (GAP modes) is in the GAP profile, but not one bit of that information is available to you via CoreBluetooth. With the exception of some advertising data and limited scan response data, It only provides GATT information and below.

您可以读取任何所需的特性,以查看是否需要加密( CBCharacteristicPropertyNotifyEncryptionRequired ),这意味着您需要具有可信的连接(配对)才能访问它。

You could read any desired characteristic properties to see if it requires encryption (CBCharacteristicPropertyNotifyEncryptionRequired), which means you need to have a trusted connection (paired) to access it. That's as close as you're going to get for now.

第一次连接时不提示您配对,所以 didFailToConnectPeripheral 在这里无济于事。尝试读取其中一种加密特征后,系统只会提示您配对。因此,在提示用户之前,您还是应该知道是否先检查特征的属性。

You shouldn't be prompted to pair when you first connect, so didFailToConnectPeripheral won't help here. You'll only be prompted to pair after you attempt to read one of the encrypted characteristics. So, you should still know before the user is prompted if you check the properties of the characteristic first.

这是来自Apple的:

This from Apple's Bluetooth Accessory Design Guidelines:

如果出于安全原因,附件需要绑定关系
与中央服务器一起使用时,外围设备应使用
身份验证错误代码不足来拒绝ATT请求。作为
的结果,Apple产品可能会执行必要的安全性
程序。

If, for security reasons,the accessory requires a bonded relationship with the Central,the Peripheral should reject the ATT request using the Insufficient Authentication error code, as appropriate. As a result, the Apple product may proceed with the necessary security procedures.

这篇关于蓝牙4.0低能耗和iOS:如何检测设备是否可绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 13:09