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

Tx power control in real time

Hi,

I want to change the tx power of message after connected, not broadcast message

How can I do?

Can I get sample code?

BR

Paul

Parents
  • Take a look at sd_ble_gap_tx_power_set() in the softdevice header file ble_gap.h

    You should be able to change the power level upon connection from here.

  • Hi,

    sd_ble_gap_tx_power_set function's prototype is as follow:

    sd_ble_gap_tx_power_set(uint8_t role, uint16_t handle, int8_t tx_power);

    Can I call this function like this with null handler?

    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0, -30);

    BR

    Paul

  • The doxygen comments in the header file are your guide: See ble_gap.h:

    * @param[in] handle The handle parameter is interpreted depending on role:
    * - If role is @ref BLE_GAP_TX_POWER_ROLE_CONN, this value is the specific connection handle.
    * - If role is @ref BLE_GAP_TX_POWER_ROLE_ADV, the advertising set identified with the advertising handle,
    * will use the specified transmit power, and include it in the advertising packet headers if
    * @ref ble_gap_adv_properties_t::include_tx_power set.
    * - For all other roles handle is ignored.

    Also, see the constraints on power level: -30 dBm is not an option.

    I have not yet used this option, so you're just going to have to experiment with it.

    It is on my todo list, but higher priorities are keeping me from it.

Reply
  • The doxygen comments in the header file are your guide: See ble_gap.h:

    * @param[in] handle The handle parameter is interpreted depending on role:
    * - If role is @ref BLE_GAP_TX_POWER_ROLE_CONN, this value is the specific connection handle.
    * - If role is @ref BLE_GAP_TX_POWER_ROLE_ADV, the advertising set identified with the advertising handle,
    * will use the specified transmit power, and include it in the advertising packet headers if
    * @ref ble_gap_adv_properties_t::include_tx_power set.
    * - For all other roles handle is ignored.

    Also, see the constraints on power level: -30 dBm is not an option.

    I have not yet used this option, so you're just going to have to experiment with it.

    It is on my todo list, but higher priorities are keeping me from it.

Children
Related