Hi,
Is it possible to add a static bluetooth address to the whitelist?
I am using SDK 14.2.0, device is nrf52832 + peer manager.
BR
bjarke
Hi,
Is it possible to add a static bluetooth address to the whitelist?
I am using SDK 14.2.0, device is nrf52832 + peer manager.
BR
bjarke
Hi,
Whitelist can be used both by peripheral (to filter which centrals can connect) and by central (to filter what peripherals to connect to.) I assume that you need this for a peripheral.
If you use the Advertising Module then it is your responsibility to provide a whitelist on the BLE_ADV_EVT_WHITELIST_REQUEST event.
You may then choose to fetch a whitelist from peer manager using pm_whitelist_get(), as is done for instance in the HID Mouse Application example.
Or, in your case, you may make a whitelist manually using any Bluetooth addresses that you would like. The whitelist is an array of ble_gap_addr_t structures and an array of ble_gap_irk_t structures. (The IRK structure is only needed for resolvable addresses, not for static ones.)
In any case you must reply to the whitelist request event with a call to ble_advertising_whitelist_reply(), where you provide the whitelist.
Regards,
Terje
Hi,
I have tried to send a static address using the ble_advertising_whitelist_reply(), However I can't get it to work.
Setting up static addr:
ble_gap_addr_t public_device[1] = {{ .addr_type = BLE_GAP_ADDR_TYPE_PUBLIC, .addr = {0x8d, 0xaa, 0xa4, 0x2d, 0x65, 0x94}, // samsung tablet }}; ble_gap_addr_t const * whitelist_addrs = &public_device; irk_cnt = 0; addr_cnt = 1; err_code = ble_advertising_whitelist_reply(&m_advertising, &whitelist_addrs, addr_cnt, whitelist_irks, irk_cnt);
err_code return is 0
However advertising never starts.
If I replace the static addr with the pm_whitelist_get(whitelist_addr, &addr_cnt, whitelist_irks, &irk_cnt); it works.
Is there a connection between whitelist, advertising and peer manager behind the scene?
Regards
Bjarke
Hi again,
Look at similar problem
https://devzone.nordicsemi.com/f/nordic-q-a/18463/setting-up-whitelist-in-sdk-v12-2-0
I tried to reproduce...
If I use
ble_gap_addr_t whitelist_addr = {1, BLE_GAP_ADDR_TYPE_PUBLIC, {0x8d,0xaa,0xa4,0x2d,0x65,0x94}}; const ble_gap_addr_t *p_whitelist_addr[] = {&whitelist_addr}; err_code = sd_ble_gap_whitelist_set(p_whitelist_addr, 1); APP_ERROR_CHECK(err_code); err_code = ble_advertising_whitelist_reply(&m_advertising, p_whitelist_addr[0], 1, NULL, 0);
I do get fast advertising with whitelist, but somehow the address?(I suppose) is wrong, cause I cannot connect.
Changing p_whitelist_addr[0] to NULL does not do anything.
BR
bjarke
Hi,
I have been looking at ble_advertising.c, and can see that for Softdevice >2, the adresses are not used in the ble_advertising_whitelist_reply(...
from ble_advertising.c:
uint32_t ble_advertising_whitelist_reply(ble_advertising_t * const p_advertising, ble_gap_addr_t const * p_gap_addrs, uint32_t addr_cnt, ble_gap_irk_t const * p_gap_irks, uint32_t irk_cnt) { if (!p_advertising->whitelist_reply_expected) { return NRF_ERROR_INVALID_STATE; } p_advertising->whitelist_reply_expected = false; #if (NRF_SD_BLE_API_VERSION <= 2) p_advertising->whitelist.addr_count = addr_cnt; p_advertising->whitelist.irk_count = irk_cnt; for (uint32_t i = 0; i < addr_cnt; i++) { *p_advertising->whitelist.pp_addrs[i] = p_gap_addrs[i]; } for (uint32_t i = 0; i < irk_cnt; i++) { *p_advertising->whitelist.pp_irks[i] = p_gap_irks[i]; } #else p_advertising->whitelist_in_use = ((addr_cnt > 0) || (irk_cnt > 0)); #endif return NRF_SUCCESS; }
Any ideas?
Regards
Hi Terje,
I can't get it to work with SDK 14 and softdevice 5. It seems that whitelist depends on peer manager and the creation of a peer ID. But I cant get a static address set and whitelisted.
Regards
Bjarke