【问题标题】:"Failed to encrypt the connection" with BlueZ peripheral and iOSBlueZ 外围设备和 iOS 的“加密连接失败”
【发布时间】:2021-03-25 17:16:32
【问题描述】:
我正在尝试制作树莓派蓝牙外围设备,因此我尝试同时运行 BlueZ 示例“example-gatt-server”和“example-advertising”。然后用我的手机通讯。但我得到“加密连接失败,连接意外超时。”在我的 iOS 上使用 nrf 连接应用程序。
我正在使用 iOS 14、BlueZ 5.50、Raspberry Pi 4、Raspberry Pi OS Stretch
【问题讨论】:
标签:
ios
bluetooth
raspberry-pi
bluetooth-lowenergy
bluez
【解决方案1】:
我建议您创建自己的 GATT 服务器,然后通过 bluetoothctl 工具将其作为外围设备进行宣传,而不是使用现成的示例。您可以通过以下顺序执行此操作:-
#bluetoothctl
[bluetoothctl] menu gatt
[bluetoothctl] register-service 0xFFFF # (Choose yes when asked if primary service)
[bluetoothctl] register-characteristic 0xAAAA read # (Select a value of 1 when prompted)
[bluetoothctl] register-characteristic 0xBBBB read,write # (Select a value of 0 when prompted)
[bluetoothctl] register-characteristic 0xCCCC read # (Select a value of 2 when prompted)
[bluetoothctl] register-application # (This commits the services/characteristics and registers the profile)
[bluetoothctl] back
[bluetoothctl] advertise on
查看以下链接,了解有关如何设置自己的外围设备的更多信息:-