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

Advertising data order

Hi !

I am trying to create an advertising dataframe with 2 data fields, like that :

0C0950475754785F7878787878

10FF59FE00000000000000000000000000

I succeeded to do that, using the adddata.name_type and ble_advertising_init_t.advdata.p_manuf_specific_data.

But for now my frame is like that:

10FF59FE000000000000000000000000000C0950475754785F7878787878

And I would like that it will be like that :

0C0950475754785F787878787810FF59FE00000000000000000000000000.

Do you know how I can do that ?

Btw, I have checked this subject, https://devzone.nordicsemi.com/f/nordic-q-a/12464/regarding-advertising-data-order , but I haven't found any information for me.

Thanks !

Parents
  • Hi Beldramma, 

    Could you let me know how you configure the data for advertising ? Do you use the ble_advertising.c library ? 
    If you do you may need to dig in to the ble_advdata_encode() function (which called by ble_advertising_init() ) to see how the data is encoded and modify the order. 

    In the end the ble_advertising library will call sd_ble_gap_adv_set_configure() to actually put the encoded data to the softdevice buffer and be ready for advertising. You can also modify the encoding before that call as well. 

    In my blog here I explained a little bit on how the encoding works. It's an old blog and sd_ble_gap_adv_data_set() is no longer used but the principles are still the same. 

  • Hi Hung Bui,

    Yes I use the ble_advertising. library, and more particularly the ble_advertising_init function and ble_advertising_init_t type. Below you can see how i do that.

        ret_code_t             err_code;
        ble_advertising_init_t init;
        ble_advdata_manuf_data_t manuf_specific_data;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME; //BLE_ADVDATA_SHORT_NAME;
        init.advdata.include_appearance      = false; //AKR
        // adv manuf specific data //AKR
        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER; //AKR
        manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
        manuf_specific_data.data.size   = 6;  // Useless ?
    
        init.advdata.p_manuf_specific_data   = &manuf_specific_data;

    Ok I will check, but if I understand well, I cannot easily do that with the ble_advertising.c library, i need to directly use ble_advdata_encode function orsd_ble_gap_adv_set...

Reply
  • Hi Hung Bui,

    Yes I use the ble_advertising. library, and more particularly the ble_advertising_init function and ble_advertising_init_t type. Below you can see how i do that.

        ret_code_t             err_code;
        ble_advertising_init_t init;
        ble_advdata_manuf_data_t manuf_specific_data;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME; //BLE_ADVDATA_SHORT_NAME;
        init.advdata.include_appearance      = false; //AKR
        // adv manuf specific data //AKR
        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER; //AKR
        manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
        manuf_specific_data.data.size   = 6;  // Useless ?
    
        init.advdata.p_manuf_specific_data   = &manuf_specific_data;

    Ok I will check, but if I understand well, I cannot easily do that with the ble_advertising.c library, i need to directly use ble_advdata_encode function orsd_ble_gap_adv_set...

Children
Related