2021-10-17 11:08 AM
My BLE (BlueNRG-MS) application has to offer the following functions and I'm not sure what's the correct approach
Any help is much appreciated and if further information is needed I'm more than happy to provide it!
Update:
Seems like as soon as the central device changes it's mac address the whitelist approach doesn't work anymore. What do I have to do in order to be able to resolve random addresses from the same central device?
2021-10-26 06:43 AM
I found a connection and pairing procedure outlined in the PM0257 (sec. 3.10.1) that seems to cover pretty much what I'm looking for. My problem now is that the referenced function aci_gap_add_device_to_resolving_list() doesn't seem to exist in my API. Do I have to use another one instead? I couldn't find one that seems to do the job.
2021-10-26 07:58 AM
I think I'm again one step further but still have some issues.
On EVT_LE_CONN_COMPLETE I call aci_gap_configure_whitelist to add the connected device to the whitelist. If I call aci_gap_get_bonded_devices I can see that a device has been added and that the added address matches with the connected one if I resolve it using aci_gap_resolve_private_address_IDB05A1 (to be honest I don't know where this IDB05A1 comes from, seems to be a dev board?).
So the device should be in the whitelist and the address should be resolvable. Still I cannot discover the peripheral with the discoverability filter policy WHITE_LIST_FOR_ALL. Or do I have to somehow add the bonded device to the whitelist on every startup?
2022-02-05 03:09 PM
Have you solved your problem? I have the same issue, after successful bonding I call aci_gap_configure_whitelist and aci_gap_add_devices_to_resolving_list with data provided by aci_gap_get_bonded_devices function (bounded devices address' types and values) then I call aci_gap_set_undirected_connectable to perform a private connection and everything seems to work pretty well, however information about bonded devices seems to be lost after reboot and I need it to be persistent.
The question is: How to save and restore bonding data on flash so it won't be lost after power-down?
2022-02-07 01:11 AM
Unfortunately I haven't had the time to further dig into this, but this will be a topic that I have to solve in the near future. My current approach would be to keep a copy of the whitelist in my application (NVM) and then restore the whitelist from this on startup. This way I also have the possibility to delete single devices from the whitelist. But I havent tried so I'm not sure whether this works or not. It would indeed be great if someone from ST could shed some light into this topic.
2022-02-08 11:56 AM
It seems like a big deal to keep whitelist but there is no hints in documentation about the proces of saving and restoring that data. It would be great if anyone from ST would share any steps. Please contact me on e-mail when you get back to your BlueNRG project and we can discuss about this and any other issues in BLE, my e-mail: dann.laboratory@gmail.com
Dann
2024-05-18 03:11 AM
Hi everyone,
Some time has passed since this issue was last discussed, and I'm wondering if anyone has found a solution. I'm experiencing a similar problem with the BlueNRG-M2 module regarding the BLE whitelist. After a reset or power cycle, the whitelist becomes ineffective, and previously paired devices can't reconnect. Has anyone found a way to preserve and restore the whitelist properly after a reboot?
Thanks for your help!
2024-05-18 08:45 AM
I've found a solution that seems to work for me. I probably didn't fully understand how the whitelist work. It appears that the whitelist isn't stored in flash memory... Therefore, it needs to be recreated at every startup and after each pairing. I wrote a function to update the whitelist that looks like this:
void updateWhitelist()
{
tBleStatus status;
uint8_t bondedLen;
Bonded_Device_Entry_t bonded[MAX_NUM_BONDED_DEVICES];
Whitelist_Identity_Entry_t whitelist[MAX_NUM_BONDED_DEVICES];
aci_gap_get_bonded_devices(&bondedLen, bonded);
for (uint8_t i = 0; i < bondedLen; i++)
{
whitelist[i].Peer_Identity_Address_Type = bonded[i].Address_Type;
memcpy(whitelist[i].Peer_Identity_Address, bonded[i].Address, 6);
}
aci_gap_configure_whitelist();
aci_gap_add_devices_to_resolving_list(bondedLen, whitelist, 1);
}
If this can help.