OGeek|极客世界-中国程序员成长平台

标题: ios - 蓝牙 4.0 低功耗和 iOS : How do I detect if device is bondable or not? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 10:16
标题: ios - 蓝牙 4.0 低功耗和 iOS : How do I detect if device is bondable or not?

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

我应该实现连接失败的委托(delegate)吗?



Best Answer-推荐答案


此时什么都没有。对于更高版本的 BLE,绑定(bind)信息(GAP 模式)位于 GAP 配置文件中,但您无法通过 CoreBluetooth 获得任何信息。除部分广告数据和有限的扫描响应数据外,仅提供GATT及以下信息。

您可以读取任何所需的特征属性以查看它是否需要加密 (CBCharacteristicPropertyNotifyEncryptionRequired),这意味着您需要有一个受信任的连接(配对)才能访问它。这与您现在将要获得的一样接近。

首次连接时不应提示您配对,因此 didFailToConnectPeripheral 在这里没有帮助。只有在您尝试读取其中一个加密特征后,才会提示您配对。所以,如果你先检查特征的属性,你应该在提示用户之前知道。

来自 Apple 的 Bluetooth Accessory Design Guidelines :

The accessory should not request pairing until an ATT request is rejected using the Insufficient Authentication error code. See the Bluetooth 4.0 specification, Volume 3, Part F, Section 4 for details.

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.

关于ios - 蓝牙 4.0 低功耗和 iOS : How do I detect if device is bondable or not?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28351579/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4