From 24c3cc1baefd3122b69ffdbb1e818ab5c2f1dc92 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Fri, 25 Aug 2023 14:16:17 +0900 Subject: [PATCH] [ACR-1787] Add extended advertising and scan APIs to public Change-Id: Ib4abe4f9012db5cb10c414fb3b148b3178b5710e Signed-off-by: Wootak Jung --- doc/bluetooth_doc.h | 26 +++ include/bluetooth.h | 323 ++++++++++++++++++++++++++++++ include/bluetooth_internal.h | 195 ------------------ include/bluetooth_private.h | 18 ++ include/bluetooth_type.h | 43 ++++ include/bluetooth_type_internal.h | 36 ---- src/bluetooth-adapter.c | 100 ++++++++- src/bluetooth-common.c | 3 +- tests/test/bt_unit_test.c | 54 +++-- 9 files changed, 542 insertions(+), 256 deletions(-) diff --git a/doc/bluetooth_doc.h b/doc/bluetooth_doc.h index 30d039c..6fb6e6f 100644 --- a/doc/bluetooth_doc.h +++ b/doc/bluetooth_doc.h @@ -208,6 +208,32 @@ * */ +/** + * @defgroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE Bluetooth LE Adapter for Bluetooth Extended Advertising + * @brief Bluetooth LE API provides functions for bluetooth extended advertising functionality such as setting Primary and Secondary Phy + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * + * @section CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE_OVERVIEW Overview + * Bluetooth LE API provides functions for bluetooth extended advertising functionality such as setting Primary and Secondary Phy + * + * @section CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - %http://tizen.org/feature/network.bluetooth\n + * - %http://tizen.org/feature/network.bluetooth.le\n + * - %http://tizen.org/feature/network.bluetooth.le.5_0\n + * - %http://tizen.org/feature/network.bluetooth.le.adv_ext\n + * It is recommended to design applications with regard to features, for reliability.\n + * + * You can check if the device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly.\n + * + * To ensure your application is only running on devices with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from feature element description. + * + */ /** * @defgroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE Bluetooth Device diff --git a/include/bluetooth.h b/include/bluetooth.h index ba5cec2..f60e51a 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -6472,6 +6472,329 @@ int bt_socket_accept_l2cap_channel(int requested_socket_fd); */ int bt_socket_reject_l2cap_channel(int socket_fd); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_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_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @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 + * + * @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_ADV_EXT_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_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @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_ADV_EXT_MODULE + * @brief Sets Bluetooth LE scan phy. + * @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_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @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); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Sets Bluetooth LE advertising legacy mode. + * @since_tizen 8.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * @param[in] advertiser The handle of advertiser + * @param[in] is_legacy Advertisement is extended or legacy + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @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_advertising_legacy_mode(bt_advertiser_h advertiser, bool is_legacy); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Sets Bluetooth LE advertising primary phy. + * @since_tizen 8.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * @param[in] advertiser The handle of advertiser + * @param[in] primary_phy Primary phy of advertiser. Valid values are #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_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @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_advertising_primary_phy(bt_advertiser_h advertiser, + bt_adapter_le_phy_e primary_phy); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Sets Bluetooth LE advertising secondary phy. + * @since_tizen 8.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * @param[in] advertiser The handle of advertiser + * @param[in] secondary_phy Secondary phy of advertiser, Valid values are #BT_LE_1M_PHY, + * #BT_LE_2M_PHY, #BT_LE_CODED_PHY. + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @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_advertising_secondary_phy(bt_advertiser_h advertiser, + bt_adapter_le_phy_e secondary_phy); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Checks if LE Extended Advertising feature is supported or not. + * @since_tizen 8.0 + * + * @remarks The LE Extended Advertising feature was introduced in the BT 5.0 core specification. + * + * @param[out] is_supported The LE Extended Advertising feature support: (@c true = supported , @c false = not supported) + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. + */ +int bt_adapter_le_is_extended_advertising_supported(bool *is_supported); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Checks if LE Extended Scan feature is supported or not. + * @since_tizen 8.0 + * + * @remarks The LE Extended Scan feature was introduced in the BT 5.0 core specification. + * + * @param[out] is_supported The LE Extended Scan feature support: (@c true = supported , @c false = not supported) + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. + */ +int bt_adapter_le_is_extended_scan_supported(bool *is_supported); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets maximum advertisement data length supported by controller. + * @since_tizen 8.0 + * + * @remarks The LE Maximum Advertising Data Length feature was introduced in the BT 5.0 core specification. + * + * @param[out] data_length The maximum length supported by controller for use as advertisement data or scan response data + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. + */ +int bt_adapter_le_get_maximum_advertising_data_length(int *data_length); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets the primary phy data from the extended scan result. + * @since_tizen 8.0 + * + * @param[in] handle The extended scan result handle + * @param[out] primary_phy The primary PHY + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_primary_phy(bt_new_scan_result_h handle, int *primary_phy); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets the secondary phy data from the extended scan result. + * @since_tizen 8.0 + * + * @param[in] handle The extended scan result handle + * @param[out] secondary_phy The secondary PHY + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_secondary_phy(bt_new_scan_result_h handle, int *secondary_phy); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets the advertising sid data from the extended scan result. + * @since_tizen 8.0 + * + * @param[in] handle The extended scan result handle + * @param[out] advertising_sid The advertising sid + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_advertising_sid(bt_new_scan_result_h handle, int *advertising_sid); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets the periodic advertising interval data from the extended scan result. + * @since_tizen 8.0 + * + * @param[in] handle The extended scan result handle + * @param[out] periodic_adv_int The periodic advertising interval + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_periodic_adv_int(bt_new_scan_result_h handle, int *periodic_adv_int); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Checks if the scan result is extended or not. + * @since_tizen 8.0 + * + * @param[in] handle The extended scan result handle + * @param[out] is_extended The whether to extended + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_is_extended(bt_new_scan_result_h handle, bool *is_extended); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Gets the legacy scan result information from the extended scan result. + * @since_tizen 8.0 + * + * @remarks The @a legacy_info should not be released. + * @remarks The @a legacy_info is available until the callback has been called. + * + * @param[in] handle The extended scan result handle + * @param[out] legacy_info The legacy scan result information + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * + * @see bt_adapter_le_start_scan_new() + * @see bt_adapter_le_new_scan_result_cb() + */ +int bt_adapter_le_get_new_scan_result_legacy_info(bt_new_scan_result_h handle, + bt_adapter_le_device_scan_result_info_s **legacy_info); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/bluetooth_internal.h b/include/bluetooth_internal.h index bf3c94e..c04e89e 100644 --- a/include/bluetooth_internal.h +++ b/include/bluetooth_internal.h @@ -670,138 +670,6 @@ int bt_adapter_set_manufacturer_data(char *data, int len); */ 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); - -/** - * @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] isLegacy Advertisement is extended or legacy - * - * @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_advertising_legacy_mode(bt_advertiser_h advertiser, bool isLegacy); - -/** - * @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] primary_phy Primary phy of advertiser. Valid values are 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_advertising_primary_phy(bt_advertiser_h advertiser, - bt_adapter_le_phy_e primary_phy); - -/** - * @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] secondary_phy Secondary phy of advertiser, Valid values are BT_LE_1M_PHY, - * BT_LE_2M_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_advertising_secondary_phy(bt_advertiser_h advertiser, - bt_adapter_le_phy_e secondary_phy); - /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE @@ -1330,69 +1198,6 @@ int bt_adapter_le_set_advertising_transport_discovery_data(bt_advertiser_h adver bt_tds_transport_e org_id, char tds_flags, unsigned char *transport_data, unsigned int transport_data_len); -/** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_50_MODULE - * @brief Checks if LE Extended Advertising feature is supported or not. - * @since_tizen 8.0 - * - * @remarks The LE Extended Advertising feature was introduced in the BT 5.0 core specification. - * - * @param[out] is_supported The LE Extended Advertising feature support: (@c true = supported , @c false = not supported) - * - * @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 Adapter is not enabled - * @retval #BT_ERROR_OPERATION_FAILED Operation failed - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. - */ -int bt_adapter_le_is_extended_advertising_supported(bool *is_supported); - -/** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_50_MODULE - * @brief Checks if LE Extended Scan feature is supported or not. - * @since_tizen 8.0 - * - * @remarks The LE Extended Scan feature was introduced in the BT 5.0 core specification. - * - * @param[out] is_supported The LE Extended Scan feature support: (@c true = supported , @c false = not supported) - * - * @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 Adapter is not enabled - * @retval #BT_ERROR_OPERATION_FAILED Operation failed - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. - */ -int bt_adapter_le_is_extended_scan_supported(bool *is_supported); - -/** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_50_MODULE - * @brief Maximum advertisement data length supported by controller - * @since_tizen 8.0 - * - * @remarks The LE Maximum Advertising Data Length feature was introduced in the BT 5.0 core specification. - * - * @param[out] data_length The maximum length supported by controller for use as advertisement data or scan response data - * - * @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 Adapter is not enabled - * @retval #BT_ERROR_OPERATION_FAILED Operation failed - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED. - */ -int bt_adapter_le_get_maximum_advertising_data_length(int *data_length); - /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 9c6fb52..2b60ad1 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -1308,6 +1308,24 @@ bt_mesh_group_s * _bt_mesh_get_group_from_sub( */ typedef void (*bt_ag_battery_level_changed_cb) (const char *remote_address, unsigned int level, void *user_data); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Structure of le scan result information containing extended and legacy scan. + * @since_tizen 8.0 + * + * @see bt_adapter_le_new_scan_result_cb() + */ +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 enum { _PROFILE_UNKNOWN = 0, _PROFILE_MOBILE = 0x1, diff --git a/include/bluetooth_type.h b/include/bluetooth_type.h index c896fca..2616477 100644 --- a/include/bluetooth_type.h +++ b/include/bluetooth_type.h @@ -2203,6 +2203,49 @@ typedef struct { typedef void (*bt_socket_l2cap_channel_connection_state_changed_cb) (int result, bt_socket_connection_state_e connection_state, bt_socket_l2cap_le_connection_s *connection, void *user_data); +/** +* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE +* @brief Enumerations of the Bluetooth LE scan role. +* @since_tizen 8.0 +*/ +typedef enum { + BT_ADAPTER_LE_SCAN_ALL = 0x00, /**< Scan all */ + BT_ADAPTER_LE_SCAN_LEGACY_ONLY, /**< Legacy scan only */ + BT_ADAPTER_LE_SCAN_EXTENDED_ONLY /**< Extended scan only */ +} bt_adapter_le_scan_role_e; + +/** +* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE +* @brief Enumerations of the Bluetooth LE phy. +* @since_tizen 8.0 +*/ +typedef enum { + BT_LE_ALL_PHY = 0x00, /**< All phy */ + BT_LE_1M_PHY = 0x01, /**< 1M phy */ + BT_LE_2M_PHY = 0x02, /**< 2M phy */ + BT_LE_CODED_PHY = 0x03 /**< Coded phy */ +} bt_adapter_le_phy_e; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief The handle of a new scan result. + * @since_tizen 8.0 + */ +typedef void *bt_new_scan_result_h; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_ADV_EXT_MODULE + * @brief Called when the LE advertisement has been found. + * @since_tizen 8.0 + * + * @param[in] result The result of the LE scan + * @param[in] handle The handle of a new scan result + * @param[in] user_data The user data passed from the start function + * + * @see bt_adapter_le_start_scan_new() + */ +typedef void (*bt_adapter_le_new_scan_result_cb)(int result, bt_new_scan_result_h handle, void *user_data); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/bluetooth_type_internal.h b/include/bluetooth_type_internal.h index 765770f..86753d0 100644 --- a/include/bluetooth_type_internal.h +++ b/include/bluetooth_type_internal.h @@ -383,29 +383,6 @@ typedef enum { 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_LE_MODULE * @since_tizen 8.0 @@ -1096,19 +1073,6 @@ typedef void (*bt_tds_provider_scan_result_cb)(int result, const char *remote_ad 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 diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index 2311bc2..4ed21aa 100644 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -1941,7 +1941,7 @@ static int bt_adapter_le_add_advertising_data(bt_advertiser_h advertiser, return BT_ERROR_NONE; } -int bt_adapter_le_set_advertising_legacy_mode(bt_advertiser_h advertiser, bool isLegacy) +int bt_adapter_le_set_advertising_legacy_mode(bt_advertiser_h advertiser, bool is_legacy) { int error_code; bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser; @@ -1959,8 +1959,8 @@ int bt_adapter_le_set_advertising_legacy_mode(bt_advertiser_h advertiser, bool i return BT_ERROR_PERMISSION_DENIED; } - BT_DBG("Setting legacy mode %d", isLegacy); - __adv->adv_params.is_legacy = isLegacy; + BT_DBG("Setting legacy mode %d", is_legacy); + __adv->adv_params.is_legacy = is_legacy; return BT_ERROR_NONE; } @@ -3447,6 +3447,97 @@ int bt_adapter_le_set_scan_role(bt_adapter_le_scan_role_e role) return error_code; } +int bt_adapter_le_get_new_scan_result_primary_phy(bt_new_scan_result_h handle, int *primary_phy) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(primary_phy); + + *primary_phy = info->primary_phy; + return BT_ERROR_NONE; +} + +int bt_adapter_le_get_new_scan_result_secondary_phy(bt_new_scan_result_h handle, int *secondary_phy) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(secondary_phy); + + *secondary_phy = info->secondary_phy; + return BT_ERROR_NONE; +} + +int bt_adapter_le_get_new_scan_result_advertising_sid(bt_new_scan_result_h handle, int *advertising_sid) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(advertising_sid); + + *advertising_sid = info->advertising_sid; + return BT_ERROR_NONE; +} + +int bt_adapter_le_get_new_scan_result_periodic_adv_int(bt_new_scan_result_h handle, int *periodic_adv_int) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(periodic_adv_int); + + *periodic_adv_int = info->periodic_adv_int; + return BT_ERROR_NONE; +} + +int bt_adapter_le_get_new_scan_result_is_extended(bt_new_scan_result_h handle, bool *is_extended) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(is_extended); + + *is_extended = info->is_extended; + return BT_ERROR_NONE; +} + +int bt_adapter_le_get_new_scan_result_legacy_info(bt_new_scan_result_h handle, + bt_adapter_le_device_scan_result_info_s **legacy_info) +{ + bt_adapter_le_new_device_scan_result_info_s *info = handle; + + 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(handle); + BT_CHECK_INPUT_PARAMETER(legacy_info); + + *legacy_info = info->legacy_scan_result; + return BT_ERROR_NONE; +} + int bt_adapter_le_stop_scan(void) { int error_code = BT_ERROR_NONE; @@ -4797,6 +4888,7 @@ int bt_adapter_le_is_extended_advertising_supported(bool *is_supported) gboolean support = FALSE; BT_CHECK_LE_5_0_SUPPORT(); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(is_supported); @@ -4820,6 +4912,7 @@ int bt_adapter_le_is_extended_scan_supported(bool *is_supported) gboolean support = FALSE; BT_CHECK_LE_5_0_SUPPORT(); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(is_supported); @@ -4843,6 +4936,7 @@ int bt_adapter_le_get_maximum_advertising_data_length(int *data_length) gint max_data_len = 0; BT_CHECK_LE_5_0_SUPPORT(); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE_ADV_EXT); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(data_length); diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index de2fcb6..223dbbd 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -4632,8 +4632,9 @@ static void __bt_le_event_proxy(int event, bluetooth_event_param_t *param, void 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_new_scan_result_h handle = ext_scan_info; ((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); + (_bt_get_error_code(param->result), handle, 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); diff --git a/tests/test/bt_unit_test.c b/tests/test/bt_unit_test.c index ef3f61a..730043e 100644 --- a/tests/test/bt_unit_test.c +++ b/tests/test/bt_unit_test.c @@ -1783,37 +1783,49 @@ gint __bt_compare_address(gpointer *a, gpointer *b) } static void __bt_adapter_le_new_scan_result_cb( - int result, bt_adapter_le_new_device_scan_result_info_s *info, + int result, bt_new_scan_result_h handle, 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 *legacy_info; bt_adapter_le_device_scan_result_info_s *adv_info; + int primary_phy; + int secondary_phy; + int advertising_sid; + int periodic_adv_int; + bool is_extended; - if (info == NULL) { + if (handle == NULL) { TC_PRT("No discovery_info!"); return; } + bt_adapter_le_get_new_scan_result_primary_phy(handle, &primary_phy); + bt_adapter_le_get_new_scan_result_secondary_phy(handle, &secondary_phy); + bt_adapter_le_get_new_scan_result_advertising_sid(handle, &advertising_sid); + bt_adapter_le_get_new_scan_result_periodic_adv_int(handle, &periodic_adv_int); + bt_adapter_le_get_new_scan_result_is_extended(handle, &is_extended); + bt_adapter_le_get_new_scan_result_legacy_info(handle, &legacy_info); + 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("%s Adv %d Scan resp %d RSSI %d Addr_type %d", legacy_info->remote_address, + legacy_info->adv_data_len, legacy_info->scan_data_len, + legacy_info->rssi, legacy_info->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); + primary_phy, secondary_phy, advertising_sid, periodic_adv_int, is_extended); GSList *l = NULL; - l = g_slist_find_custom(le_scan_list, info->legacy_scan_result->remote_address, + l = g_slist_find_custom(le_scan_list, legacy_info->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; + adv_info->remote_address= g_strdup(legacy_info->remote_address); + adv_info->rssi = legacy_info->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; + adv_info->rssi = legacy_info->rssi; } for (i = 0; i < 2; i++) { @@ -1830,12 +1842,12 @@ static void __bt_adapter_le_new_scan_result_cb( pkt_type += i; if (pkt_type == BT_ADAPTER_LE_PACKET_ADVERTISING - && info->legacy_scan_result->adv_data == NULL) continue; + && legacy_info->adv_data == NULL) continue; if (pkt_type == BT_ADAPTER_LE_PACKET_SCAN_RESPONSE - && info->legacy_scan_result->scan_data == NULL) break; + && legacy_info->scan_data == NULL) break; if (bt_adapter_le_get_scan_result_service_uuids( - info->legacy_scan_result, pkt_type, &uuids, &count) == BT_ERROR_NONE) { + legacy_info, pkt_type, &uuids, &count) == BT_ERROR_NONE) { int i; for (i = 0; i < count; i++) { TC_PRT("UUID[%d] = %s", i + 1, uuids[i]); @@ -1844,18 +1856,18 @@ static void __bt_adapter_le_new_scan_result_cb( g_free(uuids); } if (bt_adapter_le_get_scan_result_device_name( - info->legacy_scan_result, pkt_type, &device_name) == BT_ERROR_NONE) { + legacy_info, 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) { + legacy_info, 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) { + legacy_info, 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]); @@ -1864,7 +1876,7 @@ static void __bt_adapter_le_new_scan_result_cb( 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) { + legacy_info, 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...]", @@ -1874,11 +1886,11 @@ static void __bt_adapter_le_new_scan_result_cb( 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) { + legacy_info, 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, + legacy_info, pkt_type, &manufacturer_id, &manufacturer_data, &manufacturer_data_len) == BT_ERROR_NONE) { if (manufacturer_data_len > 1) { @@ -1891,7 +1903,7 @@ static void __bt_adapter_le_new_scan_result_cb( g_free(manufacturer_data); } - if (bt_adapter_le_get_scan_result_ibeacon_report(info->legacy_scan_result, pkt_type, + if (bt_adapter_le_get_scan_result_ibeacon_report(legacy_info, pkt_type, &ibeacon_info) == BT_ERROR_NONE) { TC_PRT("APPLE IBEACON"); TC_PRT("Company_id: %d", ibeacon_info->company_id); -- 2.34.1