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

How to set ''Complete Local Name" of ibeacon

When I use master control panel to scan ibeacn, I find "Complete Local Name" in below picture,

How to set the "Complete local name" ?

I heard someone says set in the scan response struct,but how to set?

Thanks!

image description

Parents
  • If you want to use a short name in the advertisement data and the full name in the scan response data, you can edit the advertising_init() function in main.c to something like this:

    static void advertising_init(void)
    {
        uint32_t      err_code;
        ble_advdata_t advdata;
    
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type               = BLE_ADVDATA_SHORT_NAME;
        advdata.short_name_len          = 6;
        advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        /* Create the scan response struct: */
        ble_advdata_t srdata;
        memset(&srdata, 0, sizeof(srdata));
        srdata.name_type               = BLE_ADVDATA_FULL_NAME;
        /**/
    
        ble_adv_modes_config_t options = {0};
        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;
        
        /* Pass the srdata struct to the init function: */
        err_code = ble_advertising_init(&advdata, &srdata, &options, on_adv_evt, NULL);
        APP_ERROR_CHECK(err_code);
    }
    

    This will use the short name in advdata and the full name in srdata. Then you need to pass both to the ble_advertising_init() function.

Reply
  • If you want to use a short name in the advertisement data and the full name in the scan response data, you can edit the advertising_init() function in main.c to something like this:

    static void advertising_init(void)
    {
        uint32_t      err_code;
        ble_advdata_t advdata;
    
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type               = BLE_ADVDATA_SHORT_NAME;
        advdata.short_name_len          = 6;
        advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        /* Create the scan response struct: */
        ble_advdata_t srdata;
        memset(&srdata, 0, sizeof(srdata));
        srdata.name_type               = BLE_ADVDATA_FULL_NAME;
        /**/
    
        ble_adv_modes_config_t options = {0};
        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;
        
        /* Pass the srdata struct to the init function: */
        err_code = ble_advertising_init(&advdata, &srdata, &options, on_adv_evt, NULL);
        APP_ERROR_CHECK(err_code);
    }
    

    This will use the short name in advdata and the full name in srdata. Then you need to pass both to the ble_advertising_init() function.

Children
Related