Languages

Menu
Sites
Language
BLE Advertisement tx_power_level

I am working on a native Tizen  app on a Gear Fit 2. I wuould like to create an app programmed as follows: BLE in advertisement mode and send device info (e.g. magnetometer, accelerometer data). 

I'd like to know which are the possible output power levels (dBm) and how to set them. I have discovered the following function: 

bt_adapter_le_set_advertising_tx_power_level  

is it the right one? how can i set the power level?

 

sincerly,

Alessandro

Responses

1 Replies
Yasin Ali

Hi,


Below Function sets whether the Bluetooth adapter's transmission power shall be included in transmitted packets. The value
of the transmission power is obtained internally by the Bluetooth API module and does not need to be set manually.
 This is a wrapper function for the bt_adapter_le_set_advertising_tx_power_level() function.
 @param[adv_h]: the handle of the prior created advertiser.
 @param[pkt_type]: the type of the packet to be affected. The available packet types are: BT_ADAPTER_LE_PACKET_ADVERTISING,
BT_ADAPTER_LE_PACKET_SCAN_RESPONSE.
@param[flag]: 'true' to include the Bluetooth adapter's transmission power into the packet, 'false' otherwise.
@return: the function returns 'true' if the Bluetooth adapter's transmission power inclusion was set successfully,
otherwise 'false' is returned.

bool bt_common_set_tx_power_level(bt_advertiser_h adv_h, bt_adapter_le_packet_type_e pkt_type, bool flag)
{
 int ret = bt_adapter_le_set_advertising_tx_power_level(adv_h, pkt_type, flag);
 if (ret != BT_ERROR_NONE) {
  dlog_print(DLOG_ERROR, LOG_TAG, "Function bt_adapter_le_set_advertising_tx_power_level() failed with error: %s.", get_error_message(ret));
  return false;
 }
 
 return true;
}

Hope it will help you.
If you find my post is helpful for you, please mark it as the Best Answer to promote this post to others.