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

Send TX Power in Advertising Packet

I want to send Tx power in advertisement packet.

Currently I am using following code.

 int8_t txpower_level;  
static ble_advertising_init_t init =
{
    .advdata.p_manuf_specific_data = &manufacturing_data,
    .advdata.name_type = BLE_ADVDATA_FULL_NAME,
    .advdata.include_appearance = 0,
    .advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE,
    .advdata.p_tx_power_level = &tx_power_level,
    .srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]),
    .srdata.uuids_complete.p_uuids = m_adv_uuids,
    .config.ble_adv_fast_enabled = 1,
    .config.ble_adv_fast_interval = 4 * 1600,
    .config.ble_adv_fast_timeout = 0,
    .evt_handler = on_adv_evt,
};
    ble_advertising_init(&m_advertising, &init);
    ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
    tx_power_level = -4;
    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, tx_power_level );
Is this the right way to send transmit power? or should I call  sd_ble_gap_tx_power_set before and then ble_advertising_init() followed by ble_advertising_start()?
Related