From b552733ab09f95f81a83b93353761b779f44c524 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Wed, 1 Feb 2023 14:50:11 +0900 Subject: [PATCH] Add support for custom advertising flags. It is required to set proper advertising flags when establishing a connection using Bluetooth low energy to properly recognize device type. Without this, the Linux device cannot recognize the Tizen device properly and establish a connection. Change-Id: I4ac31464007f67711ea05a6227a7a46c33b6c8ef Signed-off-by: Jakub Latusek Signed-off-by: Wootak Jung --- include/bluetooth_internal.h | 24 ++++++++++++++++++++++++ include/bluetooth_private.h | 1 + include/bluetooth_type_internal.h | 13 +++++++++++++ src/bluetooth-adapter.c | 25 +++++++++++++++++++++++++ tests/test/bt_unit_test.c | 7 ++++++- 5 files changed, 69 insertions(+), 1 deletion(-) diff --git a/include/bluetooth_internal.h b/include/bluetooth_internal.h index b0f41a9..b909da9 100644 --- a/include/bluetooth_internal.h +++ b/include/bluetooth_internal.h @@ -1198,6 +1198,30 @@ 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_MODULE + * @brief Adds advertising flags. + * @since_tizen 8.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * + * @param[in] advertiser The handle of advertiser + * @param[in] flags The advertising flags + * + * @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_PERMISSION_DENIED Permission denied + * + * @pre The Bluetooth service must be initialized with bt_initialize(). + * + * @see bt_adapter_le_advertising_flags_e + * @see bt_adapter_le_create_advertiser() + * @see bt_adapter_le_start_advertising_new() + */ +int bt_adapter_le_set_advertising_flags(bt_advertiser_h advertiser, unsigned char flags); + /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 04b358b..406055e 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -206,6 +206,7 @@ typedef enum { * @internal */ typedef enum { + BT_ADAPTER_LE_ADVERTISING_DATA_FLAGS = 0x01, /**< Flags */ BT_ADAPTER_LE_ADVERTISING_DATA_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02, /**