hi, I am working with nrf51822 development board using Softdevice(s130) and sdk 11.0.0.I implemented whitelisting in ble_app_uart code but it's not working correctly.Once I got paired and bonded with my phone having ble uart app and when I am disconnecting the connection it's advertising and get bonded with other device.Also device name length reduces after implementing whitelist I have given #device_name "Whitelisting" but its advertising "whit" only. this is my code below
static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = true;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
advdata.uuids_complete.p_uuids = m_adv_uuids;
ble_adv_modes_config_t options = {0};
options.ble_adv_whitelist_enabled = BLE_ADV_WHITELIST_ENABLED; //added for white listing
options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;
err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);
}
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
uint32_t err_code;
switch (ble_adv_evt)
{
case BLE_ADV_EVT_FAST:
err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
break;
case BLE_ADV_EVT_IDLE:
sleep_mode_enter();
break;
case BLE_ADV_EVT_WHITELIST_REQUEST://extra added for whitelisting
{
ble_gap_whitelist_t whitelist;
ble_gap_addr_t * p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
ble_gap_irk_t * p_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 = p_whitelist_addr;
whitelist.pp_irks = p_whitelist_irk;
err_code = dm_whitelist_create(&m_app_handle, &whitelist);
APP_ERROR_CHECK(err_code);
err_code = ble_advertising_whitelist_reply(&whitelist);
APP_ERROR_CHECK(err_code);
break;
}
default:
break;
}
}
static void sys_evt_dispatch(uint32_t sys_evt)
{
pstorage_sys_event_handler(sys_evt); //Add this line
ble_advertising_on_sys_evt(sys_evt);
}
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
on_ble_evt(p_ble_evt);
ble_conn_params_on_ble_evt(p_ble_evt);
ble_advertising_on_ble_evt(p_ble_evt);
dm_ble_evt_handler(p_ble_evt); //Add this line
}
can anyone help me?