broersa
broersa

Reputation: 1736

esp32 ble only let connect a single paired device

I use the Ble library, but I want to connect/pair only the first device/phone. After this only the first device is allowed to reconnect. How do I implement this? Is there a best practice? Do I need to filter the deviceid? Or are there better ways to acchieve this?

Upvotes: 0

Views: 958

Answers (1)

Emil
Emil

Reputation: 18472

That can be achieved using the Filter Accept List (previously known as White List), which is standard in the BLE spec. How to use it depends on the Bluetooth stack you are using, so you should check the manual for the Bluetooth stack you are using (you didn't mention).

If you want to support Random Resolvable addresses, you can use the Resolving List where you put the corresponding IRKs.

But a personal opinion is to instead always let any device connect to your device, and then secure sensitive services using MITM-secure authentication instead (pairing). That could potentially lead to a better experience for the user, because otherwise any connection attempt from "wrong" device will just lead to a unknown connection error from the user which might be hard to understand.

Upvotes: 2

Related Questions