Multiple pair support but no simultaneous connection

Hello everyone,

I'm using the Bluetooth peripheral sample and I'm in a scenario where I want to connect to my board from only one device at a time, meaning I don't want multiple simultaneous connections. However, I also have pairing activated. So, I set my parameters in the .conf file like this:

CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

I'm not interested in bonding devices to the flash, so I commented out the following parameters:

# CONFIG_SETTINGS=y
# CONFIG_BT_SETTINGS=y
# CONFIG_FLASH=y
# CONFIG_FLASH_PAGE_LAYOUT=y
# CONFIG_FLASH_MAP=y
# CONFIG_NVS=y

The issue is, when my board is ON and I try to connect to it from my phone, I can connect and pair. But when I switch to another phone, I can connect but not pair. So, I changed the settings to:

CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=128

Now, I have no simultaneous connections, but I can pair with any device (assuming I don't exceed the maximum).

Can someone confirm if this is a good solution? I think it's just a workaround, and I might be missing something.

Thank you for your help!

Iheb

Parents Reply Children
  • Ih3b said:
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_KEYS_OVERWRITE_OLDEST=y

    I don't foresee any problems with using the above configuration if central devices always prompt the user to pair again after detecting that the bonding information has been cleared on the peripheral. However, this is not what I'm seeing when testing with my iPhone here.

    Here is an example where the iPhone is bonded with the peripheral, but the bond has been cleared on the peripheral, so it responds with "PIN or Key missing" when the phone tries to secure the connection with the previously exchanged key. 

    Could you maybe double check that your iphone was indeed bonded with your peripheral when you tested this (i.e. that the peripheral is still listed under "My devices" in Settings->Bluetooth after disconnecting).

  • Hi , indeed, i discovered that i had some problems with the config CONFIG_BT_KEYS_OVERWRITE_OLDEST=y

    As you said, to acheive what is desired, i have to do the following:

    we need to keep CONFIG_BT_BONDABLE=n and don't need CONFIG_BT_KEYS_OVERWRITE_OLDEST

Related