*/
int bt_adapter_le_is_scan_filter_supported(bool *is_supported);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Starts the LE scan to find LE advertisement.
+ *
+ * @details If a LE advertisement is found, bt_adapter_le_new_scan_result_cb() will be invoked.
+ *
+ * @since_tizen 8.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ * @param[in] cb The callback to report the result of this function
+ * @param[in] user_data The user data to be passed when callback is called
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_NOW_IN_PROGRESS Operation is now in progress
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @post This function invokes bt_adapter_le_scan_result_cb().
+ *
+ * @see bt_adapter_le_new_scan_result_cb()
+ */
+int bt_adapter_le_start_scan_new(bt_adapter_le_new_scan_result_cb cb, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets Bluetooth LE scan role.
+ * @since_tizen 8.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ * @param[in] role The scan role
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled
+ * @retval #BT_ERROR_INVALID_PARAMETER Parameter is invalid
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ * @pre The state of local bluetooth must be #BT_ADAPTER_ENABLED.
+ * @pre The bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ */
+int bt_adapter_le_set_scan_role(bt_adapter_le_scan_role_e role);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets Bluetooth LE scan role.
+ * @since_tizen 8.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ * @param[in] phy The scanning phy. Valid values are one of BT_LE_ALL_PHY,
+ * BT_LE_1M_PHY, BT_LE_CODED_PHY.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled
+ * @retval #BT_ERROR_INVALID_PARAMETER Parameter is invalid
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ * @pre The state of local bluetooth must be #BT_ADAPTER_ENABLED.
+ * @pre The bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ */
+int bt_adapter_le_set_scan_phy(bt_adapter_le_phy_e phy);
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
BT_EVENT_MESH_JOIN_NETWORK, /**< Mesh - Join Complete callback */
BT_EVENT_L2CAP_CHANNEL_CONNECTION_STATE_CHANGED, /**< L2CAP LE socket connection state is changed */
BT_EVENT_L2CAP_CHANNEL_CONNECTION_REQUESTED, /**< L2CAP LE socket connection is requested */
+ BT_EVENT_LE_NEW_SCAN_RESULT_UPDATED, /**< LE new Scan result is updated */
BT_EVENT_MAX
} bt_event_e;
BT_FEATURE_COMMON = BT_FEATURE_BASE,
BT_FEATURE_LE,
BT_FEATURE_LE_5_0,
+ BT_FEATURE_LE_ADV_EXT,
BT_FEATURE_LE_COC,
BT_FEATURE_IPSP,
BT_FEATURE_MESH,
BT_ADAPTER_LE_ACTIVE_SCAN
} bt_adapter_le_scan_type_e;
+/**
+* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+* @since_tizen 8.0
+* @brief Enumerations of the Bluetooth LE scan role.
+*/
+typedef enum {
+ BT_ADAPTER_LE_SCAN_ALL = 0x00,
+ BT_ADAPTER_LE_SCAN_LEGACY_ONLY,
+ BT_ADAPTER_LE_SCAN_EXTENDED_ONLY
+} bt_adapter_le_scan_role_e;
+
+/**
+* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+* @since_tizen 8.0
+* @brief Enumerations of the Bluetooth LE phy.
+*/
+typedef enum {
+ BT_LE_ALL_PHY = 0x00,
+ BT_LE_1M_PHY = 0x01,
+ BT_LE_2M_PHY = 0x02,
+ BT_LE_CODED_PHY = 0x03
+} bt_adapter_le_phy_e;
+
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
* @brief Called when the manufacturer dat changes.
bt_tds_transport_block_list_s *info, bt_adapter_le_device_scan_result_info_s *scan_info,
void *user_data);
+typedef struct {
+ int event_type;
+ int primary_phy;
+ int secondary_phy;
+ int advertising_sid;
+ int tx_power;
+ int periodic_adv_int;
+ bool is_extended;
+ bt_adapter_le_device_scan_result_info_s *legacy_scan_result;
+} bt_adapter_le_new_device_scan_result_info_s;
+
+typedef void (*bt_adapter_le_new_scan_result_cb)(int result,
+ bt_adapter_le_new_device_scan_result_info_s *info, void *user_data);
/**
* @internal
* @since_tizen 3.0
error_code); /* LCOV_EXCL_LINE */
}
}
+/* Uncomment this section once LE extended feature is enabled
+ error_code = bt_adapter_le_set_scan_role(BT_ADAPTER_LE_SCAN_LEGACY_ONLY);
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ return error_code;
+ }
+ */
error_code = _bt_get_error_code(bluetooth_start_le_discovery());
if (error_code != BT_ERROR_NONE) {
return error_code;
}
+int bt_adapter_le_start_scan_new(bt_adapter_le_new_scan_result_cb cb, void *user_data)
+{
+ BT_DBG("### START SCAN NEW");
+ int error_code = BT_ERROR_NONE;
+ GSList *l;
+
+ BT_CHECK_LE_SUPPORT();
+ BT_CHECK_LE_5_0_SUPPORT();
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(cb);
+
+ _bt_le_adapter_init();
+
+ for (l = scan_filter_list; l != NULL; l = l->next) {
+ bluetooth_le_scan_filter_t filter;
+ bt_le_scan_filter_s *__filter = l->data;
+ __bt_adapter_le_convert_scan_filter(&filter, __filter);
+
+ error_code = _bt_get_error_code(bluetooth_register_scan_filter(&filter));
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("Scan filter error %s(0x%08x)",
+ _bt_convert_error_to_string(error_code),
+ error_code); /* LCOV_EXCL_LINE */
+ }
+ }
+ error_code = _bt_get_error_code(bluetooth_start_le_discovery());
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code); /* LCOV_EXCL_LINE */
+ return error_code;
+ }
+ _bt_set_cb(BT_EVENT_LE_NEW_SCAN_RESULT_UPDATED, cb, user_data);
+ return error_code;
+}
+
+int bt_adapter_le_set_scan_phy(bt_adapter_le_phy_e phy)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_LE_SUPPORT();
+ BT_CHECK_LE_5_0_SUPPORT();
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT);
+ BT_CHECK_INIT_STATUS();
+
+ if (phy == BT_LE_2M_PHY)
+ return BT_ERROR_INVALID_PARAMETER;
+
+ error_code = _bt_get_error_code(bluetooth_set_le_scan_phy(phy));
+
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code); /* LCOV_EXCL_LINE */
+ return error_code;
+ }
+ return error_code;
+}
+
+int bt_adapter_le_set_scan_role(bt_adapter_le_scan_role_e role)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_LE_SUPPORT();
+ BT_CHECK_LE_5_0_SUPPORT();
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT);
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_get_error_code(bluetooth_set_le_scan_role(role));
+
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code); /* LCOV_EXCL_LINE */
+ return error_code;
+ }
+ return error_code;
+}
+
int bt_adapter_le_stop_scan(void)
{
int error_code = BT_ERROR_NONE;
}
_bt_unset_cb(BT_EVENT_LE_SCAN_RESULT_UPDATED);
+ _bt_unset_cb(BT_EVENT_LE_NEW_SCAN_RESULT_UPDATED);
+
_bt_le_adapter_deinit();
return error_code;
}
{"tizen.org/feature/network.bluetooth.le", FALSE, FALSE}, /* BT_FEATURE_LE */
{"tizen.org/feature/network.bluetooth.le.5_0", FALSE, FALSE}, /* BT_FEATURE_LE_5_0 */
{"tizen.org/feature/network.bluetooth.le.coc", FALSE, FALSE}, /* BT_FEATURE_LE_COC */
+ {"tizen.org/feature/network.bluetooth.le.adv_ext", FALSE, FALSE}, /* BT_FEATURE_LE_ADV_EXT */
{"tizen.org/feature/network.bluetooth.le.ipsp", FALSE, FALSE}, /* BT_FEATURE_IPSP */
{"tizen.org/feature/network.bluetooth.le.mesh", TRUE, TRUE}, /* BT_FEATURE_MESH */
{"tizen.org/feature/network.bluetooth.audio.call", FALSE, FALSE}, /* BT_FEATURE_AUDIO_CALL */
static void __bt_free_bt_adapter_device_discovery_info_s(bt_adapter_device_discovery_info_s *discovery_info);
static int __bt_get_bt_adapter_le_device_scan_info_s(bt_adapter_le_device_scan_result_info_s **scan_info, bluetooth_le_device_info_t *source_info);
static void __bt_free_bt_adapter_le_device_scan_info_s(bt_adapter_le_device_scan_result_info_s *scan_info);
+static int __bt_get_bt_adapter_le_new_device_scan_info_s(bt_adapter_le_new_device_scan_result_info_s **scan_info, bluetooth_le_device_info_t *source_info);
+static void __bt_free_bt_adapter_le_new_device_scan_info_s(bt_adapter_le_new_device_scan_result_info_s *scan_info);
/* TDS Forward declarations */
static void __bt_free_tds_scan_result_info_s(bt_tds_transport_block_list_s *discovery_info);
static void __bt_le_event_proxy(int event, bluetooth_event_param_t *param, void *user_data)
{
bt_adapter_le_device_scan_result_info_s *scan_info = NULL;
+ bt_adapter_le_new_device_scan_result_info_s *ext_scan_info = NULL;
+
int event_index = -1;
event_index = __bt_get_cb_index(event);
(_bt_get_error_code(param->result), NULL, bt_event_slot_container[event_index].user_data);
}
}
+
+ event_index = BT_EVENT_LE_NEW_SCAN_RESULT_UPDATED;
+ if (bt_event_slot_container[event_index].callback != NULL) {
+ if (__bt_get_bt_adapter_le_new_device_scan_info_s(&ext_scan_info, (bluetooth_le_device_info_t *)(param->param_data)) == BT_ERROR_NONE) {
+ ((bt_adapter_le_new_scan_result_cb)bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), ext_scan_info, bt_event_slot_container[event_index].user_data);
+ } else {
+ ((bt_adapter_le_new_scan_result_cb)bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), NULL, bt_event_slot_container[event_index].user_data);
+ }
+ }
+
/* TDS Provider Search: Uses Scan Info */
if (bt_event_slot_container[BT_EVENT_TDS_PROVIDER_FOUND_RESULT].callback != NULL) {
char *data = NULL;
if (scan_info)
__bt_free_bt_adapter_le_device_scan_info_s(scan_info);
+
+ if (ext_scan_info)
+ __bt_free_bt_adapter_le_new_device_scan_info_s(ext_scan_info);
+
break;
default:
break;
return BT_ERROR_NONE;
}
+static int __bt_get_bt_adapter_le_new_device_scan_info_s(
+ bt_adapter_le_new_device_scan_result_info_s **scan_info,
+ bluetooth_le_device_info_t *source_info)
+{
+ BT_CHECK_INPUT_PARAMETER(source_info);
+
+ *scan_info = (bt_adapter_le_new_device_scan_result_info_s *)malloc(sizeof(bt_adapter_le_new_device_scan_result_info_s));
+ if (*scan_info == NULL)
+ return BT_ERROR_OUT_OF_MEMORY;
+
+ (**scan_info).legacy_scan_result = (bt_adapter_le_device_scan_result_info_s *)malloc(sizeof(bt_adapter_le_device_scan_result_info_s));
+
+ _bt_convert_address_to_string(&((*scan_info)->legacy_scan_result->remote_address), &(source_info->device_address));
+ if (source_info->addr_type == 0x02)
+ (*scan_info)->legacy_scan_result->address_type = BT_DEVICE_RANDOM_ADDRESS;
+ else
+ (*scan_info)->legacy_scan_result->address_type = BT_DEVICE_PUBLIC_ADDRESS; /* LCOV_EXCL_LINE */
+ (*scan_info)->legacy_scan_result->rssi = (int)source_info->rssi;
+ (*scan_info)->event_type = (int)source_info->event_type;
+ (*scan_info)->primary_phy = (int)source_info->primary_phy;
+ (*scan_info)->secondary_phy = (int)source_info->secondary_phy;
+ (*scan_info)->tx_power = (int)source_info->tx_power;
+ (*scan_info)->periodic_adv_int = (int)source_info->periodic_adv_int;
+ (*scan_info)->is_extended = (bool)source_info->is_extended;
+ (*scan_info)->legacy_scan_result->adv_data_len = source_info->adv_ind_data.data_len;
+
+ if ((*scan_info)->legacy_scan_result->adv_data_len > 0) {
+ (*scan_info)->legacy_scan_result->adv_data = malloc(source_info->adv_ind_data.data_len);
+ memcpy((*scan_info)->legacy_scan_result->adv_data, source_info->adv_ind_data.data.data, source_info->adv_ind_data.data_len);
+ } else {
+ (*scan_info)->legacy_scan_result->adv_data = NULL; /* LCOV_EXCL_LINE */
+ }
+
+ (*scan_info)->legacy_scan_result->scan_data_len = source_info->scan_resp_data.data_len;
+ if ((*scan_info)->legacy_scan_result->scan_data_len > 0) {
+ (*scan_info)->legacy_scan_result->scan_data = malloc(source_info->scan_resp_data.data_len); /* LCOV_EXCL_LINE */
+ memcpy((*scan_info)->legacy_scan_result->scan_data, source_info->scan_resp_data.data.data, source_info->scan_resp_data.data_len); /* LCOV_EXCL_LINE */
+ } else {
+ (*scan_info)->legacy_scan_result->scan_data = NULL;
+ }
+
+ return BT_ERROR_NONE;
+}
+
+static void __bt_free_bt_adapter_le_new_device_scan_info_s(bt_adapter_le_new_device_scan_result_info_s *scan_info)
+{
+ if (scan_info == NULL)
+ return;
+
+ if (scan_info->legacy_scan_result->remote_address != NULL)
+ free(scan_info->legacy_scan_result->remote_address);
+
+ if (scan_info->legacy_scan_result->adv_data != NULL)
+ free(scan_info->legacy_scan_result->adv_data);
+ if (scan_info->legacy_scan_result->scan_data != NULL)
+ free(scan_info->legacy_scan_result->scan_data);
+
+ free(scan_info);
+ scan_info = NULL;
+}
static void __bt_free_bt_adapter_le_device_scan_info_s(bt_adapter_le_device_scan_result_info_s *scan_info)
{
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_CUSTOMIZED},
{"bt_adapter_le_start_scan"
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_SCAN},
+ {"bt_adapter_le_start_scan_new"
+ , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_SCAN_NEW},
+ {"bt_adapter_le_set_scan_phy"
+ , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_PHY},
+ {"bt_adapter_le_set_scan_role"
+ , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_ROLE},
{"bt_adapter_le_stop_scan"
, BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_SCAN},
{"bt_adapter_le_is_discovering"
return g_strcmp0(info->remote_address, address);
}
+static void __bt_adapter_le_new_scan_result_cb(
+ int result, bt_adapter_le_new_device_scan_result_info_s *info,
+ void *user_data)
+{
+ int i;
+ bt_adapter_le_packet_type_e pkt_type = BT_ADAPTER_LE_PACKET_ADVERTISING;
+ bt_adapter_le_device_scan_result_info_s *adv_info;
+
+ if (info == NULL) {
+ TC_PRT("No discovery_info!");
+ return;
+ }
+
+ TC_PRT("New Scan Result");
+ TC_PRT("%s Adv %d Scan resp %d RSSI %d Addr_type %d", info->legacy_scan_result->remote_address,
+ info->legacy_scan_result->adv_data_len, info->legacy_scan_result->scan_data_len,
+ info->legacy_scan_result->rssi,info->legacy_scan_result->address_type);
+ TC_PRT("Primary_phy %d Secondary_phy %d, Advertising_sid %d, periodic_adv_int %d, Is_extended %d",
+ info->primary_phy, info->secondary_phy,
+ info->advertising_sid, info->periodic_adv_int, info->is_extended);
+
+ GSList *l = NULL;
+ l = g_slist_find_custom(le_scan_list, info->legacy_scan_result->remote_address,
+ (GCompareFunc)__bt_compare_address);
+ if (l == NULL) {
+ adv_info = g_malloc0(sizeof(bt_adapter_le_device_scan_result_info_s));
+ adv_info->remote_address= g_strdup(info->legacy_scan_result->remote_address);
+ adv_info->rssi = info->legacy_scan_result->rssi;
+ le_scan_list = g_slist_append(le_scan_list, adv_info);
+ } else {
+ adv_info = l->data;
+ adv_info->rssi = info->legacy_scan_result->rssi;
+ }
+
+ for (i = 0; i < 2; i++) {
+ char **uuids;
+ char *device_name;
+ int tx_power_level;
+ bt_adapter_le_service_data_s *data_list;
+ int appearance;
+ int manufacturer_id;
+ char *manufacturer_data;
+ int manufacturer_data_len;
+ int count;
+ bt_adapter_le_ibeacon_scan_result_info_s *ibeacon_info = NULL;
+
+ pkt_type += i;
+ if (pkt_type == BT_ADAPTER_LE_PACKET_ADVERTISING
+ && info->legacy_scan_result->adv_data == NULL) continue;
+ if (pkt_type == BT_ADAPTER_LE_PACKET_SCAN_RESPONSE
+ && info->legacy_scan_result->scan_data == NULL) break;
+
+ if (bt_adapter_le_get_scan_result_service_uuids(
+ info->legacy_scan_result, pkt_type, &uuids, &count) == BT_ERROR_NONE) {
+ int i;
+ for (i = 0; i < count; i++) {
+ TC_PRT("UUID[%d] = %s", i + 1, uuids[i]);
+ g_free(uuids[i]);
+ }
+ g_free(uuids);
+ }
+ if (bt_adapter_le_get_scan_result_device_name(
+ info->legacy_scan_result, pkt_type, &device_name) == BT_ERROR_NONE) {
+ TC_PRT("Device name = %s", device_name);
+ if (adv_info->adv_data == NULL)
+ adv_info->adv_data= g_strdup(device_name);
+ g_free(device_name);
+ }
+ if (bt_adapter_le_get_scan_result_tx_power_level(
+ info->legacy_scan_result, pkt_type, &tx_power_level) == BT_ERROR_NONE) {
+ TC_PRT("TX Power level = %d", tx_power_level);
+ }
+ if (bt_adapter_le_get_scan_result_service_solicitation_uuids(
+ info->legacy_scan_result, pkt_type, &uuids, &count) == BT_ERROR_NONE) {
+ int i;
+ for (i = 0; i < count; i++) {
+ TC_PRT("Solicitation UUID[%d] = %s", i + 1, uuids[i]);
+ g_free(uuids[i]);
+ }
+ g_free(uuids);
+ }
+ if (bt_adapter_le_get_scan_result_service_data_list(
+ info->legacy_scan_result, pkt_type, &data_list, &count) == BT_ERROR_NONE) {
+ int i;
+ for (i = 0; i < count; i++)
+ TC_PRT("Service Data[%d] = [0x%2.2X%2.2X:0x%.2X...]",
+ i + 1, data_list[i].service_uuid[0],
+ data_list[i].service_uuid[1],
+ data_list[i].service_data[0]);
+ bt_adapter_le_free_service_data_list(data_list, count);
+ }
+ if (bt_adapter_le_get_scan_result_appearance(
+ info->legacy_scan_result, pkt_type, &appearance) == BT_ERROR_NONE) {
+ TC_PRT("Appearance = %d", appearance);
+ }
+ if (bt_adapter_le_get_scan_result_manufacturer_data(
+ info->legacy_scan_result, pkt_type, &manufacturer_id, &manufacturer_data,
+ &manufacturer_data_len) == BT_ERROR_NONE) {
+
+ if (manufacturer_data_len > 1) {
+ TC_PRT("Manufacturer data[ID:%.4X, 0x%.2X%.2X...(len:%d)]",
+ manufacturer_id, manufacturer_data[0],
+ manufacturer_data[1], manufacturer_data_len);
+ } else {
+ TC_PRT("Manufacturer data[ID:%.4X, len:%d]", manufacturer_id, manufacturer_data_len);
+ }
+
+ g_free(manufacturer_data);
+ }
+ if (bt_adapter_le_get_scan_result_ibeacon_report(info->legacy_scan_result, pkt_type,
+ &ibeacon_info) == BT_ERROR_NONE) {
+ TC_PRT("APPLE IBEACON");
+ TC_PRT("Company_id: %d", ibeacon_info->company_id);
+ TC_PRT("ibeacon_type: %d", ibeacon_info->ibeacon_type);
+ TC_PRT("uuid: %s", ibeacon_info->uuid);
+ TC_PRT("major_id: %d", ibeacon_info->major_id);
+ TC_PRT("minor_id: %d", ibeacon_info->minor_id);
+ TC_PRT("measured_power: %d", ibeacon_info->measured_power);
+ bt_adapter_le_free_ibeacon_report(ibeacon_info);
+ }
+ }
+}
+
static void __bt_adapter_le_scan_result_cb(
int result, bt_adapter_le_device_scan_result_info_s *info,
void *user_data)
param_count = 1;
TC_PRT("Scan mode\n (0 : Balanced (5000/2000 ms), 1: Low Latency (5000/5000 ms), 2 : Low Energy (5000/500 ms)");
break;
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_PHY:
+ param_count = 1;
+ TC_PRT("Scanning phy\n (0 : All PHY, 1 : 1M PHY, 3 : 1M CODED)");
+ break;
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_ROLE:
+ param_count = 1;
+ TC_PRT("Scanning role \n (0 : Complete scanning, 1 : Legacy only, 2 : Extended only)");
+ break;
case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_TYPE:
param_count = 1;
TC_PRT("Scan type\n (0 : Passive, 1: Active)");
TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
}
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_SCAN_NEW: {
+ ret = bt_adapter_le_start_scan_new(
+ __bt_adapter_le_new_scan_result_cb, NULL);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_PHY: {
+ int phy = BT_LE_ALL_PHY;
+
+ if (g_test_param.param_count > 0) {
+ phy = atoi(g_test_param.params[0]);
+ __bt_free_test_param(&g_test_param);
+ }
+
+ ret = bt_adapter_le_set_scan_phy(phy);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_ROLE: {
+ int role = BT_ADAPTER_LE_SCAN_ALL;
+
+ if (g_test_param.param_count > 0) {
+ role = atoi(g_test_param.params[0]);
+ __bt_free_test_param(&g_test_param);
+ }
+
+ ret = bt_adapter_le_set_scan_role(role);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_SCAN: {
ret = bt_adapter_le_stop_scan();
TC_PRT("returns %s\n", __bt_get_error_message(ret));
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_TYPE,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_CUSTOMIZED,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_SCAN,
+ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_START_SCAN_NEW,
+ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_PHY,
+ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_ROLE,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_SCAN,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_IS_DISCOVERING,
BT_UNIT_TEST_FUNCTION_ADAPTER_LE_ADD_ADVERTISING_DATA,