Skip to content

Commit

Permalink
bluedroid: bta_dm: add custom UUIDs support ot bta_dm_eir_update_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
ilutchenko committed Jul 24, 2023
1 parent 9a3043a commit 00311ea
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
33 changes: 23 additions & 10 deletions components/bt/host/bluedroid/bta/dm/bta_dm_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -4397,21 +4397,34 @@ 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 ) {
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;
}

if ( adding ) {
APPL_TRACE_EVENT("Adding UUID=0x%04X into EIR", uuid.uu.uuid16);

BTM_RemoveEirService( bta_dm_cb.eir_uuid, 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);
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,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);
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/bta/include/bta/bta_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 00311ea

Please sign in to comment.