Cavon
Cavon

Reputation: 21

"Failed to encrypt the connection" with BlueZ peripheral and iOS

I'm trying to make a raspberry pi bluetooth peripheral, so I try running the BlueZ example "example-gatt-server" and "example-advertising" at the same time. Then communicate it with my phone. But I got "Failed to encrypt the connection, the connection has timed out unexpectedly." on my iOS with nrf connect app.

I'm using iOS 14, BlueZ 5.50, Raspberry Pi 4, Raspberry Pi OS Stretch

Upvotes: 1

Views: 534

Answers (1)

Youssif Saeed
Youssif Saeed

Reputation: 13345

Instead of using ready made examples, I recommend that you create your own GATT server and then advertise as a peripheral through the bluetoothctl tool. You can do this through the following sequence:-

#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

Have a look at the following links for more information on how to set up your own peripheral:-

Upvotes: 0

Related Questions