This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Exceeding BLE_GAP_WHITELIST_ADDR_MAX_COUNT addresses in the whitelist

Hello!

I have the whitelist support for my device with the default settings:

/**@brief Maximum amount of addresses in the whitelist. */
#define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8)


/**@brief Maximum amount of identities in the device identities list. */
#define BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT (8)

My goal is to rewrite saved addresses in the whitelist, when there is a new 9th address bonded with my device, starting with the 1-st address in the table.
Is there some API for this?

Best wishes.

  • Hi,

    There is no API for that. However, it is the application that provides the list of whitelisted addresses and IRKs to the SoftDevice so you are free to arrange it as you want. If you allready have the list simply rearrange it (perhaps it makes sense to keep two lists, one with all addresses and another with the addresses currently being whitelisted).

  • Hello , thank you for reply!

    May be I need to expand my question

    I use whitelist for BLE as it shown in ble_app_hids_keyboard example. Let's assume my application already bonded 8 different device addresses into a memory.
    And there are new devices which I want to bond and save into whitelist address table. What steps should I do to circular replace old addresses with new ones?

    Can I reset some internal counter, which is responsible for writing a new device address into the whitelist table?

    Best regards.

  • Hi,

    The key point is that it is your responsibility to ensure that you provide maximum 8 addresses when you reply with ble_advertising_whitelist_reply(), but you can change the list in any way you like.

    As you use ble_app_hids_keyboard as reference I assume you use the peer manager for bonding, and that will generate the whitelist for you, but with a maximum of 8  addresses and 8 IRKs. The internal whitelist handling in the peer manager is also restricted to 8 though, as it uses BLE_GAP_WHITELIST_ADDR_MAX_COUNT.

    I did not test this, but it should be enough to do the following:

    1. increase this number in id_manager.c (use a higher number than BLE_GAP_WHITELIST_ADDR_MAX_COUNT which can hold all your whitelist addresses).
    2. Then when you call pm_whitelist_get() you can get a whitelist of all addresses, not just up to 8. Keep this as a separate list, and keep for instnace an index so that you know which list you currently advertise.
    3. Copy the addresses you want to advertise to a new list which is only 8 long, and reply to ble_advertising_whitelist_reply() using that. You will need to restart advertising with whitelist whenever you update the list, as then you get the BLE_ADV_EVT_WHITELIST_REQUEST event.

    This should be enough. There is no circular buffer here, as the SoftDevice API and peer manager API don't use it. Instead, simply use two buffers, one full buffer and one with 8 and copy over what you need.

Related