From: wangmengyang Date: Wed, 1 Mar 2017 09:37:39 +0000 (+0800) Subject: component/bt: transport btif_sm module X-Git-Tag: v2.1-rc1~196^2~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8464e0f61024eb41e94f486951145acd0136d3c;p=esp-idf component/bt: transport btif_sm module --- diff --git a/components/bt/bluedroid/btif/btif_sm.c b/components/bt/bluedroid/btc/core/btc_sm.c similarity index 59% rename from components/bt/bluedroid/btif/btif_sm.c rename to components/bt/bluedroid/btc/core/btc_sm.c index 19f33af119..82254871c6 100644 --- a/components/bt/bluedroid/btif/btif_sm.c +++ b/components/bt/bluedroid/btc/core/btc_sm.c @@ -1,51 +1,42 @@ -/****************************************************************************** - * - * Copyright (C) 2009-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. /***************************************************************************** * - * Filename: btif_sm.c + * Filename: btc_sm.c * - * Description: Generic BTIF state machine API + * Description: Generic BTC state machine API * *****************************************************************************/ -#define LOG_TAG "bt_btif" - -// #include #include "bt_defs.h" #include "allocator.h" #include "btif_common.h" -#include "btif_sm.h" +#include "btc_sm.h" #include "gki.h" /***************************************************************************** ** Constants & Macros ******************************************************************************/ - - /***************************************************************************** ** Local type definitions ******************************************************************************/ typedef struct { - btif_sm_state_t state; - btif_sm_handler_t *p_handlers; -} btif_sm_cb_t; + btc_sm_state_t state; + btc_sm_handler_t *p_handlers; +} btc_sm_cb_t; /***************************************************************************** ** Static variables @@ -65,51 +56,51 @@ typedef struct { /***************************************************************************** ** -** Function btif_sm_init +** Function btc_sm_init ** ** Description Initializes the state machine with the state handlers ** The caller should ensure that the table and the corresponding ** states match. The location that 'p_handlers' points to shall -** be available until the btif_sm_shutdown API is invoked. +** be available until the btc_sm_shutdown API is invoked. ** ** Returns Returns a pointer to the initialized state machine handle. ** ******************************************************************************/ -btif_sm_handle_t btif_sm_init(const btif_sm_handler_t *p_handlers, btif_sm_state_t initial_state) +btc_sm_handle_t btc_sm_init(const btc_sm_handler_t *p_handlers, btc_sm_state_t initial_state) { - btif_sm_cb_t *p_cb; + btc_sm_cb_t *p_cb; if (p_handlers == NULL) { - BTIF_TRACE_ERROR("%s : p_handlers is NULL", __FUNCTION__); + LOG_ERROR("%s : p_handlers is NULL", __FUNCTION__); return NULL; } - p_cb = (btif_sm_cb_t *)osi_malloc(sizeof(btif_sm_cb_t)); + p_cb = (btc_sm_cb_t *)osi_malloc(sizeof(btc_sm_cb_t)); p_cb->state = initial_state; - p_cb->p_handlers = (btif_sm_handler_t *)p_handlers; + p_cb->p_handlers = (btc_sm_handler_t *)p_handlers; - /* Send BTIF_SM_ENTER_EVT to the initial state */ - p_cb->p_handlers[initial_state](BTIF_SM_ENTER_EVT, NULL); + /* Send BTC_SM_ENTER_EVT to the initial state */ + p_cb->p_handlers[initial_state](BTC_SM_ENTER_EVT, NULL); - return (btif_sm_handle_t)p_cb; + return (btc_sm_handle_t)p_cb; } /***************************************************************************** ** -** Function btif_sm_shutdown +** Function btc_sm_shutdown ** ** Description Tears down the state machine ** ** Returns None ** ******************************************************************************/ -void btif_sm_shutdown(btif_sm_handle_t handle) +void btc_sm_shutdown(btc_sm_handle_t handle) { - btif_sm_cb_t *p_cb = (btif_sm_cb_t *)handle; + btc_sm_cb_t *p_cb = (btc_sm_cb_t *)handle; if (p_cb == NULL) { - BTIF_TRACE_ERROR("%s : Invalid handle", __FUNCTION__); + LOG_ERROR("%s : Invalid handle", __FUNCTION__); return; } osi_free(p_cb); @@ -117,19 +108,19 @@ void btif_sm_shutdown(btif_sm_handle_t handle) /***************************************************************************** ** -** Function btif_sm_get_state +** Function btc_sm_get_state ** ** Description Fetches the current state of the state machine ** ** Returns Current state ** ******************************************************************************/ -btif_sm_state_t btif_sm_get_state(btif_sm_handle_t handle) +btc_sm_state_t btc_sm_get_state(btc_sm_handle_t handle) { - btif_sm_cb_t *p_cb = (btif_sm_cb_t *)handle; + btc_sm_cb_t *p_cb = (btc_sm_cb_t *)handle; if (p_cb == NULL) { - BTIF_TRACE_ERROR("%s : Invalid handle", __FUNCTION__); + LOG_ERROR("%s : Invalid handle", __FUNCTION__); return 0; } @@ -138,7 +129,7 @@ btif_sm_state_t btif_sm_get_state(btif_sm_handle_t handle) /***************************************************************************** ** -** Function btif_sm_dispatch +** Function btc_sm_dispatch ** ** Description Dispatches the 'event' along with 'data' to the current state handler ** @@ -147,15 +138,15 @@ btif_sm_state_t btif_sm_get_state(btif_sm_handle_t handle) ** BT_STATUS_FAIL otherwise ** ******************************************************************************/ -bt_status_t btif_sm_dispatch(btif_sm_handle_t handle, btif_sm_event_t event, +bt_status_t btc_sm_dispatch(btc_sm_handle_t handle, btc_sm_event_t event, void *data) { bt_status_t status = BT_STATUS_SUCCESS; - btif_sm_cb_t *p_cb = (btif_sm_cb_t *)handle; + btc_sm_cb_t *p_cb = (btc_sm_cb_t *)handle; if (p_cb == NULL) { - BTIF_TRACE_ERROR("%s : Invalid handle", __FUNCTION__); + LOG_ERROR("%s : Invalid handle", __FUNCTION__); return BT_STATUS_FAIL; } @@ -168,29 +159,29 @@ bt_status_t btif_sm_dispatch(btif_sm_handle_t handle, btif_sm_event_t event, /***************************************************************************** ** -** Function btif_sm_change_state +** Function btc_sm_change_state ** -** Description Make a transition to the new 'state'. The 'BTIF_SM_EXIT_EVT' +** Description Make a transition to the new 'state'. The 'BTC_SM_EXIT_EVT' ** shall be invoked before exiting the current state. The -** 'BTIF_SM_ENTER_EVT' shall be invoked before entering the new state +** 'BTC_SM_ENTER_EVT' shall be invoked before entering the new state ** ** Returns BT_STATUS_SUCCESS on success ** BT_STATUS_UNHANDLED if event was not processed ** BT_STATUS_FAIL otherwise ** ******************************************************************************/ -bt_status_t btif_sm_change_state(btif_sm_handle_t handle, btif_sm_state_t state) +bt_status_t btc_sm_change_state(btc_sm_handle_t handle, btc_sm_state_t state) { bt_status_t status = BT_STATUS_SUCCESS; - btif_sm_cb_t *p_cb = (btif_sm_cb_t *)handle; + btc_sm_cb_t *p_cb = (btc_sm_cb_t *)handle; if (p_cb == NULL) { - BTIF_TRACE_ERROR("%s : Invalid handle", __FUNCTION__); + LOG_ERROR("%s : Invalid handle", __FUNCTION__); return BT_STATUS_FAIL; } /* Send exit event to the current state */ - if (p_cb->p_handlers[p_cb->state](BTIF_SM_EXIT_EVT, NULL) == FALSE) { + if (p_cb->p_handlers[p_cb->state](BTC_SM_EXIT_EVT, NULL) == FALSE) { status = BT_STATUS_UNHANDLED; } @@ -198,7 +189,7 @@ bt_status_t btif_sm_change_state(btif_sm_handle_t handle, btif_sm_state_t state) p_cb->state = state; /* Send enter event to the new state */ - if (p_cb->p_handlers[p_cb->state](BTIF_SM_ENTER_EVT, NULL) == FALSE) { + if (p_cb->p_handlers[p_cb->state](BTC_SM_ENTER_EVT, NULL) == FALSE) { status = BT_STATUS_UNHANDLED; } diff --git a/components/bt/bluedroid/btif/include/btif_sm.h b/components/bt/bluedroid/btc/include/btc_sm.h similarity index 56% rename from components/bt/bluedroid/btif/include/btif_sm.h rename to components/bt/bluedroid/btc/include/btc_sm.h index 96b3ba8005..abba9ae637 100644 --- a/components/bt/bluedroid/btif/include/btif_sm.h +++ b/components/bt/bluedroid/btc/include/btc_sm.h @@ -1,48 +1,45 @@ -/****************************************************************************** - * - * Copyright (C) 2009-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + /***************************************************************************** * - * Filename: btif_sm.h + * Filename: btc_sm.h * - * Description: Generic BTIF state machine API + * Description: Generic BTC state machine API * *****************************************************************************/ -#ifndef BTIF_SM_H -#define BTIF_SM_H +#ifndef __BTC_SM_H__ +#define __BTC_SM_H__ /***************************************************************************** ** Constants & Macros ******************************************************************************/ /* Generic Enter/Exit state machine events */ -#define BTIF_SM_ENTER_EVT 0xFFFF -#define BTIF_SM_EXIT_EVT 0xFFFE +#define BTC_SM_ENTER_EVT 0xFFFF +#define BTC_SM_EXIT_EVT 0xFFFE /***************************************************************************** ** Type definitions and return values ******************************************************************************/ -typedef UINT32 btif_sm_state_t; -typedef UINT32 btif_sm_event_t; -typedef void *btif_sm_handle_t; -typedef BOOLEAN(*btif_sm_handler_t)(btif_sm_event_t event, void *data); +typedef UINT32 btc_sm_state_t; +typedef UINT32 btc_sm_event_t; +typedef void *btc_sm_handle_t; +typedef BOOLEAN (* btc_sm_handler_t)(btc_sm_event_t event, void *data); /***************************************************************************** @@ -54,65 +51,65 @@ typedef BOOLEAN(*btif_sm_handler_t)(btif_sm_event_t event, void *data); /***************************************************************************** ** -** Function btif_sm_init +** Function btc_sm_init ** ** Description Initializes the state machine with the state handlers ** The caller should ensure that the table and the corresponding ** states match. The location that 'p_handlers' points to shall -** be available until the btif_sm_shutdown API is invoked. +** be available until the btc_sm_shutdown API is invoked. ** ** Returns Returns a pointer to the initialized state machine handle. ** ******************************************************************************/ -btif_sm_handle_t btif_sm_init(const btif_sm_handler_t *p_handlers, - btif_sm_state_t initial_state); +btc_sm_handle_t btc_sm_init(const btc_sm_handler_t *p_handlers, + btc_sm_state_t initial_state); /***************************************************************************** ** -** Function btif_sm_shutdown +** Function btc_sm_shutdown ** ** Description Tears down the state machine ** ** Returns None ** ******************************************************************************/ -void btif_sm_shutdown(btif_sm_handle_t handle); +void btc_sm_shutdown(btc_sm_handle_t handle); /***************************************************************************** ** -** Function btif_sm_get_state +** Function btc_sm_get_state ** ** Description Fetches the current state of the state machine ** ** Returns Current state ** ******************************************************************************/ -btif_sm_state_t btif_sm_get_state(btif_sm_handle_t handle); +btc_sm_state_t btc_sm_get_state(btc_sm_handle_t handle); /***************************************************************************** ** -** Function btif_sm_dispatch +** Function btc_sm_dispatch ** ** Description Dispatches the 'event' along with 'data' to the current state handler ** ** Returns Returns BT_STATUS_OK on success, BT_STATUS_FAIL otherwise ** ******************************************************************************/ -bt_status_t btif_sm_dispatch(btif_sm_handle_t handle, btif_sm_event_t event, +bt_status_t btc_sm_dispatch(btc_sm_handle_t handle, btc_sm_event_t event, void *data); /***************************************************************************** ** -** Function btif_sm_change_state +** Function btc_sm_change_state ** -** Description Make a transition to the new 'state'. The 'BTIF_SM_EXIT_EVT' +** Description Make a transition to the new 'state'. The 'BTC_SM_EXIT_EVT' ** shall be invoked before exiting the current state. The -** 'BTIF_SM_ENTER_EVT' shall be invoked before entering the new state +** 'BTC_SM_ENTER_EVT' shall be invoked before entering the new state ** ** ** Returns Returns BT_STATUS_OK on success, BT_STATUS_FAIL otherwise ** ******************************************************************************/ -bt_status_t btif_sm_change_state(btif_sm_handle_t handle, btif_sm_state_t state); +bt_status_t btc_sm_change_state(btc_sm_handle_t handle, btc_sm_state_t state); -#endif /* BTIF_SM_H */ +#endif /* __BTC_SM_H__ */ diff --git a/components/bt/bluedroid/btc/profile/std/a2dp/btc_avk.c b/components/bt/bluedroid/btc/profile/std/a2dp/btc_avk.c index 3db29111da..88a96bf7e5 100644 --- a/components/bt/bluedroid/btc/profile/std/a2dp/btc_avk.c +++ b/components/bt/bluedroid/btc/profile/std/a2dp/btc_avk.c @@ -70,7 +70,7 @@ typedef enum { typedef struct { tBTA_AV_HNDL bta_handle; bt_bdaddr_t peer_bda; - btif_sm_handle_t sm_handle; + btc_sm_handle_t sm_handle; UINT8 flags; tBTA_AV_EDR edr; UINT8 peer_sep; /* sep type of peer device */ @@ -121,13 +121,13 @@ else\ btc_rc_handler(e, d);\ }break; \ -static BOOLEAN btc_av_state_idle_handler(btif_sm_event_t event, void *data); -static BOOLEAN btc_av_state_opening_handler(btif_sm_event_t event, void *data); -static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *data); -static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *data); -static BOOLEAN btc_av_state_closing_handler(btif_sm_event_t event, void *data); +static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *data); +static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *data); +static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *data); +static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *data); +static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *data); -static const btif_sm_handler_t btc_av_state_handlers[] = { +static const btc_sm_handler_t btc_av_state_handlers[] = { btc_av_state_idle_handler, btc_av_state_opening_handler, btc_av_state_opened_handler, @@ -135,7 +135,7 @@ static const btif_sm_handler_t btc_av_state_handlers[] = { btc_av_state_closing_handler }; -static void btc_av_event_free_data(btif_sm_event_t event, void *p_data); +static void btc_av_event_free_data(btc_sm_event_t event, void *p_data); /************************************************************************* ** Extern functions @@ -181,8 +181,8 @@ static const char *dump_av_sm_event_name(btc_av_sm_event_t event) CASE_RETURN_STR(BTA_AV_META_MSG_EVT) CASE_RETURN_STR(BTA_AV_REJECT_EVT) CASE_RETURN_STR(BTA_AV_RC_FEAT_EVT) - CASE_RETURN_STR(BTIF_SM_ENTER_EVT) - CASE_RETURN_STR(BTIF_SM_EXIT_EVT) + CASE_RETURN_STR(BTC_SM_ENTER_EVT) + CASE_RETURN_STR(BTC_SM_EXIT_EVT) CASE_RETURN_STR(BTC_AV_CONNECT_REQ_EVT) CASE_RETURN_STR(BTC_AV_DISCONNECT_REQ_EVT) CASE_RETURN_STR(BTC_AV_START_STREAM_REQ_EVT) @@ -219,7 +219,7 @@ static void btc_initiate_av_open_tmr_hdlr(TIMER_LIST_ENT *tle) /* In case of AVRCP connection request, we will initiate SRC connection */ connect_req.target_bda = (bt_bdaddr_t *)&peer_addr; connect_req.uuid = UUID_SERVCLASS_AUDIO_SOURCE; - btif_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_CONNECT_REQ_EVT, (char *)&connect_req); + btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_CONNECT_REQ_EVT, (char *)&connect_req); } else { LOG_ERROR("%s No connected RC peers", __FUNCTION__); } @@ -266,13 +266,13 @@ static void btc_report_audio_state(esp_a2d_audio_state_t state, bt_bdaddr_t *bd_ ** *******************************************************************************/ -static BOOLEAN btc_av_state_idle_handler(btif_sm_event_t event, void *p_data) +static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data) { LOG_DEBUG("%s event:%s flags %x\n", __FUNCTION__, dump_av_sm_event_name(event), btc_av_cb.flags); switch (event) { - case BTIF_SM_ENTER_EVT: + case BTC_SM_ENTER_EVT: /* clear the peer_bda */ memset(&btc_av_cb.peer_bda, 0, sizeof(bt_bdaddr_t)); btc_av_cb.flags = 0; @@ -280,7 +280,7 @@ static BOOLEAN btc_av_state_idle_handler(btif_sm_event_t event, void *p_data) btif_a2dp_on_idle(); break; - case BTIF_SM_EXIT_EVT: + case BTC_SM_EXIT_EVT: break; case BTA_AV_ENABLE_EVT: @@ -302,7 +302,7 @@ static BOOLEAN btc_av_state_idle_handler(btif_sm_event_t event, void *p_data) BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle, TRUE, BTA_SEC_AUTHENTICATE, UUID_SERVCLASS_AUDIO_SOURCE); } - btif_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENING); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENING); } break; case BTA_AV_RC_OPEN_EVT: @@ -360,30 +360,30 @@ static BOOLEAN btc_av_state_idle_handler(btif_sm_event_t event, void *p_data) ** *******************************************************************************/ -static BOOLEAN btc_av_state_opening_handler(btif_sm_event_t event, void *p_data) +static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data) { LOG_DEBUG("%s event:%s flags %x\n", __FUNCTION__, dump_av_sm_event_name(event), btc_av_cb.flags); switch (event) { - case BTIF_SM_ENTER_EVT: + case BTC_SM_ENTER_EVT: /* inform the application that we are entering connecting state */ btc_report_connection_state(ESP_A2D_CONNECTION_STATE_CONNECTING, &(btc_av_cb.peer_bda), 0); break; - case BTIF_SM_EXIT_EVT: + case BTC_SM_EXIT_EVT: break; case BTA_AV_REJECT_EVT: LOG_DEBUG(" Received BTA_AV_REJECT_EVT \n"); btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), 0); - btif_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; case BTA_AV_OPEN_EVT: { tBTA_AV *p_bta_data = (tBTA_AV *)p_data; esp_a2d_connection_state_t state; - btif_sm_state_t av_state; + btc_sm_state_t av_state; LOG_DEBUG("status:%d, edr 0x%x\n", p_bta_data->open.status, p_bta_data->open.edr); @@ -404,7 +404,7 @@ static BOOLEAN btc_av_state_opening_handler(btif_sm_event_t event, void *p_data) /* inform the application of the event */ btc_report_connection_state(state, &(btc_av_cb.peer_bda), 0); /* change state to open/idle based on the status */ - btif_sm_change_state(btc_av_cb.sm_handle, av_state); + btc_sm_change_state(btc_av_cb.sm_handle, av_state); if (btc_av_cb.peer_sep == AVDT_TSEP_SNK) { /* if queued PLAY command, send it now */ btc_rc_check_handle_pending_play(p_bta_data->open.bd_addr, @@ -476,13 +476,13 @@ static BOOLEAN btc_av_state_opening_handler(btif_sm_event_t event, void *p_data) ** *******************************************************************************/ -static BOOLEAN btc_av_state_closing_handler(btif_sm_event_t event, void *p_data) +static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data) { LOG_DEBUG("%s event:%s flags %x\n", __FUNCTION__, dump_av_sm_event_name(event), btc_av_cb.flags); switch (event) { - case BTIF_SM_ENTER_EVT: + case BTC_SM_ENTER_EVT: if (btc_av_cb.peer_sep == AVDT_TSEP_SRC) { btif_a2dp_set_rx_flush(TRUE); } @@ -497,7 +497,7 @@ static BOOLEAN btc_av_state_closing_handler(btif_sm_event_t event, void *p_data) btif_a2dp_on_stopped(NULL); break; - case BTIF_SM_EXIT_EVT: + case BTC_SM_EXIT_EVT: break; case BTA_AV_CLOSE_EVT: { @@ -506,7 +506,7 @@ static BOOLEAN btc_av_state_closing_handler(btif_sm_event_t event, void *p_data) btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), close->disc_rsn); - btif_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; } @@ -534,7 +534,7 @@ static BOOLEAN btc_av_state_closing_handler(btif_sm_event_t event, void *p_data) ** *******************************************************************************/ -static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *p_data) +static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data) { tBTA_AV *p_av = (tBTA_AV *)p_data; @@ -548,12 +548,12 @@ static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *p_data) } switch (event) { - case BTIF_SM_ENTER_EVT: + case BTC_SM_ENTER_EVT: btc_av_cb.flags &= ~BTC_AV_FLAG_PENDING_STOP; btc_av_cb.flags &= ~BTC_AV_FLAG_PENDING_START; break; - case BTIF_SM_EXIT_EVT: + case BTC_SM_EXIT_EVT: btc_av_cb.flags &= ~BTC_AV_FLAG_PENDING_START; break; @@ -584,7 +584,7 @@ static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *p_data) /* pending start flag will be cleared when exit current state */ } - btif_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_STARTED); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_STARTED); } break; @@ -611,7 +611,7 @@ static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *p_data) if (btc_av_cb.flags & BTC_AV_FLAG_PENDING_START) { /* pending start flag will be cleared when exit current state */ } - btif_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; } @@ -658,7 +658,7 @@ static BOOLEAN btc_av_state_opened_handler(btif_sm_event_t event, void *p_data) ** *******************************************************************************/ -static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) +static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data) { tBTA_AV *p_av = (tBTA_AV *)p_data; @@ -666,7 +666,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) dump_av_sm_event_name(event), btc_av_cb.flags); switch (event) { - case BTIF_SM_ENTER_EVT: + case BTC_SM_ENTER_EVT: /* we are again in started state, clear any remote suspend flags */ btc_av_cb.flags &= ~BTC_AV_FLAG_REMOTE_SUSPEND; @@ -679,7 +679,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) break; - case BTIF_SM_EXIT_EVT: + case BTC_SM_EXIT_EVT: /* restore the a2dp consumer task priority when stop audio playing. */ adjust_priority_a2dp(FALSE); @@ -720,7 +720,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTING, &(btc_av_cb.peer_bda), 0); /* wait in closing state until fully closed */ - btif_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_CLOSING); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_CLOSING); break; case BTA_AV_SUSPEND_EVT: @@ -753,7 +753,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) btc_report_audio_state(ESP_A2D_AUDIO_STATE_STOPPED, &(btc_av_cb.peer_bda)); } - btif_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENED); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENED); /* suspend completed and state changed, clear pending status */ btc_av_cb.flags &= ~BTC_AV_FLAG_LOCAL_SUSPEND_PENDING; @@ -768,7 +768,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) /* if stop was successful, change state to open */ if (p_av->suspend.status == BTA_AV_SUCCESS) { - btif_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENED); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENED); } break; @@ -785,7 +785,7 @@ static BOOLEAN btc_av_state_started_handler(btif_sm_event_t event, void *p_data) btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), close->disc_rsn); - btif_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; } @@ -842,7 +842,7 @@ void btc_av_event_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src) } } -static void btc_av_event_free_data(btif_sm_event_t event, void *p_data) +static void btc_av_event_free_data(btc_sm_event_t event, void *p_data) { switch (event) { case BTA_AV_META_MSG_EVT: { @@ -882,13 +882,13 @@ static void bte_av_callback(tBTA_AV_EVT event, tBTA_AV *p_data) static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data) { - btif_sm_state_t state; + btc_sm_state_t state; UINT8 que_len; tA2D_STATUS a2d_status; tA2D_SBC_CIE sbc_cie; if (event == BTA_AV_MEDIA_DATA_EVT) { /* Switch to BTIF_MEDIA context */ - state = btif_sm_get_state(btc_av_cb.sm_handle); + state = btc_sm_get_state(btc_av_cb.sm_handle); if ( (state == BTC_AV_STATE_STARTED) || /* send SBC packets only in Started State */ (state == BTC_AV_STATE_OPENED) ) { que_len = btif_media_sink_enque_buf((BT_HDR *)p_data); @@ -940,7 +940,7 @@ bt_status_t btc_av_init() /* Also initialize the AV state machine */ btc_av_cb.sm_handle = - btif_sm_init((const btif_sm_handler_t *)btc_av_state_handlers, BTC_AV_STATE_IDLE); + btc_sm_init((const btc_sm_handler_t *)btc_av_state_handlers, BTC_AV_STATE_IDLE); btc_dm_enable_service(BTA_A2DP_SOURCE_SERVICE_ID); #if (BTA_AV_SINK_INCLUDED == TRUE) @@ -1004,7 +1004,7 @@ static bt_status_t connect_int(bt_bdaddr_t *bd_addr, uint16_t uuid) connect_req.uuid = uuid; LOG_INFO("%s\n", __FUNCTION__); - btif_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_CONNECT_REQ_EVT, (char *)&connect_req); + btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_CONNECT_REQ_EVT, (char *)&connect_req); return BT_STATUS_SUCCESS; } @@ -1062,7 +1062,7 @@ static void cleanup(void) #endif /* Also shut down the AV state machine */ - btif_sm_shutdown(btc_av_cb.sm_handle); + btc_sm_shutdown(btc_av_cb.sm_handle); btc_av_cb.sm_handle = NULL; } @@ -1086,7 +1086,7 @@ void esp_a2d_sink_deinit(void) ** *******************************************************************************/ -btif_sm_handle_t btc_av_get_sm_handle(void) +btc_sm_handle_t btc_av_get_sm_handle(void) { return btc_av_cb.sm_handle; } @@ -1103,7 +1103,7 @@ btif_sm_handle_t btc_av_get_sm_handle(void) BOOLEAN btc_av_stream_ready(void) { - btif_sm_state_t state = btif_sm_get_state(btc_av_cb.sm_handle); + btc_sm_state_t state = btc_sm_get_state(btc_av_cb.sm_handle); LOG_DEBUG("btc_av_stream_ready : sm hdl %d, state %d, flags %x\n", (int)btc_av_cb.sm_handle, state, btc_av_cb.flags); @@ -1134,7 +1134,7 @@ BOOLEAN btc_av_stream_ready(void) BOOLEAN btc_av_stream_started_ready(void) { - btif_sm_state_t state = btif_sm_get_state(btc_av_cb.sm_handle); + btc_sm_state_t state = btc_sm_get_state(btc_av_cb.sm_handle); LOG_DEBUG("btc_av_stream_started : sm hdl %d, state %d, flags %x\n", (int)btc_av_cb.sm_handle, state, btc_av_cb.flags); @@ -1227,7 +1227,7 @@ bt_status_t btc_av_sink_execute_service(BOOLEAN b_enable) *******************************************************************************/ BOOLEAN btc_av_is_connected(void) { - btif_sm_state_t state = btif_sm_get_state(btc_av_cb.sm_handle); + btc_sm_state_t state = btc_sm_get_state(btc_av_cb.sm_handle); return ((state == BTC_AV_STATE_OPENED) || (state == BTC_AV_STATE_STARTED)); } @@ -1270,6 +1270,6 @@ void btc_av_clear_remote_suspend_flag(void) void btc_a2dp_evt_handler(btc_msg_t *msg) { - btif_sm_dispatch(btc_av_cb.sm_handle, msg->act, (void *)(msg->arg)); + btc_sm_dispatch(btc_av_cb.sm_handle, msg->act, (void *)(msg->arg)); btc_av_event_free_data(msg->act, msg->arg); } diff --git a/components/bt/bluedroid/btc/profile/std/include/btc_av.h b/components/bt/bluedroid/btc/profile/std/include/btc_av.h index a693198abb..0c0aa94c87 100644 --- a/components/bt/bluedroid/btc/profile/std/include/btc_av.h +++ b/components/bt/bluedroid/btc/profile/std/include/btc_av.h @@ -28,7 +28,7 @@ #include "esp_a2dp_api.h" #include "btc_task.h" #include "btif_common.h" -#include "btif_sm.h" +#include "btc_sm.h" #include "bta_av_api.h" @@ -71,7 +71,7 @@ void btc_a2dp_evt_handler(btc_msg_t *msg); ** *******************************************************************************/ -btif_sm_handle_t btc_av_get_sm_handle(void); +btc_sm_handle_t btc_av_get_sm_handle(void); /******************************************************************************* ** diff --git a/components/bt/bluedroid/btif/btif_media_task.c b/components/bt/bluedroid/btif/btif_media_task.c index cb42078070..cdaaa2fade 100644 --- a/components/bt/bluedroid/btif/btif_media_task.c +++ b/components/bt/bluedroid/btif/btif_media_task.c @@ -26,8 +26,6 @@ ** ******************************************************************************/ -#define LOG_TAG "bt_btif_media" - #include "bt_trace.h" #include #include @@ -58,7 +56,7 @@ #include "bt_defs.h" #include "btc_av.h" -#include "btif_sm.h" +#include "btc_sm.h" #include "btif_util.h" #if (BTA_AV_SINK_INCLUDED == TRUE) #include "oi_codec_sbc.h" @@ -336,24 +334,6 @@ UNUSED_ATTR static const char *dump_media_event(UINT16 event) } } -/***************************************************************************** - ** A2DP CTRL PATH - *****************************************************************************/ -#if 0 -// TODO: consider the necessity to add an API based on this function -static void btif_audiopath_detached(void) -{ - APPL_TRACE_EVENT("## AUDIO PATH DETACHED ##"); - - /* send stop request only if we are actively streaming and haven't received - a stop request. Potentially audioflinger detached abnormally */ - if (btif_media_cb.is_tx_timer) { - /* post stop event and wait for audio path to stop */ - btif_dispatch_sm_event(BTIF_AV_STOP_STREAM_REQ_EVT, NULL, 0); - } -} -#endif - /***************************************************************************** ** BTIF ADAPTATION *****************************************************************************/ diff --git a/components/bt/bluedroid/btif/include/bt_rc.h b/components/bt/bluedroid/btif/include/bt_rc.h deleted file mode 100755 index a0e7345ec4..0000000000 --- a/components/bt/bluedroid/btif/include/bt_rc.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __BT_RC_H__ -#define __BT_RC_H__ - -#include -#include -#include "bt_defs.h" - -/* Macros */ -#define BTRC_MAX_ATTR_STR_LEN 255 -#define BTRC_UID_SIZE 8 -#define BTRC_MAX_APP_SETTINGS 8 -#define BTRC_MAX_FOLDER_DEPTH 4 -#define BTRC_MAX_APP_ATTR_SIZE 16 -#define BTRC_MAX_ELEM_ATTR_SIZE 7 - -typedef uint8_t btrc_uid_t[BTRC_UID_SIZE]; - -typedef enum { - BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */ - BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */ - BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */ - BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */ -} btrc_remote_features_t; - -typedef enum { - BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */ - BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */ - BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */ - BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/ - BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/ - BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */ -} btrc_play_status_t; - -typedef enum { - BTRC_EVT_PLAY_STATUS_CHANGED = 0x01, - BTRC_EVT_TRACK_CHANGE = 0x02, - BTRC_EVT_TRACK_REACHED_END = 0x03, - BTRC_EVT_TRACK_REACHED_START = 0x04, - BTRC_EVT_PLAY_POS_CHANGED = 0x05, - BTRC_EVT_APP_SETTINGS_CHANGED = 0x08, -} btrc_event_id_t; - -typedef enum { - BTRC_NOTIFICATION_TYPE_INTERIM = 0, - BTRC_NOTIFICATION_TYPE_CHANGED = 1, -} btrc_notification_type_t; - -typedef enum { - BTRC_PLAYER_ATTR_EQUALIZER = 0x01, - BTRC_PLAYER_ATTR_REPEAT = 0x02, - BTRC_PLAYER_ATTR_SHUFFLE = 0x03, - BTRC_PLAYER_ATTR_SCAN = 0x04, -} btrc_player_attr_t; - -typedef enum { - BTRC_MEDIA_ATTR_TITLE = 0x01, - BTRC_MEDIA_ATTR_ARTIST = 0x02, - BTRC_MEDIA_ATTR_ALBUM = 0x03, - BTRC_MEDIA_ATTR_TRACK_NUM = 0x04, - BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05, - BTRC_MEDIA_ATTR_GENRE = 0x06, - BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07, -} btrc_media_attr_t; - -typedef enum { - BTRC_PLAYER_VAL_OFF_REPEAT = 0x01, - BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02, - BTRC_PLAYER_VAL_ALL_REPEAT = 0x03, - BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04 -} btrc_player_repeat_val_t; - -typedef enum { - BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01, - BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02, - BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03 -} btrc_player_shuffle_val_t; - -typedef enum { - BTRC_STS_BAD_CMD = 0x00, /* Invalid command */ - BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */ - BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */ - BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */ - BTRC_STS_NO_ERROR = 0x04 /* Operation Success */ -} btrc_status_t; - -typedef struct { - uint8_t num_attr; - uint8_t attr_ids[BTRC_MAX_APP_SETTINGS]; - uint8_t attr_values[BTRC_MAX_APP_SETTINGS]; -} btrc_player_settings_t; - -typedef union -{ - btrc_play_status_t play_status; - btrc_uid_t track; /* queue position in NowPlaying */ - uint32_t song_pos; - btrc_player_settings_t player_setting; -} btrc_register_notification_t; - -typedef struct { - uint8_t id; /* can be attr_id or value_id */ - uint8_t text[BTRC_MAX_ATTR_STR_LEN]; -} btrc_player_setting_text_t; - -typedef struct { - uint32_t attr_id; - uint8_t text[BTRC_MAX_ATTR_STR_LEN]; -} btrc_element_attr_val_t; - -/** Callback for the controller's supported feautres */ -typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr, - btrc_remote_features_t features); - -/** Callback for play status request */ -typedef void (* btrc_get_play_status_callback)(); - -/** Callback for list player application attributes (Shuffle, Repeat,...) */ -typedef void (* btrc_list_player_app_attr_callback)(); - -/** Callback for list player application attributes (Shuffle, Repeat,...) */ -typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id); - -/** Callback for getting the current player application settings value -** num_attr: specifies the number of attribute ids contained in p_attrs -*/ -typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs); - -/** Callback for getting the player application settings attributes' text -** num_attr: specifies the number of attribute ids contained in p_attrs -*/ -typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs); - -/** Callback for getting the player application settings values' text -** num_attr: specifies the number of value ids contained in p_vals -*/ -typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val, uint8_t *p_vals); - -/** Callback for setting the player application settings values */ -typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals); - -/** Callback to fetch the get element attributes of the current song -** num_attr: specifies the number of attributes requested in p_attrs -*/ -typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs); - -/** Callback for register notification (Play state change/track change/...) -** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED -*/ -typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param); - -/* AVRCP 1.4 Enhancements */ -/** Callback for volume change on CT -** volume: Current volume setting on the CT (0-127) -*/ -typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype); - -/** Callback for passthrough commands */ -typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state); - -/** BT-RC Target callback structure. */ -typedef struct { - /** set to sizeof(BtRcCallbacks) */ - size_t size; - btrc_remote_features_callback remote_features_cb; - btrc_get_play_status_callback get_play_status_cb; - btrc_list_player_app_attr_callback list_player_app_attr_cb; - btrc_list_player_app_values_callback list_player_app_values_cb; - btrc_get_player_app_value_callback get_player_app_value_cb; - btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb; - btrc_get_player_app_values_text_callback get_player_app_values_text_cb; - btrc_set_player_app_value_callback set_player_app_value_cb; - btrc_get_element_attr_callback get_element_attr_cb; - btrc_register_notification_callback register_notification_cb; - btrc_volume_change_callback volume_change_cb; - btrc_passthrough_cmd_callback passthrough_cmd_cb; -} btrc_callbacks_t; - -/** Represents the standard BT-RC AVRCP Target interface. */ -typedef struct { - - /** set to sizeof(BtRcInterface) */ - size_t size; - /** - * Register the BtRc callbacks - */ - bt_status_t (*init)( btrc_callbacks_t* callbacks ); - - /** Respose to GetPlayStatus request. Contains the current - ** 1. Play status - ** 2. Song duration/length - ** 3. Song position - */ - bt_status_t (*get_play_status_rsp)( btrc_play_status_t play_status, uint32_t song_len, uint32_t song_pos); - - /** Lists the support player application attributes (Shuffle/Repeat/...) - ** num_attr: Specifies the number of attributes contained in the pointer p_attrs - */ - bt_status_t (*list_player_app_attr_rsp)( int num_attr, btrc_player_attr_t *p_attrs); - - /** Lists the support player application attributes (Shuffle Off/On/Group) - ** num_val: Specifies the number of values contained in the pointer p_vals - */ - bt_status_t (*list_player_app_value_rsp)( int num_val, uint8_t *p_vals); - - /** Returns the current application attribute values for each of the specified attr_id */ - bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals); - - /** Returns the application attributes text ("Shuffle"/"Repeat"/...) - ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs - */ - bt_status_t (*get_player_app_attr_text_rsp)( int num_attr, btrc_player_setting_text_t *p_attrs); - - /** Returns the application attributes text ("Shuffle"/"Repeat"/...) - ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals - */ - bt_status_t (*get_player_app_value_text_rsp)( int num_val, btrc_player_setting_text_t *p_vals); - - /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist") - ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs - */ - bt_status_t (*get_element_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs); - - /** Response to set player attribute request ("Shuffle"/"Repeat") - ** rsp_status: Status of setting the player attributes for the current media player - */ - bt_status_t (*set_player_app_value_rsp)(btrc_status_t rsp_status); - - /* Response to the register notification request (Play state change/track change/...). - ** event_id: Refers to the event_id this notification change corresponds too - ** type: Response type - interim/changed - ** p_params: Based on the event_id, this parameter should be populated - */ - bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id, - btrc_notification_type_t type, - btrc_register_notification_t *p_param); - - /* AVRCP 1.4 enhancements */ - - /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume - ** This can be enhanced to support Relative Volume (AVRCP 1.0). - ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level - ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set - */ - bt_status_t (*set_volume)(uint8_t volume); - - /** Closes the interface. */ - void (*cleanup)( void ); -} btrc_interface_t; - - -typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state); - -typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr); - -/** BT-RC Controller callback structure. */ -typedef struct { - /** set to sizeof(BtRcCallbacks) */ - size_t size; - btrc_passthrough_rsp_callback passthrough_rsp_cb; - btrc_connection_state_callback connection_state_cb; -} btrc_ctrl_callbacks_t; - -#endif /* __BT_RC_H__ */ diff --git a/components/bt/bluedroid/btif/include/btif_av.h b/components/bt/bluedroid/btif/include/btif_av.h deleted file mode 100644 index cedc1b7fe6..0000000000 --- a/components/bt/bluedroid/btif/include/btif_av.h +++ /dev/null @@ -1,154 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2009-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/******************************************************************************* - * - * Filename: btif_av.h - * - * Description: Main API header file for all BTIF AV functions accessed - * from internal stack. - * - *******************************************************************************/ - -#ifndef BTIF_AV_H -#define BTIF_AV_H - -#include "btif_common.h" -#include "btif_sm.h" -#include "bta_av_api.h" - - -/******************************************************************************* -** Type definitions for callback functions -********************************************************************************/ - -typedef enum { - /* Reuse BTA_AV_XXX_EVT - No need to redefine them here */ - BTIF_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT, - BTIF_AV_DISCONNECT_REQ_EVT, - BTIF_AV_START_STREAM_REQ_EVT, - BTIF_AV_STOP_STREAM_REQ_EVT, - BTIF_AV_SUSPEND_STREAM_REQ_EVT, - BTIF_AV_SINK_CONFIG_REQ_EVT, -} btif_av_sm_event_t; - - -/******************************************************************************* -** BTIF AV API -********************************************************************************/ - -/******************************************************************************* -** -** Function btif_av_get_sm_handle -** -** Description Fetches current av SM handle -** -** Returns None -** -*******************************************************************************/ - -btif_sm_handle_t btif_av_get_sm_handle(void); - -/******************************************************************************* -** -** Function btif_av_stream_ready -** -** Description Checks whether AV is ready for starting a stream -** -** Returns None -** -*******************************************************************************/ - -BOOLEAN btif_av_stream_ready(void); - -/******************************************************************************* -** -** Function btif_av_stream_started_ready -** -** Description Checks whether AV ready for media start in streaming state -** -** Returns None -** -*******************************************************************************/ - -BOOLEAN btif_av_stream_started_ready(void); - -/******************************************************************************* -** -** Function btif_dispatch_sm_event -** -** Description Send event to AV statemachine -** -** Returns None -** -*******************************************************************************/ - -/* used to pass events to AV statemachine from other tasks */ -void btif_dispatch_sm_event(btif_av_sm_event_t event, void *p_data, int len); - -/******************************************************************************* -** -** Function btif_av_init -** -** Description Initializes btif AV if not already done -** -** Returns bt_status_t -** -*******************************************************************************/ - -bt_status_t btif_av_init(void); - -/******************************************************************************* -** -** Function btif_av_is_connected -** -** Description Checks if av has a connected sink -** -** Returns BOOLEAN -** -*******************************************************************************/ - -BOOLEAN btif_av_is_connected(void); - - -/******************************************************************************* -** -** Function btif_av_is_peer_edr -** -** Description Check if the connected a2dp device supports -** EDR or not. Only when connected this function -** will accurately provide a true capability of -** remote peer. If not connected it will always be false. -** -** Returns TRUE if remote device is capable of EDR -** -*******************************************************************************/ - -BOOLEAN btif_av_is_peer_edr(void); - -/****************************************************************************** -** -** Function btif_av_clear_remote_suspend_flag -** -** Description Clears remote suspended flag -** -** Returns Void -********************************************************************************/ -void btif_av_clear_remote_suspend_flag(void); - -#endif /* BTIF_AV_H */ diff --git a/components/bt/bluedroid/btif/include/btif_profile_queue.h b/components/bt/bluedroid/btif/include/btif_profile_queue.h deleted file mode 100644 index f28daac5ec..0000000000 --- a/components/bt/bluedroid/btif/include/btif_profile_queue.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2009-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/******************************************************************************* - * - * Filename: btif_profile_queue.h - * - * Description: Bluetooth remote device connection queuing - * - *******************************************************************************/ - -#ifndef BTIF_PROFILE_QUEUE_H -#define BTIF_PROFILE_QUEUE_H - -typedef bt_status_t (*btif_connect_cb_t) (bt_bdaddr_t *bda, uint16_t uuid); - -bt_status_t btif_queue_connect(uint16_t uuid, const bt_bdaddr_t *bda, btif_connect_cb_t connect_cb); -void btif_queue_advance(); -bt_status_t btif_queue_connect_next(void); -void btif_queue_release(); - -#endif