This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can i start an advertising with a whitelist?

Hi all, I'm reading the ble_peripheral samples of the SDK. I know start a advertising with the function ble_advertising_start(); Now, i know a central address, then i want connect to that device. I want start the advertising with a whitelist for can be connected by that central only. How to modify the sample codes and do i need irks or something else? Thanks~~

Parents
  • case BLE_ADV_EVT_WHITELIST_REQUEST: { ble_gap_whitelist_t whitelist;

    					ble_gap_addr_t    * sp_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
    					ble_gap_irk_t     * sp_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
    					whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
    					whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
    					whitelist.pp_addrs   = sp_whitelist_addr;
    					whitelist.pp_irks    = sp_whitelist_irk;
    
    					err_code = dm_whitelist_create(&m_dm_app_id, &whitelist);
    					APP_ERROR_CHECK(err_code);
    
    					err_code = ble_advertising_whitelist_reply(&whitelist);
    					APP_ERROR_CHECK(err_code);
    					break;
    			}
    
Reply
  • case BLE_ADV_EVT_WHITELIST_REQUEST: { ble_gap_whitelist_t whitelist;

    					ble_gap_addr_t    * sp_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
    					ble_gap_irk_t     * sp_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
    					whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
    					whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
    					whitelist.pp_addrs   = sp_whitelist_addr;
    					whitelist.pp_irks    = sp_whitelist_irk;
    
    					err_code = dm_whitelist_create(&m_dm_app_id, &whitelist);
    					APP_ERROR_CHECK(err_code);
    
    					err_code = ble_advertising_whitelist_reply(&whitelist);
    					APP_ERROR_CHECK(err_code);
    					break;
    			}
    
Children
No Data
Related