*/
int bt_adapter_le_set_advertising_filter_policy(bt_advertiser_h advertiser, bt_adapter_le_advertising_filter_policy_e filter_policy);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Set advertise Tx power level to control the transmission power level for the advertising
+ * @since_tizen 5.5
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] advertiser The handle of advertiser
+ * @param[in] tx_power_level Transmission power level of advertising. The valid range is [-127 ~ 1]
+ * Recommended values are bt_adapter_le_advertising_tx_power_level_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_NOW_IN_PROGRESS Operation is now in progress
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ * @see bt_adapter_le_start_advertising_new()
+ * @see bt_adapter_le_advertising_tx_power_level_e
+ */
+int bt_adapter_le_set_advertising_custom_tx_power_level(bt_advertiser_h advertiser, int tx_power_level);
+
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
bt_adapter_le_advertising_mode_e mode;
bt_adapter_le_advertising_filter_policy_e filter_policy;
bt_adapter_le_advertising_type_e type;
+ int tx_power_level;
} bt_adapter_le_advertising_parameters_s;
typedef struct {
(int result, const char *remote_address, bt_hrp_collector_h collector,
bool connected, void *user_data);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Enumerations of the Bluetooth advertising Tx power level.
+ * @since_tizen 5.5
+ */
+typedef enum {
+ BT_ADAPTER_LE_ADVERTISING_TX_POWER_HIGH = 1, /**< High transmission power level */
+ BT_ADAPTER_LE_ADVERTISING_TX_POWER_MEDIUM = -7, /**< Medium transmission power level */
+ BT_ADAPTER_LE_ADVERTISING_TX_POWER_LOW = -15, /**< Low transmission power level */
+ BT_ADAPTER_LE_ADVERTISING_TX_POWER_ULTRA_LOW = -23 /**< Lowst transmission power level */
+} bt_adapter_le_advertising_tx_power_level_e;
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
param.interval_max = interval;
param.filter_policy = __adv->adv_params.filter_policy;
param.type = __adv->adv_params.type;
+ param.tx_power_level = __adv->adv_params.tx_power_level;
error_code = bluetooth_set_custom_advertising(__adv->handle,
TRUE, ¶m);
}
/* LCOV_EXCL_START */
+int bt_adapter_le_set_advertising_custom_tx_power_level(bt_advertiser_h advertiser,
+ int tx_power_level)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser;
+
+ BT_CHECK_LE_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(advertiser);
+
+ error_code = _bt_get_error_code(
+ bluetooth_check_privilege_advertising_parameter());
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
+ error_code); /* LCOV_EXCL_LINE */
+ return BT_ERROR_PERMISSION_DENIED; /* LCOV_EXCL_LINE */
+ }
+
+ __adv->adv_params.tx_power_level = tx_power_level;
+
+ return error_code;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
int bt_adapter_le_enable_privacy(bool enable_privacy)
{
int error_code = BT_ERROR_NONE;
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_FILTER_POLICY},
{"bt_adapter_le_set_advertising_connectable"
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CONNECTABLE},
+ {"bt_adapter_le_set_advertising_custom_tx_power_level"
+ , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CUSTOM_TX_POWER},
{"bt_adapter_le_start_advertising_new"
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_ADVERTISING_NEW},
{"bt_adapter_le_stop_advertising"
param_count = 1;
TC_PRT("Input adv type \n (0 : Non-connectable (ADV_SCAN_IND), 1 : Connectable (ADV_IND) ");
break;
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CUSTOM_TX_POWER:
+ param_count = 1;
+ TC_PRT("Input adv Tx power level \n ( 1 ~ -127 dBm) ");
+ break;
case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_ADVERTISING:
param_count = 1;
TC_PRT("Input adv slot id \n (Default is 0, Maximum is 2) ");
TC_PRT("add scan response data [0x%04x]", ret);
break;
}
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CUSTOM_TX_POWER: {
+ int tx_power_level = 0;
+
+ advertiser = advertiser_list[advertiser_index];
+
+ if (advertiser == NULL) {
+ ret = bt_adapter_le_create_advertiser(&advertiser);
+ TC_PRT("created le advertiser(%d)", ret);
+ advertiser_list[advertiser_index] = advertiser;
+ }
+
+ if (g_test_param.param_count > 0) {
+ tx_power_level = atoi(g_test_param.params[0]);
+ __bt_free_test_param(&g_test_param);
+ }
+
+ ret = bt_adapter_le_set_advertising_custom_tx_power_level(advertiser, tx_power_level);
+ if (ret != BT_ERROR_NONE)
+ TC_PRT("set Tx power level [0x%04x]", ret);
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_ADVERTISING_NEW: {
bt_adapter_le_advertising_state_changed_cb cb;
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_MODE,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_FILTER_POLICY,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CONNECTABLE,
+ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CUSTOM_TX_POWER,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_ADVERTISING_NEW,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_ADVERTISING,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_ADVERTISING,