mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/support_for_32_and_128_bit_custom_uuids' into 'master'
feat(bt/bluedroid): Add new APIs for 32 and 128-bit UUIDs Closes IDFGH-10721 See merge request espressif/esp-idf!27069
This commit is contained in:
commit
a7fbf452fa
@ -4279,7 +4279,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++) {
|
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 (bta_dm_cb.custom_uuid[custom_uuid_idx].len == LEN_UUID_128) {
|
||||||
if ( num_uuid < max_num_uuid ) {
|
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++;
|
num_uuid++;
|
||||||
} else {
|
} else {
|
||||||
data_type = BTM_EIR_MORE_128BITS_UUID_TYPE;
|
data_type = BTM_EIR_MORE_128BITS_UUID_TYPE;
|
||||||
@ -4483,21 +4483,38 @@ static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
|
|||||||
** Returns None
|
** 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 */
|
/* 32 and 128-bit UUIDs go to the bta_dm_cb.custom_uuid array */
|
||||||
if ( !BTM_HasEirService( p_bta_dm_eir_cfg->uuid_mask, uuid16 )) {
|
if ((uuid.len == LEN_UUID_32) || (uuid.len == LEN_UUID_128)) {
|
||||||
return;
|
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 ) {
|
BTM_AddCustomEirService(bta_dm_cb.custom_uuid, uuid);
|
||||||
APPL_TRACE_EVENT("Adding UUID=0x%04X into EIR", uuid16);
|
} 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 {
|
} 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
|
#if CLASSIC_BT_INCLUDED
|
||||||
bta_dm_set_eir (NULL);
|
bta_dm_set_eir (NULL);
|
||||||
|
@ -1827,7 +1827,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_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_disc_rmt_name (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);
|
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_enable_test_mode(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
|
extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
|
||||||
|
@ -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)
|
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
|
||||||
/* eir callback for adding/removeing UUID */
|
/* 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
|
#endif
|
||||||
|
|
||||||
/* registration structure */
|
/* registration structure */
|
||||||
@ -263,12 +263,20 @@ extern void bta_sys_notify_collision (BD_ADDR_PTR p_bda);
|
|||||||
|
|
||||||
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
|
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
|
||||||
extern void bta_sys_eir_register(tBTA_SYS_EIR_CBACK *p_cback);
|
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(UINT16 uuid16);
|
||||||
|
extern void bta_sys_remove_uuid_32(UINT32 uuid32);
|
||||||
|
extern void bta_sys_remove_uuid_128(UINT8 *uuid128);
|
||||||
#else
|
#else
|
||||||
#define bta_sys_eir_register(ut)
|
#define bta_sys_eir_register(ut)
|
||||||
#define bta_sys_add_uuid(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(ut)
|
||||||
|
#define bta_sys_remove_uuid_32(ut)
|
||||||
|
#define bta_sys_remove_uuid_128(ut)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void bta_sys_set_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
|
extern void bta_sys_set_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
|
||||||
|
@ -527,8 +527,55 @@ void bta_sys_eir_register(tBTA_SYS_EIR_CBACK *p_cback)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void bta_sys_add_uuid(UINT16 uuid16)
|
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) {
|
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)
|
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) {
|
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
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -114,6 +114,44 @@ static void set_sdp_handle(int id, int handle)
|
|||||||
osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex);
|
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)
|
static sdp_slot_t *start_create_sdp(int id)
|
||||||
{
|
{
|
||||||
sdp_slot_t *sdp_slot = NULL;
|
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)
|
static int add_raw_sdp(const bluetooth_sdp_record* rec)
|
||||||
{
|
{
|
||||||
tSDP_PROTOCOL_ELEM protoList [2];
|
tSDP_PROTOCOL_ELEM protoList [2];
|
||||||
UINT16 service = 0;
|
|
||||||
UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
|
UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
|
||||||
bool status = true;
|
bool status = true;
|
||||||
// Buffer capable to hold 2, 4 and 16-byte UUIDs
|
// 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;
|
return sdp_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec->hdr.bt_uuid.len == 16) {
|
if (rec->hdr.bt_uuid.len == ESP_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_TWO_BYTES);
|
||||||
UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
UINT16_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid16);
|
||||||
ARRAY_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid128, LEN_UUID_128);
|
} else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_32) {
|
||||||
} else if (rec->hdr.bt_uuid.len == 2) {
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
||||||
memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid16, sizeof(service));
|
UINT32_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid32);
|
||||||
UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
} else if (rec->hdr.bt_uuid.len == ESP_UUID_LEN_128) {
|
||||||
UINT16_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid16);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
||||||
} else if (rec->hdr.bt_uuid.len == 4) {
|
ARRAY_TO_BE_STREAM (p_temp, rec->hdr.bt_uuid.uuid.uuid128, LEN_UUID_128);
|
||||||
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);
|
|
||||||
} else {
|
} else {
|
||||||
SDP_DeleteRecord(sdp_handle);
|
SDP_DeleteRecord(sdp_handle);
|
||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
@ -331,7 +365,13 @@ static int add_raw_sdp(const bluetooth_sdp_record* rec)
|
|||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
||||||
} else {
|
} 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);
|
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) {
|
switch (event) {
|
||||||
case BTA_SDP_CREATE_RECORD_USER_EVT: {
|
case BTA_SDP_CREATE_RECORD_USER_EVT: {
|
||||||
if (p_data->status == BTA_SDP_SUCCESS) {
|
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;
|
p_data->status = BTA_SDP_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -981,9 +1022,29 @@ static void btc_sdp_remove_record(btc_sdp_args_t *arg)
|
|||||||
break;
|
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 */
|
/* Get the Record handle, and free the slot */
|
||||||
/* The application layer record_handle is equivalent to the id of the btc layer */
|
/* 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",
|
BTC_TRACE_DEBUG("Sdp Server %s id=%d to handle=0x%08x",
|
||||||
__func__, arg->remove_record.record_handle, handle);
|
__func__, arg->remove_record.record_handle, handle);
|
||||||
|
@ -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.
|
** 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
|
** Function BTM_GetEirSupportedServices
|
||||||
|
@ -4103,6 +4103,22 @@ BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
|
|||||||
tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results,
|
tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results,
|
||||||
UINT16 uuid16 );
|
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
|
** Function BTM_AddEirService
|
||||||
@ -4118,6 +4134,20 @@ tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results,
|
|||||||
//extern
|
//extern
|
||||||
void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
|
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
|
** Function BTM_RemoveEirService
|
||||||
@ -4133,6 +4163,20 @@ void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
|
|||||||
//extern
|
//extern
|
||||||
void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
|
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
|
** Function BTM_GetEirSupportedServices
|
||||||
|
Loading…
Reference in New Issue
Block a user