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
  • Hello,

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

    Yes, if you don't want to support bonding, but only pairing, you can comment these. In addition, you should add CONFIG_BT_BONDABLE=n to your configuration file to prevent bonding.

    The BT_KEYS_OVERWRITE_OLDEST setting is only relevant when bonding is supported. CONFIG_BT_MAX_PAIRED should also be left at the default value ('1').

  • With bondable set to 'no', when I pair and then disconnect and reconnect, my board forgets the keys, and I must pair again. I want to retain the keys to remember my device while my board remains powered on (it's acceptable for the keys to be lost once rebooted or unplugged)

Reply Children
Related