Skip to content

Commit

Permalink
bluedroid: bta_sys: add API for 32 and 128-bit UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ilutchenko committed Jul 24, 2023
1 parent 00311ea commit 86c4c67
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 3 deletions.
10 changes: 9 additions & 1 deletion components/bt/host/bluedroid/bta/include/bta/bta_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
94 changes: 92 additions & 2 deletions components/bt/host/bluedroid/bta/sys/bta_sys_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,54 @@ 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;
memcpy(&uuid.uu.uuid16, &uuid16, LEN_UUID_16);
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;
memcpy(&uuid.uu.uuid32, &uuid32, LEN_UUID_32);

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 );
}
}

Expand All @@ -544,10 +590,54 @@ void bta_sys_add_uuid(UINT16 uuid16)
*******************************************************************************/
void bta_sys_remove_uuid(UINT16 uuid16)
{
tBT_UUID uuid;
uuid.len = LEN_UUID_16;
memcpy(&uuid.uu.uuid16, &uuid16, LEN_UUID_16);
if (bta_sys_cb.eir_cb) {
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;
memcpy(&uuid.uu.uuid32, &uuid32, LEN_UUID_32);
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_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

/*******************************************************************************
Expand Down

0 comments on commit 86c4c67

Please sign in to comment.