adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
601 stars 489 forks source link

Allow/Reject Pairing requests #766

Closed bigfoot38 closed 1 year ago

bigfoot38 commented 1 year ago

Hi,

I'm working on a board that does not have any Yes/No Button nor Display to accept or reject bonding requests.

I wanted to allow pairing based on a time window, which opens either on reset or when a dedicated button is pressed. This behaviour is common on several bluetooth hardwares. Well I could not figure out how to do that with the actual BLESecurity implementation.

Consequently, I added the BLESecurity::setPairable method. It controls an underlying flag. When set (default value) all requests are accepted, when false, they are all rejected.

I hope it helps, otherwise I'm opened to discussion.

Best regards, Bigfoot38