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

Mesh 2.1.1 Set Transmit Power on the fly

Hey everyone,

I use Bluetooth Mesh 2.1.1 , SDK 15.0,  and nRF52840

I  want to change the Transmit Power of my Beacon-Server (Mesh Advertisement Packet)  on the  fly, for example I want to use a Client and sent a command to the Server to change Tx-Power.

1) can I change the tx power of one node on the fly (via a command from another node)  ?

2) First I want to try out hard-coded variant. I tried to use the sd_ble_gap_tx_power_set ,  but the problem is,  that i need the handle and i don't know where i can get it.

#define BLE_GAP_ADV_SET_HANDLE_NOT_SET (0xFF)
uint8_t       m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;

static void adv_init(void)
{
   
    advertiser_instance_init(&m_advertiser, NULL, m_adv_buffer, ADVERTISER_BUFFER_SIZE);
    //&m_advertiser.config.advertisement_interval_us
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Advertisment init\n");
     uint32_t err_code = NRF_SUCCESS;
    err_code =sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV,m_adv_handle,0);
    APP_ERROR_CHECK(err_code);

}

i get the follow output:

<t:          0>, main.c,  364, ----- BLE Mesh Light Switch Server Demo -----
<t:          0>, mesh_softdevice_init.c,  117, Initializing SoftDevice...
<t:          0>, mesh_softdevice_init.c,   75, Enabling BLE...
<t:         16>, mesh_softdevice_init.c,  109, sd_ble_enable: app_ram_base should be adjusted to 0x20002DA0
<t:        574>, main.c,  305, Initializing and adding models
<t:        577>, main.c,  173, Advertisment init
<t:        579>, app_error_weak.c,  105, Mesh error 12292 at 0x00000000 (:0)

Related