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

device link one specific host

hi,

as we know, the device need to being linked in 1.28s if Advertising types is BLE_GAP_ADV_TYPE_ADV_DIRECT_IND ,but my host can't link device in 1.28s,so i want to link specific host by whitelist,but i can't achieve,i see log by MCP in the follow:

[11:23:14.5]Connected to address:DAFB328A3A10
[11:23:14.5]Starting a Read information Request on the whole remote DB
[11:23:14.6]lost connection to divice Reason:BTLE_CONN_FAILED_TO_BE_ESTABLISHED
[11:23:14.6]SERVER:Received packet<HicEvent:eventCode=0x0A>-<HicEvent:eventCode=0x0A>
[11:23:14.6]SERVER:Received Link Loss

my project is ble_app_uart,and related code be show in the follow

ble_gap_addr_t ble_gap_addr_01=
{BLE_GAP_ADDR_TYPE_RANDOM_STATIC,
{0x73,0x8c,0x9b,0xb7,0xd5,0xa9}};

ble_gap_addr_t  *address[1]=
{
	&ble_gap_addr_01,

};

static void advertising_start(void)
{
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;
    ble_gap_whitelist_t whitelist;
    // Start advertising
    memset(&adv_params, 0, sizeof(adv_params));
    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
    adv_params.interval    = APP_ADV_INTERVAL;
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
    whitelist.pp_addrs=address;
    whitelist.addr_count=1;
    adv_params.p_whitelist=&whitelist;
    err_code = sd_ble_gap_adv_start(&adv_params);
   if(err_code!=NRF_SUCCESS)
  {
    simple_uart_putstring((const uint8_t *)"advNO_NRF_SUCCESS\n"); 
   printf_err_code(err_code);
   }
 else
 {
    simple_uart_putstring((const uint8_t *)"advNRF_SUCCESS\n");
 }
  APP_ERROR_CHECK(err_code);
  nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
}
Related