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

How can I set extenend header flags?

Hi,

I am transmiting extended advertising packets and I want to set the flags on the extended header as specified on the bluetooth core specification (v5.3) page 2691 (photo attached). I need to enable AdvDataInfo (ADI). Is there any possibility to do that? I am currently using nrf52840 dongle with s140.

Thanks in advance

Parents Reply
  • Hi,

    You can't set the flags bit directly, you need to use the SoftDevice API. For the Tx-power, try settings it like this:

    static int8_t tx_power = 4;
    init.advdata.p_tx_power_level = &tx_power;

    in advertising_init():

    static void advertising_init(void)
    {
        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) / sizeof(m_adv_uuids[0]);
        init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
        static int8_t tx_power = 4;
        init.advdata.p_tx_power_level = &tx_power;
    
    
        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.config.ble_adv_primary_phy      = BLE_GAP_PHY_1MBPS;
        init.config.ble_adv_secondary_phy    = BLE_GAP_PHY_2MBPS;
        init.config.ble_adv_extended_enabled = true;
    
        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);
    }

    https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/structble__advdata__t.html?cp=8_1_6_2_7_5_11#a3ed830e9c89c1056b955e077656f8b63

Children
Related