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

Advertise full name only

Hi,

I have the following initialization for advertising:

    ret_code_t             err_code;
    ble_advertising_init_t init;

    memset(&init, 0, sizeof(init));


    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = true;
    init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids[0]) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids  = &m_adv_uuids[service_index];

    NRF_LOG_INFO("UUID %i, index %i", init.advdata.uuids_complete.p_uuids->uuid, service_index);

    init.srdata.name_type 				= BLE_ADVDATA_FULL_NAME;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(this->m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(this->m_advertising, APP_BLE_CONN_CFG_TAG);

    NRF_LOG_INFO("Advertising initialized.");

The name consists of an acronym od three letters and a underscore e,g, XXX_ and a six digit ID. Like XXX_12E124.

On iOS I can see the full name normally, on android aswell but sometimes I only get XXX_. This is very often the case when I try to connect to a PC e.g. mac book or Linux Ubuntu. It takes several seconds until the full name is advertised. How can I force to only advertise the full name and not the short name.

Thanks,

Constantin

Parents
  • Okay I guess I have the solution:

        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance      = true;
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
        init.srdata.name_type = BLE_ADVDATA_NO_NAME;
        init.srdata.include_appearance      = false;
        init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids[0]) / sizeof(m_adv_uuids[0]);
        init.srdata.uuids_complete.p_uuids  = &m_adv_uuids[service_index];
        NRF_LOG_INFO("UUID %i, index %i", init.srdata.uuids_complete.p_uuids->uuid, service_index);
    
    
        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
    

    I moved the entire UUID and service stuff into the srdata. To speed up the advertisment I set the include_appearance flag to true. No avoid duplicates the srdata does not include the full name. But I guess it does not matter if it is included. In my tests this yield the fastest scanning and connection time.

    cheers,

    Constantin

Reply
  • Okay I guess I have the solution:

        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance      = true;
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
        init.srdata.name_type = BLE_ADVDATA_NO_NAME;
        init.srdata.include_appearance      = false;
        init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids[0]) / sizeof(m_adv_uuids[0]);
        init.srdata.uuids_complete.p_uuids  = &m_adv_uuids[service_index];
        NRF_LOG_INFO("UUID %i, index %i", init.srdata.uuids_complete.p_uuids->uuid, service_index);
    
    
        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
    

    I moved the entire UUID and service stuff into the srdata. To speed up the advertisment I set the include_appearance flag to true. No avoid duplicates the srdata does not include the full name. But I guess it does not matter if it is included. In my tests this yield the fastest scanning and connection time.

    cheers,

    Constantin

Children
No Data
Related