Hi,
I am working on nrf52832 , SDK15 and softdevice S132. I am modifying the ble_app_hrs example code in SDK
I was trying to implement a whitelist with the address of my ANdroid phone so that peripheral will connect only to this phone .
I have hard coded the MAC address , but it is not connecting. And If i disable whitelist it is connecting.
My doubt is , which address(of the phone) should we put?(I am attaching an image)
Or is there any restriction to the adddress type of the address in the phone?(due to which the disconnect happens)
And in which order should the array to be filled?
I have done as follows(the address is shown in the image)
peer_addr.addr[0] = 0xbc; peer_addr.addr[1] = 0x41; peer_addr.addr[2] = 0x01; peer_addr.addr[3] = 0x31; peer_addr.addr[4] = 0x8f; peer_addr.addr[5] = 0x48;
Is this the correct way to fill the array?
Thanking you.
Here are my code snippets
1) In advertising_init() added the following
init.advdata.flags= BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; init.config.ble_adv_whitelist_enabled = true;
2) Added the following in on_adv_evt()
ble_gap_addr_t peer_addr; //peer device address ble_gap_addr_t const * p_peer_addr; ble_gap_addr_t const * const * pp_peer_addr; .............................. ............................. case BLE_ADV_EVT_WHITELIST_REQUEST: memset(&peer_addr, 0x00, sizeof(peer_addr)); peer_addr.addr[0] = 0xbc; peer_addr.addr[1] = 0x41; peer_addr.addr[2] = 0x01; peer_addr.addr[3] = 0x31; peer_addr.addr[4] = 0x8f; peer_addr.addr[5] = 0x48 //peer_addr pointers. Double pointers for the win! :S p_peer_addr = &peer_addr; pp_peer_addr = &p_peer_addr; // Set white list err_code = sd_ble_gap_whitelist_set(pp_peer_addr, 0x01); if (err_code == NRF_SUCCESS) NRF_LOG_INFO("Successfully set whitelist!\n"); // White list reply err_code = ble_advertising_whitelist_reply(&m_advertising,p_peer_addr, 1, NULL, (uint32_t) NULL); if (err_code == NRF_SUCCESS) NRF_LOG_INFO( "Whitelist replied\n"); APP_ERROR_CHECK(err_code); break;
Please let me know are the above changes sufficient to make the whitelist work?
Am I missing something?
Anything to do with filter policies?
with regards,
Geetha