mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Add global header and change declaration position
This commit is contained in:
parent
b16deb4473
commit
e940e1d72a
@ -42,6 +42,9 @@
|
|||||||
|
|
||||||
#if BTC_AV_INCLUDED
|
#if BTC_AV_INCLUDED
|
||||||
|
|
||||||
|
bool g_av_open_fail;
|
||||||
|
bool g_av_with_rc;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** Constants & Macros
|
** Constants & Macros
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -311,8 +314,9 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
|||||||
btc_av_cb.flags = 0;
|
btc_av_cb.flags = 0;
|
||||||
btc_av_cb.edr = 0;
|
btc_av_cb.edr = 0;
|
||||||
btc_a2dp_on_idle();
|
btc_a2dp_on_idle();
|
||||||
if(open_fail) {
|
|
||||||
BTC_TRACE_ERROR("AV_OPEN fail: Sta %d , SM Sta %d\n",av_open.state, av_open.av_state);
|
if(g_av_open_fail) {
|
||||||
|
BTC_TRACE_ERROR("AV_OPEN: Sta %d , SM Sta %d\n",av_open.state, av_open.av_state);
|
||||||
/* inform the application of the event */
|
/* inform the application of the event */
|
||||||
btc_report_connection_state(av_open.state, &(btc_av_cb.peer_bda), 0);
|
btc_report_connection_state(av_open.state, &(btc_av_cb.peer_bda), 0);
|
||||||
}
|
}
|
||||||
@ -328,7 +332,7 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
|||||||
btc_av_cb.bta_handle = ((tBTA_AV *)p_data)->registr.hndl;
|
btc_av_cb.bta_handle = ((tBTA_AV *)p_data)->registr.hndl;
|
||||||
// Init av_open struct and av_open_state
|
// Init av_open struct and av_open_state
|
||||||
memset(&av_open, 0, sizeof(btc_av_open_t));
|
memset(&av_open, 0, sizeof(btc_av_open_t));
|
||||||
open_fail = false;
|
g_av_open_fail = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTA_AV_PENDING_EVT:
|
case BTA_AV_PENDING_EVT:
|
||||||
@ -336,7 +340,7 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
|||||||
if (event == BTC_AV_CONNECT_REQ_EVT) {
|
if (event == BTC_AV_CONNECT_REQ_EVT) {
|
||||||
memcpy(&btc_av_cb.peer_bda, &((btc_av_connect_req_t *)p_data)->target_bda,
|
memcpy(&btc_av_cb.peer_bda, &((btc_av_connect_req_t *)p_data)->target_bda,
|
||||||
sizeof(bt_bdaddr_t));
|
sizeof(bt_bdaddr_t));
|
||||||
if (av_with_rc) {
|
if (g_av_with_rc) {
|
||||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
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);
|
TRUE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
|
||||||
} else {
|
} else {
|
||||||
@ -347,7 +351,7 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
|
|||||||
bdcpy(btc_av_cb.peer_bda.address, ((tBTA_AV *)p_data)->pend.bd_addr);
|
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 :
|
UINT16 uuid = (btc_av_cb.service_id == BTA_A2DP_SOURCE_SERVICE_ID) ? UUID_SERVCLASS_AUDIO_SOURCE :
|
||||||
UUID_SERVCLASS_AUDIO_SINK;
|
UUID_SERVCLASS_AUDIO_SINK;
|
||||||
if (av_with_rc) {
|
if (g_av_with_rc) {
|
||||||
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
|
||||||
TRUE, BTA_SEC_AUTHENTICATE, uuid);
|
TRUE, BTA_SEC_AUTHENTICATE, uuid);
|
||||||
} else {
|
} else {
|
||||||
@ -435,7 +439,7 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
|
|||||||
|
|
||||||
case BTA_AV_REJECT_EVT:
|
case BTA_AV_REJECT_EVT:
|
||||||
BTC_TRACE_DEBUG(" Received BTA_AV_REJECT_EVT \n");
|
BTC_TRACE_DEBUG(" Received BTA_AV_REJECT_EVT \n");
|
||||||
open_fail = true;
|
g_av_open_fail = true;
|
||||||
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -455,7 +459,7 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
|
|||||||
p_bta_data->open.status );
|
p_bta_data->open.status );
|
||||||
av_open.state = ESP_A2D_CONNECTION_STATE_DISCONNECTED;
|
av_open.state = ESP_A2D_CONNECTION_STATE_DISCONNECTED;
|
||||||
av_open.av_state = BTC_AV_STATE_IDLE;
|
av_open.av_state = BTC_AV_STATE_IDLE;
|
||||||
open_fail = true;
|
g_av_open_fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* change state to open/idle based on the status */
|
/* change state to open/idle based on the status */
|
||||||
@ -470,7 +474,7 @@ 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 &&
|
} else if (btc_av_cb.peer_sep == AVDT_TSEP_SRC &&
|
||||||
(p_bta_data->open.status == BTA_AV_SUCCESS)) {
|
(p_bta_data->open.status == BTA_AV_SUCCESS)) {
|
||||||
/* Bring up AVRCP connection too if AVRC Initialized */
|
/* Bring up AVRCP connection too if AVRC Initialized */
|
||||||
if(av_with_rc) {
|
if(g_av_with_rc) {
|
||||||
BTA_AvOpenRc(btc_av_cb.bta_handle);
|
BTA_AvOpenRc(btc_av_cb.bta_handle);
|
||||||
} else {
|
} else {
|
||||||
BTC_TRACE_WARNING("AVRC not Init, not using it.");
|
BTC_TRACE_WARNING("AVRC not Init, not using it.");
|
||||||
@ -582,7 +586,7 @@ static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data)
|
|||||||
/* inform the application that we are disconnecting */
|
/* inform the application that we are disconnecting */
|
||||||
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
|
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
|
||||||
close->disc_rsn);
|
close->disc_rsn);
|
||||||
open_fail = false;
|
g_av_open_fail = false;
|
||||||
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -712,7 +716,7 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
|
|||||||
/* inform the application that we are disconnected */
|
/* inform the application that we are disconnected */
|
||||||
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
|
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
|
||||||
close->disc_rsn);
|
close->disc_rsn);
|
||||||
open_fail = false;
|
g_av_open_fail = false;
|
||||||
/* change state to idle, send acknowledgement if start is pending */
|
/* change state to idle, send acknowledgement if start is pending */
|
||||||
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
||||||
|
|
||||||
@ -903,7 +907,7 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
|
|||||||
|
|
||||||
/* avdtp link is closed */
|
/* avdtp link is closed */
|
||||||
btc_a2dp_on_stopped(NULL);
|
btc_a2dp_on_stopped(NULL);
|
||||||
open_fail = false;
|
g_av_open_fail = false;
|
||||||
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
|
||||||
|
|
||||||
tBTA_AV_CLOSE *close = (tBTA_AV_CLOSE *)p_data;
|
tBTA_AV_CLOSE *close = (tBTA_AV_CLOSE *)p_data;
|
||||||
@ -1288,7 +1292,7 @@ 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
|
/* 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
|
* auto-suspend av streaming on AG events(SCO or Call). The suspend shall
|
||||||
* be initiated by the app/audioflinger layers */
|
* be initiated by the app/audioflinger layers */
|
||||||
if (av_with_rc) {
|
if (g_av_with_rc) {
|
||||||
BTA_AvEnable(BTA_SEC_AUTHENTICATE, BTA_AV_FEAT_NO_SCO_SSPD |
|
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_RCTG | BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR |
|
||||||
BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
|
BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
|
||||||
|
@ -1012,7 +1012,7 @@ static void btc_avrc_ct_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// indicate that using A2DP with AVRC
|
// indicate that using A2DP with AVRC
|
||||||
av_with_rc = true;
|
g_av_with_rc = true;
|
||||||
|
|
||||||
/// initialize CT-specific resources
|
/// initialize CT-specific resources
|
||||||
s_rc_ct_init = BTC_RC_CT_INIT_MAGIC;
|
s_rc_ct_init = BTC_RC_CT_INIT_MAGIC;
|
||||||
@ -1043,7 +1043,7 @@ static void btc_avrc_ct_deinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// indicate that using A2DP with AVRC
|
// indicate that using A2DP with AVRC
|
||||||
av_with_rc = true;
|
g_av_with_rc = true;
|
||||||
|
|
||||||
/// deinit CT-specific resources
|
/// deinit CT-specific resources
|
||||||
s_rc_ct_init = 0;
|
s_rc_ct_init = 0;
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#include "bta/bta_av_api.h"
|
#include "bta/bta_av_api.h"
|
||||||
|
|
||||||
#if (BTC_AV_INCLUDED == TRUE)
|
#if (BTC_AV_INCLUDED == TRUE)
|
||||||
bool open_fail;
|
extern bool g_av_open_fail;
|
||||||
bool av_with_rc;
|
extern bool g_av_with_rc;
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Type definitions for callback functions
|
** Type definitions for callback functions
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user