Cannot conditionally disable pairing with bluetooth classic (bluedroid) (IDFGH-14491) #15260
Open
3 tasks done
Labels
Status: Opened
Issue is new
Answers checklist.
General issue report
I'm testing pairing by connecting from a macOS computer to an ESP32 board, which implements an A2DP sink. I want the following pairing behavior:
For this, I would need to be able to programmatically change pair-ability at runtime with the "just works" method. But ESP32 does not seem to support this.
Running this at initialization makes pairing "just work":
This behavior is fine if the button is pressed. But if the button is not pressed, I need a way to reject not-yet-bonded devices.
Is this just a missing feature? I must have missed something obvious. At least I didn't find anything after spending a lot of time searching the documentation and the internet (where I only found people with the same problem).
I tried working this around by changing it do
ESP_BT_IO_CAP_IO
at runtime, which would effectively force pin entry. Then I rejected the attempt in theESP_BT_GAP_CFM_REQ_EVT
handler. But this does not seem to allow already bonded devices to connect anyway. (Either ESP32 rejected this because of the settings change, or I made a mistake. But even if it worked, this isn't an ideal solution.)My next hack idea would be to disconnect the device in response to
ESP_BT_GAP_AUTH_CMPL_EVT
, which would be even hackier and extremely questionable in multiple ways, but at least it would get the job done.I'm also confused that this document talks about the device with the yes/no button, but there's no explanation how to achieve it, and instead goes on about things irrelevant to the ESP32 API user:
https://github.com/espressif/esp-idf/blob/master/examples/bluetooth/bluedroid/classic_bt/bt_spp_acceptor/ESP32_SSP.md
The text was updated successfully, but these errors were encountered: