mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Remove uneccessary macro
Separate AVRC from A2DP when AVRC not Initialized
This commit is contained in:
parent
af52df8b83
commit
04a7771f33
@ -208,11 +208,8 @@ static void bta_av_rc_ctrl_cback(UINT8 handle, UINT8 event, UINT16 result, BD_AD
|
||||
UINT16 msg_event = 0;
|
||||
UNUSED(result);
|
||||
|
||||
#if (defined(BTA_AV_MIN_DEBUG_TRACES) && BTA_AV_MIN_DEBUG_TRACES == TRUE)
|
||||
APPL_TRACE_EVENT("rc_ctrl handle: %d event=0x%x", handle, event);
|
||||
#else
|
||||
APPL_TRACE_EVENT("bta_av_rc_ctrl_cback handle: %d event=0x%x", handle, event);
|
||||
#endif
|
||||
APPL_TRACE_EVENT("%s handle: %d event: 0x%x",__func__, handle, event);
|
||||
|
||||
if (event == AVRC_OPEN_IND_EVT) {
|
||||
/* save handle of opened connection
|
||||
bta_av_cb.rc_handle = handle;*/
|
||||
|
@ -568,13 +568,8 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
if (bta_av_cb.features & (BTA_AV_FEAT_RCTG)) {
|
||||
/* register with no authorization; let AVDTP use authorization instead */
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
bta_av_cb.sec_mask, BTA_ID_AV);
|
||||
#else
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
|
||||
#endif
|
||||
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
|
||||
p_bta_av_cfg->avrc_src_tg_cat, BTA_ID_AV);
|
||||
@ -703,13 +698,8 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
/* if TG is not supported, we need to register to AVCT now */
|
||||
if ((bta_av_cb.features & (BTA_AV_FEAT_RCTG)) == 0) {
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
bta_av_cb.sec_mask, BTA_ID_AV);
|
||||
#else
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
|
@ -36,12 +36,6 @@
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
/* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP authorization */
|
||||
/* Typically FALSE when AVRCP is used in conjunction with A2DP */
|
||||
#ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION
|
||||
#define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE
|
||||
#endif
|
||||
|
||||
/* AV status values */
|
||||
#define BTA_AV_SUCCESS 0 /* successful operation */
|
||||
#define BTA_AV_FAIL 1 /* generic failure */
|
||||
|
@ -38,7 +38,7 @@
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_on_init(void)
|
||||
{
|
||||
//tput_mon(1, 0, 1);
|
||||
BTC_TRACE_EVENT("A2DP Initialized.");
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1216,8 +1216,6 @@ BOOLEAN btc_media_aa_read_feeding(void)
|
||||
/* Read Data from data channel */
|
||||
nb_byte_read = btc_aa_src_data_read((uint8_t *)read_buffer, read_size);
|
||||
|
||||
//tput_mon(TRUE, nb_byte_read, FALSE);
|
||||
|
||||
if (nb_byte_read < read_size) {
|
||||
APPL_TRACE_WARNING("### UNDERRUN :: ONLY READ %d BYTES OUT OF %d ###",
|
||||
nb_byte_read, read_size);
|
||||
|
@ -101,7 +101,6 @@ typedef struct {
|
||||
** Static variables
|
||||
******************************************************************************/
|
||||
btc_av_open_t av_open;
|
||||
bool open_fail = false;
|
||||
|
||||
#if A2D_DYNAMIC_MEMORY == FALSE
|
||||
static btc_av_cb_t btc_av_cb = {0};
|
||||
@ -327,6 +326,9 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
||||
|
||||
case BTA_AV_REGISTER_EVT:
|
||||
btc_av_cb.bta_handle = ((tBTA_AV *)p_data)->registr.hndl;
|
||||
// Init av_open struct and av_open_state
|
||||
memset(&av_open, 0, sizeof(btc_av_open_t));
|
||||
open_fail = false;
|
||||
break;
|
||||
|
||||
case BTA_AV_PENDING_EVT:
|
||||
@ -334,14 +336,24 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
||||
if (event == BTC_AV_CONNECT_REQ_EVT) {
|
||||
memcpy(&btc_av_cb.peer_bda, &((btc_av_connect_req_t *)p_data)->target_bda,
|
||||
sizeof(bt_bdaddr_t));
|
||||
if (av_with_rc) {
|
||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
||||
TRUE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
|
||||
} else {
|
||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
||||
FALSE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
|
||||
}
|
||||
} else if (event == BTA_AV_PENDING_EVT) {
|
||||
bdcpy(btc_av_cb.peer_bda.address, ((tBTA_AV *)p_data)->pend.bd_addr);
|
||||
UINT16 uuid = (btc_av_cb.service_id == BTA_A2DP_SOURCE_SERVICE_ID) ? UUID_SERVCLASS_AUDIO_SOURCE :
|
||||
UUID_SERVCLASS_AUDIO_SINK;
|
||||
if (av_with_rc) {
|
||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
||||
TRUE, BTA_SEC_AUTHENTICATE, uuid);
|
||||
} else {
|
||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
||||
FALSE, BTA_SEC_AUTHENTICATE, uuid);
|
||||
}
|
||||
}
|
||||
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENING);
|
||||
} break;
|
||||
@ -361,7 +373,6 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
||||
*
|
||||
* TODO: We may need to do this only on an AVRCP Play. FixMe
|
||||
*/
|
||||
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
BTC_TRACE_DEBUG("BTA_AV_RC_OPEN_EVT received w/o AV");
|
||||
btc_av_cb.tle_av_open_on_rc = osi_alarm_new("AVconn", btc_initiate_av_open_tmr_hdlr, NULL, BTC_TIMEOUT_AV_OPEN_ON_RC_SECS * 1000);
|
||||
@ -458,8 +469,12 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
|
||||
*/
|
||||
} else if (btc_av_cb.peer_sep == AVDT_TSEP_SRC &&
|
||||
(p_bta_data->open.status == BTA_AV_SUCCESS)) {
|
||||
/* Bring up AVRCP connection too */
|
||||
/* Bring up AVRCP connection too if AVRC Initialized */
|
||||
if(av_with_rc) {
|
||||
BTA_AvOpenRc(btc_av_cb.bta_handle);
|
||||
} else {
|
||||
BTC_TRACE_WARNING("AVRC not Init, not using it.");
|
||||
}
|
||||
}
|
||||
btc_queue_advance();
|
||||
} break;
|
||||
@ -1273,11 +1288,16 @@ bt_status_t btc_av_execute_service(BOOLEAN b_enable, UINT8 tsep)
|
||||
/* Added BTA_AV_FEAT_NO_SCO_SSPD - this ensures that the BTA does not
|
||||
* auto-suspend av streaming on AG events(SCO or Call). The suspend shall
|
||||
* be initiated by the app/audioflinger layers */
|
||||
BTA_AvEnable(BTA_SEC_AUTHENTICATE, (BTA_AV_FEAT_NO_SCO_SSPD)
|
||||
| BTA_AV_FEAT_RCTG | BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR
|
||||
| BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
|
||||
if (av_with_rc) {
|
||||
BTA_AvEnable(BTA_SEC_AUTHENTICATE, BTA_AV_FEAT_NO_SCO_SSPD |
|
||||
BTA_AV_FEAT_RCTG | BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR |
|
||||
BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
|
||||
bte_av_callback);
|
||||
BTA_AvRegister(BTA_AV_CHNL_AUDIO, BTC_AV_SERVICE_NAME, 0, bte_av_media_callback, &bta_av_a2d_cos, &bta_avrc_cos, tsep);
|
||||
} else {
|
||||
BTA_AvEnable(BTA_SEC_AUTHENTICATE, BTA_AV_FEAT_NO_SCO_SSPD, bte_av_callback);
|
||||
BTA_AvRegister(BTA_AV_CHNL_AUDIO, BTC_AV_SERVICE_NAME, 0, bte_av_media_callback, &bta_av_a2d_cos, NULL, tsep);
|
||||
}
|
||||
} else {
|
||||
BTA_AvDeregister(btc_av_cb.bta_handle);
|
||||
BTA_AvDisable();
|
||||
|
@ -1011,6 +1011,9 @@ static void btc_avrc_ct_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// indicate that using A2DP with AVRC
|
||||
av_with_rc = true;
|
||||
|
||||
/// initialize CT-specific resources
|
||||
s_rc_ct_init = BTC_RC_CT_INIT_MAGIC;
|
||||
|
||||
@ -1039,6 +1042,9 @@ static void btc_avrc_ct_deinit(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// indicate that using A2DP with AVRC
|
||||
av_with_rc = true;
|
||||
|
||||
/// deinit CT-specific resources
|
||||
s_rc_ct_init = 0;
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "bta/bta_av_api.h"
|
||||
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
bool open_fail;
|
||||
bool av_with_rc;
|
||||
/*******************************************************************************
|
||||
** Type definitions for callback functions
|
||||
********************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user