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

  • Hi.

    Could the short name be due to adding too much data to your advertising packet?

    The inbuilt functionality will automatically shorten the adv name if there is too much data in the advertising packet (limit of 31 bytes).
    I see that you have included the full advertising name in the scan response packet as well. Is that where you see the full name?

    Br,
    Joakim

  • Your appearance is enable....So how about your appearance data ?

    My project is appearance is disable.

    #define DEVICE_NAME                     "FOXLINK_BLE" 

    static void advertising_init(void)
    {
    uint32_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 = false;
    init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids = m_adv_uuids;

    init.config.ble_adv_fast_enabled = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

    static void gap_params_init(void)
    {
    uint32_t err_code;
    ble_gap_conn_params_t gap_conn_params;
    ble_gap_conn_sec_mode_t sec_mode;

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

    err_code = sd_ble_gap_device_name_set(&sec_mode,
    (const uint8_t *) FL310_name,
    strlen(FL310_name));
    APP_ERROR_CHECK(err_code);

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

    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
    gap_conn_params.slave_latency = SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;

    err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
    APP_ERROR_CHECK(err_code);
    }

    The ios& android can advertise the full name.

    You may check your adv. package type & length.

  • Hi Henry,

    your advice helped already a bit. By disabling the include_appearance the name is advertised with 8 symbols at least.

    But the full name (10 letters) is still not advertised. Or only later. I disabled as well the scan response but still no change.

    What could influence the amount of data advertised?

    Kind regards,

    Constantin

  • 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

Related