From 71d08e38dbac81d0f622a23549ae6c8b6a2371f5 Mon Sep 17 00:00:00 2001 From: Ilia Lutchenko Date: Mon, 24 Jul 2023 16:20:50 +0200 Subject: [PATCH] feat(bt/bluedroid): Add new APIs for 32 and 128-bit UUIDs 1. Added new API functions that can add 32 and 128-bit UUID to the EIR data when these UUIDs are set in SDP. The old functions that only work with 16-bit UUIDs have been left unchanged to avoid having to redo code that already utilizes them. 2. Fixed bug with zero handler return in btc_sdp.c sdp_create_record.handle in tBTA_SDP struct wasn't saved before. Because of it Bluetooth stack always returned zero handler to application callback. Closes https://github.com/espressif/esp-idf/issues/11529 --- .../bt/host/bluedroid/bta/dm/bta_dm_act.c | 39 +++-- .../bluedroid/bta/dm/include/bta_dm_int.h | 2 +- .../host/bluedroid/bta/include/bta/bta_sys.h | 12 +- .../bt/host/bluedroid/bta/sys/bta_sys_conn.c | 98 +++++++++++- .../bluedroid/btc/profile/std/sdp/btc_sdp.c | 93 ++++++++++-- .../bt/host/bluedroid/stack/btm/btm_inq.c | 142 +++++++++++++++++- .../bluedroid/stack/include/stack/btm_api.h | 44 ++++++ 7 files changed, 397 insertions(+), 33 deletions(-) diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 165261e699..5312c46d27 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -4218,7 +4218,7 @@ static void bta_dm_set_eir (char *local_name) for (custom_uuid_idx = 0; custom_uuid_idx < BTA_EIR_SERVER_NUM_CUSTOM_UUID; custom_uuid_idx++) { if (bta_dm_cb.custom_uuid[custom_uuid_idx].len == LEN_UUID_128) { if ( num_uuid < max_num_uuid ) { - ARRAY16_TO_STREAM(p, bta_dm_cb.custom_uuid[custom_uuid_idx].uu.uuid128); + ARRAY_TO_STREAM(p, bta_dm_cb.custom_uuid[custom_uuid_idx].uu.uuid128, LEN_UUID_128); num_uuid++; } else { data_type = BTM_EIR_MORE_128BITS_UUID_TYPE; @@ -4415,21 +4415,38 @@ static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result, ** Returns None ** *******************************************************************************/ -void bta_dm_eir_update_uuid(UINT16 uuid16, BOOLEAN adding) +void bta_dm_eir_update_uuid(tBT_UUID uuid, BOOLEAN adding) { - /* if this UUID is not advertised in EIR */ - if ( !BTM_HasEirService( p_bta_dm_eir_cfg->uuid_mask, uuid16 )) { - return; - } + /* 32 and 128-bit UUIDs go to the bta_dm_cb.custom_uuid array */ + if ((uuid.len == LEN_UUID_32) || (uuid.len == LEN_UUID_128)) { + if (adding) { + if (BTM_HasCustomEirService(bta_dm_cb.custom_uuid, uuid)) { + APPL_TRACE_EVENT("UUID is already added for EIR"); + return; + } + APPL_TRACE_EVENT("Adding %d-bit UUID into EIR", uuid.len * 8); - if ( adding ) { - APPL_TRACE_EVENT("Adding UUID=0x%04X into EIR", uuid16); + BTM_AddCustomEirService(bta_dm_cb.custom_uuid, uuid); + } else { + APPL_TRACE_EVENT("Removing %d-bit UUID from EIR", uuid.len * 8); - BTM_AddEirService( bta_dm_cb.eir_uuid, uuid16 ); + BTM_RemoveCustomEirService(bta_dm_cb.custom_uuid, uuid); + } } else { - APPL_TRACE_EVENT("Removing UUID=0x%04X from EIR", uuid16); + /* if this UUID is not advertised in EIR */ + if (!BTM_HasEirService(p_bta_dm_eir_cfg->uuid_mask, uuid.uu.uuid16)) { + return; + } - BTM_RemoveEirService( bta_dm_cb.eir_uuid, uuid16 ); + if (adding) { + APPL_TRACE_EVENT("Adding UUID=0x%04X into EIR", uuid.uu.uuid16); + + BTM_AddEirService(bta_dm_cb.eir_uuid, uuid.uu.uuid16); + } else { + APPL_TRACE_EVENT("Removing UUID=0x%04X from EIR", uuid.uu.uuid16); + + BTM_RemoveEirService(bta_dm_cb.eir_uuid, uuid.uu.uuid16); + } } #if CLASSIC_BT_INCLUDED bta_dm_set_eir (NULL); diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index dcb9453693..0edf63559d 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -1717,7 +1717,7 @@ extern void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data); extern void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data); extern void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data); extern tBTA_DM_PEER_DEVICE *bta_dm_find_peer_device(BD_ADDR peer_addr); -void bta_dm_eir_update_uuid(UINT16 uuid16, BOOLEAN adding); +void bta_dm_eir_update_uuid(tBT_UUID uuid, BOOLEAN adding); extern void bta_dm_enable_test_mode(tBTA_DM_MSG *p_data); extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data); diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_sys.h b/components/bt/host/bluedroid/bta/include/bta/bta_sys.h index 87359b5a9f..54376de635 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_sys.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_sys.h @@ -143,7 +143,7 @@ typedef void (tBTA_SYS_SSR_CFG_CBACK)(UINT8 id, UINT8 app_id, UINT16 latency, UI #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /* eir callback for adding/removeing UUID */ -typedef void (tBTA_SYS_EIR_CBACK)(UINT16 uuid16, BOOLEAN adding); +typedef void (tBTA_SYS_EIR_CBACK)(tBT_UUID uuid, BOOLEAN adding); #endif /* registration structure */ @@ -263,12 +263,20 @@ extern void bta_sys_notify_collision (BD_ADDR_PTR p_bda); #if (BTA_EIR_CANNED_UUID_LIST != TRUE) extern void bta_sys_eir_register(tBTA_SYS_EIR_CBACK *p_cback); -extern void bta_sys_add_uuid(UINT16 uuid16); +extern void bta_sys_add_uuid(UINT16 uuid); +extern void bta_sys_add_uuid_32(UINT32 uuid32); +extern void bta_sys_add_uuid_128(UINT8 *uuid128); extern void bta_sys_remove_uuid(UINT16 uuid16); +extern void bta_sys_remove_uuid_32(UINT32 uuid32); +extern void bta_sys_remove_uuid_128(UINT8 *uuid128); #else #define bta_sys_eir_register(ut) #define bta_sys_add_uuid(ut) +#define bta_sys_add_uuid_32(ut) +#define bta_sys_add_uuid_128(ut) #define bta_sys_remove_uuid(ut) +#define bta_sys_remove_uuid_32(ut) +#define bta_sys_remove_uuid_128(ut) #endif extern void bta_sys_set_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr); diff --git a/components/bt/host/bluedroid/bta/sys/bta_sys_conn.c b/components/bt/host/bluedroid/bta/sys/bta_sys_conn.c index 2d55dec48a..914df55d9c 100644 --- a/components/bt/host/bluedroid/bta/sys/bta_sys_conn.c +++ b/components/bt/host/bluedroid/bta/sys/bta_sys_conn.c @@ -527,8 +527,55 @@ void bta_sys_eir_register(tBTA_SYS_EIR_CBACK *p_cback) *******************************************************************************/ void bta_sys_add_uuid(UINT16 uuid16) { + tBT_UUID uuid; + uuid.len = LEN_UUID_16; + uuid.uu.uuid16 = uuid16; + if (bta_sys_cb.eir_cb) { - bta_sys_cb.eir_cb(uuid16, TRUE ); + bta_sys_cb.eir_cb(uuid, TRUE); + } +} + + +/******************************************************************************* +** +** Function bta_sys_add_uuid_32 +** +** Description Called by BTA subsystems to indicate to DM that new service +** class UUID is added. +** +** Returns void +** +*******************************************************************************/ +void bta_sys_add_uuid_32(UINT32 uuid32) +{ + tBT_UUID uuid; + uuid.len = LEN_UUID_32; + uuid.uu.uuid32 = uuid32; + + if (bta_sys_cb.eir_cb) { + bta_sys_cb.eir_cb(uuid, TRUE); + } +} + +/******************************************************************************* +** +** Function bta_sys_add_uuid_128 +** +** Description Called by BTA subsystems to indicate to DM that new service +** class UUID is added. +** +** Returns void +** +*******************************************************************************/ +void bta_sys_add_uuid_128(UINT8 *uuid128) +{ + tBT_UUID uuid; + uuid.len = LEN_UUID_128; + memcpy(&uuid.uu.uuid128, uuid128, LEN_UUID_128); + + if (bta_sys_cb.eir_cb) { + bta_sys_cb.eir_cb(uuid, TRUE); } } @@ -544,10 +591,57 @@ void bta_sys_add_uuid(UINT16 uuid16) *******************************************************************************/ void bta_sys_remove_uuid(UINT16 uuid16) { + tBT_UUID uuid; + uuid.len = LEN_UUID_16; + uuid.uu.uuid16 = uuid16; + if (bta_sys_cb.eir_cb) { - bta_sys_cb.eir_cb(uuid16, FALSE); + bta_sys_cb.eir_cb(uuid, FALSE); } } + +/******************************************************************************* +** +** Function bta_sys_remove_uuid_32 +** +** Description Called by BTA subsystems to indicate to DM that the service +** class UUID is removed. +** +** Returns void +** +*******************************************************************************/ +void bta_sys_remove_uuid_32(UINT32 uuid32) +{ + tBT_UUID uuid; + uuid.len = LEN_UUID_32; + uuid.uu.uuid32 = uuid32; + + if (bta_sys_cb.eir_cb) { + bta_sys_cb.eir_cb(uuid, FALSE); + } +} + +/******************************************************************************* +** +** Function bta_sys_remove_uuid_128 +** +** Description Called by BTA subsystems to indicate to DM that the service +** class UUID is removed. +** +** Returns void +** +*******************************************************************************/ +void bta_sys_remove_uuid_128(UINT8 *uuid128) +{ + tBT_UUID uuid; + uuid.len = LEN_UUID_128; + memcpy(&uuid.uu.uuid128, uuid128, LEN_UUID_128); + + if (bta_sys_cb.eir_cb) { + bta_sys_cb.eir_cb(uuid, FALSE); + } +} + #endif /******************************************************************************* diff --git a/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c b/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c index c67dd71203..143ae336ea 100644 --- a/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c +++ b/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c @@ -114,6 +114,44 @@ static void set_sdp_handle(int id, int handle) osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex); } + +static bool get_sdp_record_by_handle(int handle, bluetooth_sdp_record* record) +{ + sdp_slot_t *slot = NULL; + + osi_mutex_lock(&sdp_local_param.sdp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT); + + for (int i = 0; i < SDP_MAX_RECORDS; i++) { + slot = sdp_local_param.sdp_slots[i]; + if ((slot != NULL) && (slot->sdp_handle == handle)) { + memcpy(record, slot->record_data, sizeof(bluetooth_sdp_record)); + osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex); + return true; + } + } + + osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex); + return false; +} + +static int get_sdp_slot_id_by_handle(int handle) +{ + sdp_slot_t *slot = NULL; + + osi_mutex_lock(&sdp_local_param.sdp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT); + + for (int i = 0; i < SDP_MAX_RECORDS; i++) { + slot = sdp_local_param.sdp_slots[i]; + if ((slot != NULL) && (slot->sdp_handle == handle)) { + osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex); + return i; + } + } + + osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex); + return -1; +} + static sdp_slot_t *start_create_sdp(int id) { sdp_slot_t *sdp_slot = NULL; @@ -257,7 +295,6 @@ static int free_sdp_slot(int id) static int add_raw_sdp(const bluetooth_sdp_record* rec) { tSDP_PROTOCOL_ELEM protoList [2]; - UINT16 service = 0; UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; bool status = true; // Buffer capable to hold 2, 4 and 16-byte UUIDs @@ -273,18 +310,15 @@ static int add_raw_sdp(const bluetooth_sdp_record* rec) return sdp_handle; } - if (rec->hdr.bt_uuid.len == 16) { - memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid128[2], sizeof(service)); - UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES); - ARRAY_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid128, LEN_UUID_128); - } else if (rec->hdr.bt_uuid.len == 2) { - memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid16, sizeof(service)); - UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES); - UINT16_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid16); - } else if (rec->hdr.bt_uuid.len == 4) { - memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid16, sizeof(service)); - UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES); - UINT32_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid32); + if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_16) { + UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES); + UINT16_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid16); + } else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_32) { + UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES); + UINT32_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid32); + } else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_128) { + UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES); + ARRAY_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid128, LEN_UUID_128); } else { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; @@ -331,7 +365,13 @@ static int add_raw_sdp(const bluetooth_sdp_record* rec) sdp_handle = 0; BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status); } else { - bta_sys_add_uuid(service); + if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_16) { + bta_sys_add_uuid(rec->hdr.bt_uuid.uuid.uuid16); + } else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_32) { + bta_sys_add_uuid_32(rec->hdr.bt_uuid.uuid.uuid32); + } else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_128) { + bta_sys_add_uuid_128((UINT8 *)&rec->hdr.bt_uuid.uuid.uuid128); + } BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } @@ -842,7 +882,8 @@ static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_da switch (event) { case BTA_SDP_CREATE_RECORD_USER_EVT: { if (p_data->status == BTA_SDP_SUCCESS) { - if(btc_handle_create_record_event((int)user_data) < 0) { + p_data->sdp_create_record.handle = btc_handle_create_record_event((int)user_data); + if (p_data->sdp_create_record.handle < 0) { p_data->status = BTA_SDP_FAILURE; } } @@ -981,9 +1022,29 @@ static void btc_sdp_remove_record(btc_sdp_args_t *arg) break; } + bluetooth_sdp_record rec; + if (get_sdp_record_by_handle(arg->remove_record.record_handle, &rec)) { + if (rec.hdr.bt_uuid.len == ESP_UUID_LEN_16) { + bta_sys_remove_uuid(rec.hdr.bt_uuid.uuid.uuid16); + } else if (rec.hdr.bt_uuid.len == ESP_UUID_LEN_32) { + bta_sys_remove_uuid_32(rec.hdr.bt_uuid.uuid.uuid32); + } else if (rec.hdr.bt_uuid.len == ESP_UUID_LEN_128) { + bta_sys_remove_uuid_128((UINT8 *)&rec.hdr.bt_uuid.uuid.uuid128); + } + } else { + BTC_TRACE_ERROR("%s SDP record with handle %d not found", + __func__, arg->remove_record.record_handle); + return; + } + /* Get the Record handle, and free the slot */ /* The application layer record_handle is equivalent to the id of the btc layer */ - handle = free_sdp_slot(arg->remove_record.record_handle); + int slot = get_sdp_slot_id_by_handle(arg->remove_record.record_handle); + if (slot < 0) { + return; + } + + handle = free_sdp_slot(slot); BTC_TRACE_DEBUG("Sdp Server %s id=%d to handle=0x%08x", __func__, arg->remove_record.record_handle, handle); diff --git a/components/bt/host/bluedroid/stack/btm/btm_inq.c b/components/bt/host/bluedroid/stack/btm/btm_inq.c index 21ebe81b9b..b8da232795 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_inq.c +++ b/components/bt/host/bluedroid/stack/btm/btm_inq.c @@ -2535,9 +2535,125 @@ void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ) } } + /******************************************************************************* ** -** Function BTM_RemoveEirService +** Function btm_compare_uuid +** +** Description Helper function for custom service managing routines. +** +** Parameters uuid1 - pointer to the first tBT_UUID struct +** uuid2 - pointer to the second tBT_UUID struct +** +** Returns true if UUID structs are identical +** +*******************************************************************************/ +static bool btm_compare_uuid(tBT_UUID *uuid1, tBT_UUID *uuid2) +{ + if (uuid1->len != uuid2->len) { + return FALSE; + } + + return (memcmp(&uuid1->uu, &uuid2->uu, uuid1->len) == 0); +} + +/******************************************************************************* +** +** Function btm_find_empty_custom_uuid_slot +** +** Description Helper function for custom service managing routines. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns Slot number if there is empty slot, +** otherwise - BTA_EIR_SERVER_NUM_CUSTOM_UUID +** +*******************************************************************************/ +static UINT8 btm_find_empty_custom_uuid_slot(tBT_UUID *custom_uuid, tBT_UUID uuid) +{ + for (UINT8 xx = 0; xx < BTA_EIR_SERVER_NUM_CUSTOM_UUID; xx++) { + if (custom_uuid[xx].len == 0) { + return xx; + } + } + return BTA_EIR_SERVER_NUM_CUSTOM_UUID; +} + +/******************************************************************************* +** +** Function btm_find_match_custom_uuid_slot +** +** Description Helper function for custom service managing routines. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns Slot number if given UUID is already in slots array, +** otherwise - BTA_EIR_SERVER_NUM_CUSTOM_UUID +** +*******************************************************************************/ +static UINT8 btm_find_match_custom_uuid_slot(tBT_UUID *custom_uuid, tBT_UUID uuid) +{ + for (UINT8 xx = 0; xx < BTA_EIR_SERVER_NUM_CUSTOM_UUID; xx++) { + if (btm_compare_uuid(&custom_uuid[xx], &uuid)) { + return xx; + } + } + return BTA_EIR_SERVER_NUM_CUSTOM_UUID; +} + +/******************************************************************************* +** +** Function BTM_HasCustomEirService +** +** Description This function is called to know if UUID is already in custom +** UUID list. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns TRUE - if found +** FALSE - if not found +** +*******************************************************************************/ +BOOLEAN BTM_HasCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid) +{ + UINT8 match_slot = btm_find_match_custom_uuid_slot(custom_uuid, uuid); + + if (match_slot == BTA_EIR_SERVER_NUM_CUSTOM_UUID) { + return FALSE; + } + return TRUE; +} + +/******************************************************************************* +** +** Function BTM_AddCustomEirService +** +** Description This function is called to add a custom UUID. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns None +** +*******************************************************************************/ +void BTM_AddCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid) +{ + UINT8 empty_slot = btm_find_empty_custom_uuid_slot(custom_uuid, uuid); + + if (empty_slot == BTA_EIR_SERVER_NUM_CUSTOM_UUID) { + BTM_TRACE_WARNING("No space to add UUID for EIR"); + } else { + memcpy(&(custom_uuid[empty_slot]), &(uuid), sizeof(tBT_UUID)); + BTM_TRACE_EVENT("UUID saved in %d slot", empty_slot); + } +} + +/******************************************************************************* +** +** Function BTM_RemoveCustomEirService ** ** Description This function is called to remove a service in bit map of UUID list. ** @@ -2557,6 +2673,30 @@ void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ) } } +/******************************************************************************* +** +** Function BTM_RemoveCustomEirService +** +** Description This function is called to remove a a custom UUID. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns None +** +*******************************************************************************/ +void BTM_RemoveCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid) +{ + UINT8 match_slot = btm_find_match_custom_uuid_slot(custom_uuid, uuid); + + if (match_slot == BTA_EIR_SERVER_NUM_CUSTOM_UUID) { + BTM_TRACE_WARNING("UUID is not found for EIR"); + return; + } else { + memset(&(custom_uuid[match_slot]), 0, sizeof(tBT_UUID)); + } +} + /******************************************************************************* ** ** Function BTM_GetEirSupportedServices diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_api.h index 768fb7fa96..21ef4dcdbb 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_api.h @@ -4010,6 +4010,22 @@ BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results, UINT16 uuid16 ); +/******************************************************************************* +** +** Function BTM_HasCustomEirService +** +** Description This function is called to know if UUID is already in custom +** UUID list. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns TRUE - if found +** FALSE - if not found +** +*******************************************************************************/ +BOOLEAN BTM_HasCustomEirService( tBT_UUID *custom_uuid, tBT_UUID uuid ); + /******************************************************************************* ** ** Function BTM_AddEirService @@ -4025,6 +4041,20 @@ tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results, //extern void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); +/******************************************************************************* +** +** Function BTM_AddCustomEirService +** +** Description This function is called to add a custom UUID. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB +** uuid - UUID struct +** +** Returns None +** +*******************************************************************************/ +void BTM_AddCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid); + /******************************************************************************* ** ** Function BTM_RemoveEirService @@ -4040,6 +4070,20 @@ void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); //extern void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); +/******************************************************************************* +** +** Function BTM_RemoveCustomEirService +** +** Description This function is called to remove a a custom UUID. +** +** Parameters custom_uuid - pointer to custom_uuid array in tBTA_DM_CB + uuid - UUID struct +** +** Returns None +** +*******************************************************************************/ +void BTM_RemoveCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid); + /******************************************************************************* ** ** Function BTM_GetEirSupportedServices