#include <stdio.h>
#include <stdbool.h>
#include <arpa/inet.h>
-#include <bluetooth-api.h>
+
+#include "bt-adaptation-adapter.h"
+#include "bt-adaptation-device.h"
#include "bluetooth.h"
#include "bluetooth_internal.h"
#include "bluetooth_private.h"
+#define BT_NAME_LEN_MAX 248
+#define BT_ADDR_STR_LEN 18 /**< This specifies BT device address length (AA:BB:CC:DD:EE:FF) */
+
#define BT_CHECK_LE_SUPPORT() \
{ \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_enable_adapter());
+ error_code = bt_adapt_enable();
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_disable_adapter());
+ error_code = bt_adapt_disable();
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(adapter_state);
- *adapter_state = bluetooth_check_adapter();
- return BT_ERROR_NONE;
+ return bt_adapt_get_state(adapter_state);
}
/* LCOV_EXCL_START */
int bt_adapter_get_address(char **address)
{
- bluetooth_device_address_t loc_address = { {0} };
int error_code = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(address);
- error_code = _bt_get_error_code(bluetooth_get_local_address(&loc_address));
- if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
- error_code); /* LCOV_EXCL_LINE */
- return error_code; /* LCOV_EXCL_LINE */
- }
+ *address = g_malloc0(BT_ADDR_STR_LEN * sizeof(char));
- error_code = _bt_convert_address_to_string(address, &loc_address);
+ error_code = bt_adapt_get_local_address(address);
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
+ g_free(*address);
+ *address = NULL;
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
error_code); /* LCOV_EXCL_LINE */
return error_code; /* LCOV_EXCL_LINE */
}
/* LCOV_EXCL_STOP */
-#define BT_ADAPTER_FIRMWARE_INFO_FILE_PATH "/var/lib/bluetooth/bcmtool_log"
-#define BT_ADAPTER_STACK_INFO_FILE_PATH "/usr/etc/bluetooth/stack_info"
-#define BT_ADAPTER_MAX_BUFFER_SIZE (32767 * 1000)
-
/* LCOV_EXCL_START */
int bt_adapter_get_local_info(char **chipset, char **firmware,
char **stack_version, char **profiles)
int bt_adapter_get_name(char **name)
{
int ret = BT_ERROR_NONE;
- bluetooth_device_name_t loc_name = { {0} };
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(name);
- ret = _bt_get_error_code(bluetooth_get_local_name(&loc_name));
+ *name = g_malloc0(BT_ADDR_STR_LEN * sizeof(char));
+
+ ret = bt_adapt_get_local_name(name);
if (ret != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
+ g_free(*name);
+ *name = NULL;
+
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), /* LCOV_EXCL_LINE */
ret); /* LCOV_EXCL_LINE */
return ret; /* LCOV_EXCL_LINE */
}
- *name = strdup(loc_name.name);
- if (*name == NULL) {
- BT_ERR("OUT_OF_MEMORY(0x%08x)", /* LCOV_EXCL_LINE */
- BT_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
- return BT_ERROR_OUT_OF_MEMORY;
- }
-
return BT_ERROR_NONE;
}
int bt_adapter_set_name(const char *name)
{
- bluetooth_device_name_t loc_name = { {0} };
int ret = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(name);
- strncpy(loc_name.name, name, BLUETOOTH_DEVICE_NAME_LENGTH_MAX);
- loc_name.name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX] = '\0';
-
- ret = _bt_get_error_code(bluetooth_set_local_name(&loc_name));
+ ret = bt_adapt_set_local_name(name);
if (ret != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), /* LCOV_EXCL_LINE */
ret); /* LCOV_EXCL_LINE */
/* LCOV_EXCL_START */
int bt_adapter_get_visibility(bt_adapter_visibility_mode_e *mode, int *duration)
{
- bluetooth_discoverable_mode_t discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
int ret = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(mode);
- ret = _bt_get_error_code(bluetooth_get_discoverable_mode(&discoverable_mode));
+ ret = bt_adapt_get_discoverable_mode(mode);
if (ret != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
return ret; /* LCOV_EXCL_LINE */
}
- *mode = _bt_get_bt_visibility_mode_e(discoverable_mode);
-
- if (duration)
- *duration = 0;
-
- if (discoverable_mode == BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE) {
- if (duration == NULL)
- return BT_ERROR_NONE;
- ret = bluetooth_get_timeout_value(duration);
- if (ret != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
- ret); /* LCOV_EXCL_LINE */
- } /* LCOV_EXCL_LINE */
- }
+ /* Not support BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE */
+ *duration = 0;
return ret;
}
int bt_adapter_set_visibility(bt_adapter_visibility_mode_e visibility_mode,
int timeout_sec)
{
- bluetooth_discoverable_mode_t discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
int error_code = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- switch (visibility_mode) {
- case BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE:
- discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
- break;
- case BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE:
- discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
- timeout_sec = 0;
- break;
- case BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE:
- discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
- timeout_sec = 0;
- break;
- default:
- BT_ERR("INVALID_PARAMETER(0x%08x)", BT_ERROR_INVALID_PARAMETER);
- return BT_ERROR_INVALID_PARAMETER;
+
+ if (visibility_mode == BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE) {
+ /* Not support BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE */
+ return BT_ERROR_NOT_SUPPORTED;
}
- error_code = _bt_get_error_code(bluetooth_set_discoverable_mode(
- discoverable_mode, timeout_sec));
+ error_code = bt_adapt_set_discoverable_mode(visibility_mode);
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
int bt_adapter_get_connectable(bool *connectable)
{
- gboolean is_connectable = FALSE;
int ret = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(connectable);
- ret = _bt_get_error_code(bluetooth_is_connectable(&is_connectable));
+ ret = bt_adapt_is_connectable(connectable);
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
return ret;
}
- *connectable = is_connectable ? true : false;
-
return BT_ERROR_NONE;
}
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_set_connectable(connectable));
+ error_code = bt_adapt_set_connectable(connectable);
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
{
GPtrArray *dev_list = NULL;
bt_device_info_s *dev_info = NULL;
- bluetooth_device_info_t *ptr = NULL;
int ret = BT_ERROR_NONE;
int i = 0;
return BT_ERROR_OUT_OF_MEMORY;
}
- ret = _bt_get_error_code(bluetooth_get_bonded_device_list(&dev_list));
+ ret = bt_adapt_get_bonded_device_list(&dev_list);
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x) : Failed to get bonded device list", /* LCOV_EXCL_LINE */
_bt_convert_error_to_string(ret), ret); /* LCOV_EXCL_LINE */
}
for (i = 0; i < dev_list->len; i++) { /* LCOV_EXCL_LINE */
- ptr = g_ptr_array_index(dev_list, i);
- if (ptr != NULL) {
- ret = _bt_get_bt_device_info_s(&dev_info,
- (bluetooth_device_info_t *)ptr);
- if (ret != BT_ERROR_NONE) {
- BT_ERR("%s(0x%08x) : Failed to get device info", /* LCOV_EXCL_LINE */
- _bt_convert_error_to_string(ret),
- ret); /* LCOV_EXCL_LINE */
+ dev_info = g_ptr_array_index(dev_list, i);
+ if (dev_info != NULL) {
+ if (!foreach_cb(dev_info, user_data))
break;
- }
-
- if (!foreach_cb(dev_info, user_data)) {
- _bt_free_bt_device_info_s(dev_info);
- break;
- }
- _bt_free_bt_device_info_s(dev_info); /* LCOV_EXCL_LINE */
} else {
BT_ERR("OPERATION_FAILED(0x%08x)", /* LCOV_EXCL_LINE */
BT_ERROR_OPERATION_FAILED); /* LCOV_EXCL_LINE */
bt_device_info_s **device_info)
{
int ret;
- bluetooth_device_address_t addr_hex = { {0,} };
- bluetooth_device_info_t *info;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_START */
- info = (bluetooth_device_info_t *)malloc(sizeof(bluetooth_device_info_t));
- if (info == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
-
- _bt_convert_address_to_hex(&addr_hex, remote_address);
-
- ret = _bt_get_error_code(bluetooth_get_bonded_device(&addr_hex, info));
+ *device_info = (bt_device_info_s *)g_malloc0(sizeof(bt_device_info_s));
+ ret = bt_adapt_get_bonded_device(remote_address, *device_info);
if (ret != BT_ERROR_NONE) {
+ g_free(*device_info);
+ *device_info = NULL;
+
BT_ERR("%s(0x%08x) : Failed to run function",
_bt_convert_error_to_string(ret),
ret);
- } else {
- ret = _bt_get_bt_device_info_s(device_info, info);
- if (ret != BT_ERROR_NONE) {
- BT_ERR("%s(0x%08x) : Failed to get device info",
- _bt_convert_error_to_string(ret),
- ret);
- }
}
- free(info);
-
return ret; /* LCOV_EXCL_STOP */
}
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_start_discovery(0, 0,
- BLUETOOTH_DEVICE_MAJOR_MASK_MISC));
+ error_code = bt_adapt_start_discovery();
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_cancel_discovery());
+ error_code = bt_adapt_stop_discovery();
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
int bt_adapter_is_discovering(bool *is_discovering)
{
- int ret = 0;
+ int ret = BT_ERROR_NONE;
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(is_discovering);
- ret = bluetooth_is_discovering();
- if (ret >= BLUETOOTH_ERROR_BASE) {
- *is_discovering = (ret == 1) ? true : false;
- return BT_ERROR_NONE;
- } else {
- ret = _bt_get_error_code(ret); /* LCOV_EXCL_LINE */
+ ret = bt_adapt_is_discovering(is_discovering);
+ if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
- return ret; /* LCOV_EXCL_LINE */
}
+
+ return ret;
}
int bt_adapter_le_is_discovering(bool *is_discovering)
{
- int ret = 0;
+ int ret = BT_ERROR_NONE;
BT_CHECK_LE_SUPPORT();
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(is_discovering);
- ret = bluetooth_is_le_discovering();
- if (ret >= BLUETOOTH_ERROR_BASE) {
- *is_discovering = (ret == 1) ? true : false;
- return BT_ERROR_NONE;
- } else {
- ret = _bt_get_error_code(ret); /* LCOV_EXCL_LINE */
+ ret = bt_adapt_is_le_scanning(is_discovering);
+ if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
- return ret; /* LCOV_EXCL_LINE */
}
+
+ return ret;
}
int bt_adapter_get_local_oob_data(unsigned char **hash,
int bt_adapter_le_set_scan_mode(bt_adapter_le_scan_mode_e scan_mode)
{
int ret = BT_ERROR_NONE;
- bluetooth_le_scan_params_t scan_params;
+ int type;
+ unsigned int interval;
+ unsigned int window;
BT_CHECK_LE_SUPPORT();
BT_CHECK_INIT_STATUS();
- scan_params.type = BT_ADAPTER_LE_ACTIVE_SCAN;
+ type = BT_ADAPTER_LE_ACTIVE_SCAN;
if (scan_mode == BT_ADAPTER_LE_SCAN_MODE_BALANCED) {
- scan_params.interval = 5000;
- scan_params.window = 2000;
+ interval = 5000;
+ window = 2000;
} else if (scan_mode == BT_ADAPTER_LE_SCAN_MODE_LOW_LATENCY) {
- scan_params.interval = 5000;
- scan_params.window = 5000;
+ interval = 5000;
+ window = 5000;
} else if (scan_mode == BT_ADAPTER_LE_SCAN_MODE_LOW_ENERGY) {
- scan_params.interval = 5000;
- scan_params.window = 500;
+ interval = 5000;
+ window = 500;
} else
return BT_ERROR_INVALID_PARAMETER;
- ret = _bt_get_error_code(bluetooth_set_scan_parameters(&scan_params));
+ ret = bt_adapt_set_scan_params(type, interval, window);
if (ret != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
int bt_adapter_le_set_customized_scan_mode(float scan_interval, float scan_window)
{
int ret = BT_ERROR_NONE;
- bluetooth_le_scan_params_t scan_params;
+ int type;
+ unsigned int interval;
+ unsigned int window;
BT_CHECK_INIT_STATUS();
- scan_params.type = BT_ADAPTER_LE_ACTIVE_SCAN;
- scan_params.interval = scan_interval;
- scan_params.window = scan_window;
+ type = BT_ADAPTER_LE_ACTIVE_SCAN;
+ interval = (unsigned int)scan_interval;
+ window = (unsigned int)scan_window;
- ret = _bt_get_error_code(bluetooth_set_scan_parameters(&scan_params));
+ ret = bt_adapt_set_scan_params(type, interval, window);
if (ret != BT_ERROR_NONE)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
int bt_adapter_le_destroy_advertiser(bt_advertiser_h advertiser)
{
int ret = BT_ERROR_NONE;
- int error_code;
- gboolean is_advertising = FALSE;
+ bool is_advertising = FALSE;
bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser;
_bt_unset_cb(BT_EVENT_ADVERTISING_STATE_CHANGED);
/* This operation is not related to the result */
- error_code = bluetooth_is_advertising(&is_advertising);
+ ret = bt_adapt_is_adv(&is_advertising);
if (is_advertising == TRUE) {
- error_code = bluetooth_set_advertising(__adv->handle, FALSE);
-
- ret = _bt_get_error_code(error_code);
+ ret = bt_adapt_stop_adv(__adv->handle);
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(advertiser);
- ret = _bt_get_error_code(bluetooth_set_advertising(__adv->handle,
- FALSE));
+ ret = bt_adapt_stop_adv(__adv->handle);
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
bt_adapter_le_advertising_state_changed_cb cb, void *user_data)
{
int ret = BT_ERROR_NONE;
- int error_code;
bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser;
- bluetooth_advertising_data_t adv = { {0} };
- bluetooth_scan_resp_data_t resp = { {0} };
- bluetooth_advertising_params_t param;
- float interval = 500;
+ unsigned int interval = 500;
BT_CHECK_LE_SUPPORT();
BT_CHECK_INIT_STATUS();
if (__adv->adv_data_len > 0 &&
__adv->adv_data) { /* LCOV_EXCL_START */
- memcpy(adv.data, __adv->adv_data, __adv->adv_data_len);
- error_code = bluetooth_set_advertising_data(__adv->handle,
- &adv, __adv->adv_data_len);
- ret = _bt_get_error_code(error_code);
+ ret = bt_adapt_set_adv_data(__adv->handle,
+ (const char *)__adv->adv_data, __adv->adv_data_len);
+
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_STOP */
if (__adv->scan_rsp_data_len > 0 &&
__adv->scan_rsp_data) { /* LCOV_EXCL_START */
- memcpy(resp.data, __adv->scan_rsp_data, __adv->scan_rsp_data_len);
- error_code = bluetooth_set_scan_response_data(__adv->handle,
- &resp, __adv->scan_rsp_data_len);
- ret = _bt_get_error_code(error_code);
+ ret = bt_adapt_set_scan_res_data(__adv->handle,
+ (const char *)__adv->scan_rsp_data, __adv->scan_rsp_data_len);
+
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_STOP */
else if (__adv->adv_params.mode == BT_ADAPTER_LE_ADVERTISING_MODE_LOW_ENERGY)
interval = 1000;
- param.interval_min = interval;
- param.interval_max = interval;
- param.filter_policy = __adv->adv_params.filter_policy;
- param.type = __adv->adv_params.type;
- error_code = bluetooth_set_custom_advertising(__adv->handle,
- TRUE, ¶m);
+ ret = bt_adapt_start_adv(__adv->handle, interval, interval,
+ __adv->adv_params.filter_policy,
+ __adv->adv_params.type);
- ret = _bt_get_error_code(error_code);
if (ret != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
ret); /* LCOV_EXCL_LINE */
mode > BT_ADAPTER_LE_ADVERTISING_MODE_LOW_ENERGY)
return BT_ERROR_INVALID_PARAMETER;
- 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 */
- }
-
/* TODO : Before set the mode, check the inprogress status */
__adv->adv_params.mode = mode;
filter_policy > BT_ADAPTER_LE_ADVERTISING_FILTER_ALLOW_SCAN_CONN_WL)
return BT_ERROR_INVALID_PARAMETER;
- 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);
- return BT_ERROR_PERMISSION_DENIED;
- }
-
/* TODO : Before set the filter policy, check the inprogress status */
__adv->adv_params.filter_policy = filter_policy;
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 */
- }
-
if (connectable)
__adv->adv_params.type = BT_ADAPTER_LE_ADVERTISING_CONNECTABLE; /* LCOV_EXCL_LINE */
else
_bt_set_cb(BT_EVENT_LE_SCAN_RESULT_UPDATED, cb, user_data);
- error_code = _bt_get_error_code(bluetooth_start_le_discovery());
+ error_code = bt_adapt_start_le_scan();
if (error_code != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */
BT_CHECK_LE_SUPPORT();
BT_CHECK_INIT_STATUS();
- error_code = _bt_get_error_code(bluetooth_stop_le_discovery());
+ error_code = bt_adapt_stop_le_scan();
if (error_code != BT_ERROR_NONE) {
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code); /* LCOV_EXCL_LINE */