component/bt: transport btif_avk module

This commit is contained in:
wangmengyang 2017-03-01 13:49:26 +08:00
parent a25cb988bb
commit b74eb56710
7 changed files with 1459 additions and 8 deletions

View file

@ -24,8 +24,8 @@ static tBTA_SERVICE_MASK btc_enabled_services = 0;
/******************************************************************************
** Externs
******************************************************************************/
extern bt_status_t btif_av_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_av_sink_execute_service(BOOLEAN b_enable);
extern bt_status_t btc_av_execute_service(BOOLEAN b_enable);
extern bt_status_t btc_av_sink_execute_service(BOOLEAN b_enable);
/******************************************************************************
** Functions
@ -190,10 +190,10 @@ static bt_status_t btc_in_execute_service_request(tBTA_SERVICE_ID service_id,
/* Check the service_ID and invoke the profile's BT state changed API */
switch (service_id) {
case BTA_A2DP_SOURCE_SERVICE_ID:
btif_av_execute_service(b_enable);
btc_av_execute_service(b_enable);
break;
case BTA_A2DP_SINK_SERVICE_ID:
btif_av_sink_execute_service(b_enable);
btc_av_sink_execute_service(b_enable);
break;
default:
LOG_ERROR("%s: Unknown service being enabled\n", __FUNCTION__);

View file

@ -27,6 +27,7 @@
#include "btc_blufi_prf.h"
#include "btc_dm.h"
#include "btc_profile_queue.h"
#include "btc_av.h"
#include "bta_gatt_api.h"
@ -46,7 +47,8 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_SPPLIKE] = {NULL, NULL},
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
[BTC_PID_PRF_QUE] = {btc_profile_queue_handler, NULL}
[BTC_PID_PRF_QUE] = {btc_profile_queue_handler, NULL },
[BTC_PID_A2DP] = {btc_a2dp_evt_handler, btc_a2dp_evt_handler }
};
/*****************************************************************************

View file

@ -47,6 +47,7 @@ typedef enum {
BTC_PID_BLUFI,
BTC_PID_DM_SEC,
BTC_PID_PRF_QUE,
BTC_PID_A2DP,
BTC_PID_NUM,
} btc_pid_t; //btc profile id

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,163 @@
// 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: btc_av.h
*
* Description: Main API header file for all BTC AV functions accessed
* from internal stack.
*
*******************************************************************************/
#ifndef __BTC_AV_H__
#define __BTC_AV_H__
#include "esp_a2dp_api.h"
#include "btc_task.h"
#include "btif_common.h"
#include "btif_sm.h"
#include "bta_av_api.h"
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
typedef enum {
BTC_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT,
BTC_AV_DISCONNECT_REQ_EVT,
BTC_AV_START_STREAM_REQ_EVT,
BTC_AV_STOP_STREAM_REQ_EVT,
BTC_AV_SUSPEND_STREAM_REQ_EVT,
BTC_AV_SINK_CONFIG_REQ_EVT
} btc_av_sm_event_t;
/* btc_av_args_t */
typedef union {
// BTC_AV_SINK_CONFIG_REQ_EVT
esp_a2d_mcc_t mcc;
// BTC_AV_DISCONNECT_REQ_EVT
bt_bdaddr_t disconnect;
// Event set--tBTA_AV_EVT
tBTA_AV data;
} btc_av_args_t;
/*******************************************************************************
** BTC AV API
********************************************************************************/
void btc_a2dp_evt_handler(btc_msg_t *msg);
/*******************************************************************************
**
** Function btc_av_get_sm_handle
**
** Description Fetches current av SM handle
**
** Returns None
**
*******************************************************************************/
btif_sm_handle_t btc_av_get_sm_handle(void);
/*******************************************************************************
**
** Function btc_av_stream_ready
**
** Description Checks whether AV is ready for starting a stream
**
** Returns None
**
*******************************************************************************/
BOOLEAN btc_av_stream_ready(void);
/*******************************************************************************
**
** Function btc_av_stream_started_ready
**
** Description Checks whether AV ready for media start in streaming state
**
** Returns None
**
*******************************************************************************/
BOOLEAN btc_av_stream_started_ready(void);
/*******************************************************************************
**
** Function btc_dispatch_sm_event
**
** Description Send event to AV statemachine
**
** Returns None
**
*******************************************************************************/
/* used to pass events to AV statemachine from other tasks */
void btc_dispatch_sm_event(btc_av_sm_event_t event, void *p_data, int len);
/*******************************************************************************
**
** Function btc_av_init
**
** Description Initializes btif AV if not already done
**
** Returns bt_status_t
**
*******************************************************************************/
bt_status_t btc_av_init(void);
/*******************************************************************************
**
** Function btc_av_is_connected
**
** Description Checks if av has a connected sink
**
** Returns BOOLEAN
**
*******************************************************************************/
BOOLEAN btc_av_is_connected(void);
/*******************************************************************************
**
** Function btc_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 btc_av_is_peer_edr(void);
/******************************************************************************
**
** Function btc_av_clear_remote_suspend_flag
**
** Description Clears remote suspended flag
**
** Returns Void
********************************************************************************/
void btc_av_clear_remote_suspend_flag(void);
#endif /* __BTC_AV_H__ */

View file

@ -964,13 +964,14 @@ bt_status_t btif_av_init()
* Returns bt_status_t
*
*/
#if 0
esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback)
{
// TODO: need protection against race
bt_av_sink_callback = callback;
return ESP_OK;
}
#endif /* #if 0 */
/*******************************************************************************
**
** Function init_sink
@ -980,6 +981,7 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback)
** Returns bt_status_t
**
*******************************************************************************/
#if 0
esp_err_t esp_a2d_sink_init(void)
{
BTIF_TRACE_EVENT("%s()\n", __func__);
@ -988,7 +990,7 @@ esp_err_t esp_a2d_sink_init(void)
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
#endif /* #endif */
/*******************************************************************************
**
** Function connect
@ -1011,6 +1013,7 @@ static bt_status_t connect_int(bt_bdaddr_t *bd_addr, uint16_t uuid)
return BT_STATUS_SUCCESS;
}
#if 0
esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda)
{
BTIF_TRACE_EVENT("%s\n", __FUNCTION__);
@ -1036,6 +1039,7 @@ esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda)
(char *)(&bd_addr), sizeof(bt_bdaddr_t), NULL);
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
#endif /* #if 0 */
/*******************************************************************************
**
** Function cleanup
@ -1061,6 +1065,7 @@ static void cleanup(void)
btif_av_cb.sm_handle = NULL;
}
#if 0
void esp_a2d_sink_deinit(void)
{
BTIF_TRACE_EVENT("%s\n", __FUNCTION__);
@ -1070,7 +1075,7 @@ void esp_a2d_sink_deinit(void)
cleanup();
}
}
#endif /* #if 0 */
/*******************************************************************************
**
** Function btif_av_get_sm_handle

View file

@ -67,6 +67,7 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \
bluedroid/btc/profile/esp/blufi \
bluedroid/btc/profile/std/gap \
bluedroid/btc/profile/std/gatt \
bluedroid/btc/profile/std/a2dp \
bluedroid/btc/profile \
bluedroid/stack/btm \
bluedroid/stack/btu \