diff --git a/components/bt/bluedroid/bta/av/bta_av_act.c b/components/bt/bluedroid/bta/av/bta_av_act.c index 5aa91b84d6..341ced1a4a 100644 --- a/components/bt/bluedroid/bta/av/bta_av_act.c +++ b/components/bt/bluedroid/bta/av/bta_av_act.c @@ -1870,8 +1870,14 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data) bta_av_cb.features = 0; } - /* Clear the Capturing service class bit */ - cod.service = BTM_COD_SERVICE_CAPTURING; + /* Clear the Capturing/Rendering service class bit */ + if (p_data->api_reg.tsep == AVDT_TSEP_SRC) { + cod.service = BTM_COD_SERVICE_CAPTURING | BTM_COD_SERVICE_AUDIO; + } else { +#if (BTA_AV_SINK_INCLUDED == TRUE) + cod.service = BTM_COD_SERVICE_RENDERING | BTM_COD_SERVICE_AUDIO; +#endif + } utl_set_device_class(&cod, BTA_UTL_CLR_COD_SERVICE_CLASS); } } diff --git a/components/bt/bluedroid/bta/av/bta_av_main.c b/components/bt/bluedroid/bta/av/bta_av_main.c index a72626b26a..d16b896d44 100644 --- a/components/bt/bluedroid/bta/av/bta_av_main.c +++ b/components/bt/bluedroid/bta/av/bta_av_main.c @@ -577,15 +577,19 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) #endif } - /* Set the Capturing service class bit */ + /* Set the Calss of Device (Audio & Capturing/Rendering service class bit) */ if (p_data->api_reg.tsep == AVDT_TSEP_SRC) { - cod.service = BTM_COD_SERVICE_CAPTURING; + cod.service = BTM_COD_SERVICE_CAPTURING | BTM_COD_SERVICE_AUDIO; + cod.major = BTM_COD_MAJOR_AUDIO; + cod.minor = BTM_COD_MINOR_UNCLASSIFIED; } else { #if (BTA_AV_SINK_INCLUDED == TRUE) - cod.service = BTM_COD_SERVICE_RENDERING; + cod.service = BTM_COD_SERVICE_RENDERING | BTM_COD_SERVICE_AUDIO; + cod.major = BTM_COD_MAJOR_AUDIO; + cod.minor = BTM_COD_MINOR_LOUDSPEAKER; #endif } - utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS); + utl_set_device_class(&cod, BTA_UTL_SET_COD_ALL); } /* if 1st channel */ /* get stream configuration and create stream */ diff --git a/components/bt/bluedroid/bta/hf_client/bta_hf_client_act.c b/components/bt/bluedroid/bta/hf_client/bta_hf_client_act.c index c42b5bd14f..3adaad23ee 100644 --- a/components/bt/bluedroid/bta/hf_client/bta_hf_client_act.c +++ b/components/bt/bluedroid/bta/hf_client/bta_hf_client_act.c @@ -73,9 +73,11 @@ void bta_hf_client_register(tBTA_HF_CLIENT_DATA *p_data) /* create SDP records */ bta_hf_client_create_record(p_data); - /* Set the Audio service class bit */ + /* Set the Class of Device (Audio service class bit) */ cod.service = BTM_COD_SERVICE_AUDIO; - utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS); + cod.major = BTM_COD_MAJOR_AUDIO; + cod.minor = BTM_COD_MINOR_CONFM_HANDSFREE; + utl_set_device_class(&cod, BTA_UTL_SET_COD_ALL); /* start RFCOMM server */ bta_hf_client_start_server(); @@ -98,8 +100,14 @@ void bta_hf_client_register(tBTA_HF_CLIENT_DATA *p_data) *******************************************************************************/ void bta_hf_client_deregister(tBTA_HF_CLIENT_DATA *p_data) { + tBTA_UTL_COD cod; + bta_hf_client_cb.scb.deregister = TRUE; + /* Clear the Audio service class bit */ + cod.service = BTM_COD_SERVICE_AUDIO; + utl_set_device_class(&cod, BTA_UTL_CLR_COD_SERVICE_CLASS); + /* remove sdp record */ bta_hf_client_del_record(p_data); @@ -653,7 +661,7 @@ void bta_hf_client_ccwa(char *number) if ((evt = osi_calloc(sizeof(tBTA_HF_CLIENT_NUMBER))) != NULL) { strlcpy(evt->number, number, BTA_HF_CLIENT_NUMBER_LEN + 1); evt->number[BTA_HF_CLIENT_NUMBER_LEN] = '\0'; - + (*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_CCWA_EVT, evt); osi_free(evt); @@ -709,7 +717,7 @@ void bta_hf_client_clcc(UINT32 idx, BOOLEAN incoming, UINT8 status, BOOLEAN mpty strlcpy(evt->number, number, BTA_HF_CLIENT_NUMBER_LEN + 1); evt->number[BTA_HF_CLIENT_NUMBER_LEN] = '\0'; } - + (*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_CLCC_EVT, evt); osi_free(evt); } else { diff --git a/components/bt/bluedroid/bta/jv/bta_jv_act.c b/components/bt/bluedroid/bta/jv/bta_jv_act.c index f89ba3e0ba..8b89ad8508 100644 --- a/components/bt/bluedroid/bta/jv/bta_jv_act.c +++ b/components/bt/bluedroid/bta/jv/bta_jv_act.c @@ -643,10 +643,17 @@ BOOLEAN bta_jv_check_psm(UINT16 psm) *******************************************************************************/ void bta_jv_enable(tBTA_JV_MSG *p_data) { + tBTA_UTL_COD cod; + tBTA_JV_STATUS status = BTA_JV_SUCCESS; bta_jv_cb.p_dm_cback = p_data->enable.p_cback; bta_jv_cb.p_dm_cback(BTA_JV_ENABLE_EVT, (tBTA_JV *)&status, 0); memset(bta_jv_cb.free_psm_list, 0, sizeof(bta_jv_cb.free_psm_list)); + + /* Set the Class of Device */ + cod.major = BTM_COD_MAJOR_UNCLASSIFIED; + cod.minor = BTM_COD_MINOR_UNCLASSIFIED; + utl_set_device_class(&cod, BTA_UTL_SET_COD_MAJOR_MINOR); } /******************************************************************************* @@ -662,8 +669,6 @@ void bta_jv_enable(tBTA_JV_MSG *p_data) void bta_jv_disable (tBTA_JV_MSG *p_data) { UNUSED(p_data); - - APPL_TRACE_ERROR("%s", __func__); } diff --git a/components/bt/bluedroid/common/include/common/bt_target.h b/components/bt/bluedroid/common/include/common/bt_target.h index 7beeb19106..5c415a2b6d 100644 --- a/components/bt/bluedroid/common/include/common/bt_target.h +++ b/components/bt/bluedroid/common/include/common/bt_target.h @@ -620,9 +620,18 @@ */ #define BTA_DM_COD_LOUDSPEAKER {0x2C, 0x04, 0x14} +/* +* {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS} +* +* SERVICE_CLASS:0x00 None +* MAJOR_CLASS:0x1f - Uncategorized: device code not specified +* MINOR_CLASS:0x00 - None +*/ +#define BTA_DM_COD_UNCLASSIFIED {0x00, 0x1f, 0x00} + /* Default class of device */ #ifndef BTA_DM_COD -#define BTA_DM_COD BTA_DM_COD_LOUDSPEAKER +#define BTA_DM_COD BTA_DM_COD_UNCLASSIFIED #endif /* The number of SCO links. */