mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
component/bt: transport bta_av_co.c
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* This is the advanced audio/video call-out function implementation for
|
* This is the advanced audio/video call-out function implementation for
|
||||||
* BTIF.
|
* BTC.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "bta_av_ci.h"
|
#include "bta_av_ci.h"
|
||||||
#include "bta_av_sbc.h"
|
#include "bta_av_sbc.h"
|
||||||
#include "btc_media.h"
|
#include "btc_media.h"
|
||||||
#include "btif_av_co.h"
|
#include "btc_av_co.h"
|
||||||
#include "btif_util.h"
|
#include "btif_util.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@@ -86,13 +86,13 @@ const tA2D_SBC_CIE bta_av_co_sbc_sink_caps = {
|
|||||||
A2D_SBC_IE_MIN_BITPOOL /* min_bitpool */
|
A2D_SBC_IE_MIN_BITPOOL /* min_bitpool */
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(BTIF_AV_SBC_DEFAULT_SAMP_FREQ)
|
#if !defined(BTC_AV_SBC_DEFAULT_SAMP_FREQ)
|
||||||
#define BTIF_AV_SBC_DEFAULT_SAMP_FREQ A2D_SBC_IE_SAMP_FREQ_44
|
#define BTC_AV_SBC_DEFAULT_SAMP_FREQ A2D_SBC_IE_SAMP_FREQ_44
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Default SBC codec configuration */
|
/* Default SBC codec configuration */
|
||||||
const tA2D_SBC_CIE btif_av_sbc_default_config = {
|
const tA2D_SBC_CIE btc_av_sbc_default_config = {
|
||||||
BTIF_AV_SBC_DEFAULT_SAMP_FREQ, /* samp_freq */
|
BTC_AV_SBC_DEFAULT_SAMP_FREQ, /* samp_freq */
|
||||||
A2D_SBC_IE_CH_MD_JOINT, /* ch_mode */
|
A2D_SBC_IE_CH_MD_JOINT, /* ch_mode */
|
||||||
A2D_SBC_IE_BLOCKS_16, /* block_len */
|
A2D_SBC_IE_BLOCKS_16, /* block_len */
|
||||||
A2D_SBC_IE_SUBBAND_8, /* num_subbands */
|
A2D_SBC_IE_SUBBAND_8, /* num_subbands */
|
||||||
@@ -116,8 +116,8 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BD_ADDR addr; /* address of audio/video peer */
|
BD_ADDR addr; /* address of audio/video peer */
|
||||||
tBTA_AV_CO_SINK snks[BTIF_SV_AV_AA_SEP_INDEX]; /* array of supported sinks */
|
tBTA_AV_CO_SINK snks[BTC_SV_AV_AA_SEP_INDEX]; /* array of supported sinks */
|
||||||
tBTA_AV_CO_SINK srcs[BTIF_SV_AV_AA_SEP_INDEX]; /* array of supported srcs */
|
tBTA_AV_CO_SINK srcs[BTC_SV_AV_AA_SEP_INDEX]; /* array of supported srcs */
|
||||||
UINT8 num_snks; /* total number of sinks at peer */
|
UINT8 num_snks; /* total number of sinks at peer */
|
||||||
UINT8 num_srcs; /* total number of srcs at peer */
|
UINT8 num_srcs; /* total number of srcs at peer */
|
||||||
UINT8 num_seps; /* total number of seids at peer */
|
UINT8 num_seps; /* total number of seids at peer */
|
||||||
@@ -277,7 +277,7 @@ BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_info, UINT8 *p_
|
|||||||
bta_av_co_cb.codec_cfg_setconfig.id = BTC_AV_CODEC_NONE;
|
bta_av_co_cb.codec_cfg_setconfig.id = BTC_AV_CODEC_NONE;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case BTIF_SV_AV_AA_SBC_INDEX:
|
case BTC_SV_AV_AA_SBC_INDEX:
|
||||||
#if defined(BTA_AV_CO_CP_SCMS_T) && (BTA_AV_CO_CP_SCMS_T == TRUE)
|
#if defined(BTA_AV_CO_CP_SCMS_T) && (BTA_AV_CO_CP_SCMS_T == TRUE)
|
||||||
{
|
{
|
||||||
UINT8 *p = p_protect_info;
|
UINT8 *p = p_protect_info;
|
||||||
@@ -298,7 +298,7 @@ BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_info, UINT8 *p_
|
|||||||
/* Codec is valid */
|
/* Codec is valid */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||||
case BTIF_SV_AV_AA_SBC_SINK_INDEX:
|
case BTC_SV_AV_AA_SBC_SINK_INDEX:
|
||||||
*p_codec_type = BTA_AV_CODEC_SBC;
|
*p_codec_type = BTA_AV_CODEC_SBC;
|
||||||
|
|
||||||
/* This should not fail because we are using constants for parameters */
|
/* This should not fail because we are using constants for parameters */
|
||||||
@@ -379,7 +379,7 @@ void bta_av_build_src_cfg (UINT8 *p_pref_cfg, UINT8 *p_src_cap)
|
|||||||
UINT8 status = 0;
|
UINT8 status = 0;
|
||||||
|
|
||||||
/* initialize it to default SBC configuration */
|
/* initialize it to default SBC configuration */
|
||||||
A2D_BldSbcInfo(AVDT_MEDIA_AUDIO, (tA2D_SBC_CIE *) &btif_av_sbc_default_config, p_pref_cfg);
|
A2D_BldSbcInfo(AVDT_MEDIA_AUDIO, (tA2D_SBC_CIE *) &btc_av_sbc_default_config, p_pref_cfg);
|
||||||
/* now try to build a preferred one */
|
/* now try to build a preferred one */
|
||||||
/* parse configuration */
|
/* parse configuration */
|
||||||
if ((status = A2D_ParsSbcInfo(&src_cap, p_src_cap, TRUE)) != 0) {
|
if ((status = A2D_ParsSbcInfo(&src_cap, p_src_cap, TRUE)) != 0) {
|
||||||
@@ -1467,7 +1467,7 @@ void bta_av_co_audio_codec_reset(void)
|
|||||||
/* Reset the current configuration to SBC */
|
/* Reset the current configuration to SBC */
|
||||||
bta_av_co_cb.codec_cfg.id = BTC_AV_CODEC_SBC;
|
bta_av_co_cb.codec_cfg.id = BTC_AV_CODEC_SBC;
|
||||||
|
|
||||||
if (A2D_BldSbcInfo(A2D_MEDIA_TYPE_AUDIO, (tA2D_SBC_CIE *)&btif_av_sbc_default_config, bta_av_co_cb.codec_cfg.info) != A2D_SUCCESS) {
|
if (A2D_BldSbcInfo(A2D_MEDIA_TYPE_AUDIO, (tA2D_SBC_CIE *)&btc_av_sbc_default_config, bta_av_co_cb.codec_cfg.info) != A2D_SUCCESS) {
|
||||||
APPL_TRACE_ERROR("bta_av_co_audio_codec_reset A2D_BldSbcInfo failed");
|
APPL_TRACE_ERROR("bta_av_co_audio_codec_reset A2D_BldSbcInfo failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1502,7 +1502,7 @@ BOOLEAN bta_av_co_audio_set_codec(const tBTC_AV_MEDIA_FEEDINGS *p_feeding, tBTC_
|
|||||||
case BTC_AV_CODEC_PCM:
|
case BTC_AV_CODEC_PCM:
|
||||||
new_cfg.id = BTC_AV_CODEC_SBC;
|
new_cfg.id = BTC_AV_CODEC_SBC;
|
||||||
|
|
||||||
sbc_config = btif_av_sbc_default_config;
|
sbc_config = btc_av_sbc_default_config;
|
||||||
if ((p_feeding->cfg.pcm.num_channel != 1) &&
|
if ((p_feeding->cfg.pcm.num_channel != 1) &&
|
||||||
(p_feeding->cfg.pcm.num_channel != 2)) {
|
(p_feeding->cfg.pcm.num_channel != 2)) {
|
||||||
APPL_TRACE_ERROR("bta_av_co_audio_set_codec PCM channel number unsupported");
|
APPL_TRACE_ERROR("bta_av_co_audio_set_codec PCM channel number unsupported");
|
||||||
@@ -1610,7 +1610,7 @@ BOOLEAN bta_av_co_audio_get_sbc_config(tA2D_SBC_CIE *p_sbc_config, UINT16 *p_min
|
|||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
/* Not SBC, still return the default values */
|
/* Not SBC, still return the default values */
|
||||||
*p_sbc_config = btif_av_sbc_default_config;
|
*p_sbc_config = btc_av_sbc_default_config;
|
||||||
}
|
}
|
||||||
GKI_enable();
|
GKI_enable();
|
||||||
|
|
@@ -43,7 +43,7 @@
|
|||||||
#include "bta_av_ci.h"
|
#include "bta_av_ci.h"
|
||||||
#include "l2c_api.h"
|
#include "l2c_api.h"
|
||||||
|
|
||||||
#include "btif_av_co.h"
|
#include "btc_av_co.h"
|
||||||
#include "btc_media.h"
|
#include "btc_media.h"
|
||||||
|
|
||||||
#include "alarm.h"
|
#include "alarm.h"
|
||||||
|
@@ -1,23 +1,19 @@
|
|||||||
/******************************************************************************
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||||
*
|
//
|
||||||
* 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.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
// You may obtain a copy of the License at
|
||||||
* 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 BTIF_AV_CO_H
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#define BTIF_AV_CO_H
|
//
|
||||||
|
// 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 __BTC_AV_CO_H__
|
||||||
|
#define __BTC_AV_CO_H__
|
||||||
|
|
||||||
#include "btc_media.h"
|
#include "btc_media.h"
|
||||||
|
|
||||||
@@ -26,9 +22,9 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BTIF_SV_AV_AA_SBC_INDEX = 0,
|
BTC_SV_AV_AA_SBC_INDEX = 0,
|
||||||
BTIF_SV_AV_AA_SBC_SINK_INDEX,
|
BTC_SV_AV_AA_SBC_SINK_INDEX,
|
||||||
BTIF_SV_AV_AA_SEP_INDEX /* Last index */
|
BTC_SV_AV_AA_SEP_INDEX /* Last index */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@@ -1,88 +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_api.h
|
|
||||||
*
|
|
||||||
* Description: Main API header file for all BTIF functions accessed
|
|
||||||
* from main bluetooth HAL. All HAL extensions will not
|
|
||||||
* require headerfiles as they would be accessed through
|
|
||||||
* callout/callins.
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef BTIF_API_H
|
|
||||||
#define BTIF_API_H
|
|
||||||
|
|
||||||
#include "btif_common.h"
|
|
||||||
#include "btif_dm.h"
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
** BTIF CORE API
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
** Function btif_init_bluetooth
|
|
||||||
**
|
|
||||||
** Description Creates BTIF task and prepares BT scheduler for startup
|
|
||||||
**
|
|
||||||
** Returns bt_status_t
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
bt_status_t btif_init_bluetooth(void);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
** Function btif_enable_bluetooth
|
|
||||||
**
|
|
||||||
** Description Performs chip power on and kickstarts OS scheduler
|
|
||||||
**
|
|
||||||
** Returns bt_status_t
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
bt_status_t btif_enable_bluetooth(void);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
** Function btif_disable_bluetooth
|
|
||||||
**
|
|
||||||
** Description Inititates shutdown of Bluetooth system.
|
|
||||||
** Any active links will be dropped and device entering
|
|
||||||
** non connectable/discoverable mode
|
|
||||||
**
|
|
||||||
** Returns void
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
bt_status_t btif_disable_bluetooth(void);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
** Function btif_shutdown_bluetooth
|
|
||||||
**
|
|
||||||
** Description Finalizes BT scheduler shutdown and terminates BTIF
|
|
||||||
** task.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Returns void
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
bt_status_t btif_shutdown_bluetooth(void);
|
|
||||||
|
|
||||||
#endif /* BTIF_API_H */
|
|
@@ -1,29 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 Google, Inc.
|
|
||||||
*
|
|
||||||
* 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 __STACK_MANAGER_H__
|
|
||||||
#define __STACK_MANAGER_H__
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "future.h"
|
|
||||||
|
|
||||||
bool stack_manager_is_stack_running(void);
|
|
||||||
|
|
||||||
future_t *stack_manager_get_hack_future(void);
|
|
||||||
|
|
||||||
#endif /* __STACK_MANAGER_H__*/
|
|
@@ -1,177 +0,0 @@
|
|||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "esp_bt_stack_manager.h"
|
|
||||||
#include "stack_manager.h"
|
|
||||||
#include "bt_defs.h"
|
|
||||||
#include "bt_trace.h"
|
|
||||||
#include "future.h"
|
|
||||||
#include "btif_common.h"
|
|
||||||
#include "btif_api.h"
|
|
||||||
#include "btif_dm.h"
|
|
||||||
#include "btif_config.h"
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
** Constants & Macros
|
|
||||||
************************************************************************************/
|
|
||||||
/************************************************************************************
|
|
||||||
** Local type definitions
|
|
||||||
************************************************************************************/
|
|
||||||
/************************************************************************************
|
|
||||||
** Static variables
|
|
||||||
************************************************************************************/
|
|
||||||
static bool stack_is_initialized = false;
|
|
||||||
static bool stack_is_running = false;
|
|
||||||
static future_t *hack_future = NULL;
|
|
||||||
|
|
||||||
static bt_status_t event_init_stack(void);
|
|
||||||
static bt_status_t event_start_up_stack(void);
|
|
||||||
static bt_status_t event_shut_down_stack(void);
|
|
||||||
static bt_status_t event_clean_up_stack(void);
|
|
||||||
|
|
||||||
static bt_status_t event_init_stack(void)
|
|
||||||
{
|
|
||||||
bt_status_t ret;
|
|
||||||
if (!stack_is_initialized) {
|
|
||||||
hack_future = future_new();
|
|
||||||
btif_config_init();
|
|
||||||
ret = btif_init_bluetooth();
|
|
||||||
if (future_await(hack_future) != FUTURE_SUCCESS) {
|
|
||||||
return BT_STATUS_FAIL;
|
|
||||||
}
|
|
||||||
if (ret == BT_STATUS_SUCCESS) {
|
|
||||||
stack_is_initialized = true;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
return BT_STATUS_DONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bt_status_t event_start_up_stack(void)
|
|
||||||
{
|
|
||||||
if (!stack_is_initialized) {
|
|
||||||
LOG_DEBUG("%s stack not initialized yet.\n", __func__);
|
|
||||||
return BT_STATUS_NOT_READY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack_is_running) {
|
|
||||||
LOG_DEBUG("%s stack already brought up.\n", __func__);
|
|
||||||
return BT_STATUS_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG("%s is bringing up the stack.\n", __func__);
|
|
||||||
hack_future = future_new();
|
|
||||||
|
|
||||||
btif_enable_bluetooth();
|
|
||||||
|
|
||||||
if (future_await(hack_future) != FUTURE_SUCCESS) {
|
|
||||||
stack_is_running = true; // So stack shutdown actually happens
|
|
||||||
event_shut_down_stack();
|
|
||||||
return BT_STATUS_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
stack_is_running = true;
|
|
||||||
LOG_DEBUG("%s finished\n", __func__);
|
|
||||||
return BT_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bt_status_t event_shut_down_stack(void)
|
|
||||||
{
|
|
||||||
if (!stack_is_initialized) {
|
|
||||||
LOG_DEBUG("%s stack not initialized yet.\n", __func__);
|
|
||||||
return BT_STATUS_NOT_READY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stack_is_running) {
|
|
||||||
LOG_DEBUG("%s stack is already brought down.\n", __func__);
|
|
||||||
return BT_STATUS_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG("%s is bringing down the stack.\n", __func__);
|
|
||||||
hack_future = future_new();
|
|
||||||
stack_is_running = false;
|
|
||||||
|
|
||||||
btif_disable_bluetooth();
|
|
||||||
btif_config_shut_down();
|
|
||||||
future_await(hack_future);
|
|
||||||
|
|
||||||
LOG_DEBUG("%s finished.\n", __func__);
|
|
||||||
return BT_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bt_status_t event_clean_up_stack(void)
|
|
||||||
{
|
|
||||||
if (!stack_is_initialized) {
|
|
||||||
LOG_DEBUG("%s found the stack already in a clean state.\n", __func__);
|
|
||||||
return BT_STATUS_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack_is_running) {
|
|
||||||
event_shut_down_stack();
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG("%s is cleaning up the stack.\n", __func__);
|
|
||||||
|
|
||||||
stack_is_initialized = false;
|
|
||||||
btif_config_clean_up();
|
|
||||||
btif_shutdown_bluetooth();
|
|
||||||
|
|
||||||
return BT_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t esp_bt_init_stack(void)
|
|
||||||
{
|
|
||||||
bt_status_t status;
|
|
||||||
status = event_init_stack();
|
|
||||||
switch (status) {
|
|
||||||
case BT_STATUS_SUCCESS: return ESP_OK;
|
|
||||||
case BT_STATUS_DONE: return ESP_ERR_INVALID_STATE;
|
|
||||||
default: return ESP_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t esp_bt_deinit_stack(void)
|
|
||||||
{
|
|
||||||
bt_status_t status;
|
|
||||||
status = event_clean_up_stack();
|
|
||||||
switch (status) {
|
|
||||||
case BT_STATUS_SUCCESS: return ESP_OK;
|
|
||||||
default: return ESP_ERR_INVALID_STATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t esp_bt_enable_stack(void)
|
|
||||||
{
|
|
||||||
bt_status_t status;
|
|
||||||
status = event_start_up_stack();
|
|
||||||
switch (status) {
|
|
||||||
case BT_STATUS_SUCCESS: return ESP_OK;
|
|
||||||
case BT_STATUS_NOT_READY:
|
|
||||||
case BT_STATUS_DONE:
|
|
||||||
return ESP_ERR_INVALID_STATE;
|
|
||||||
default: return ESP_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t esp_bt_disable_stack(void)
|
|
||||||
{
|
|
||||||
bt_status_t status;
|
|
||||||
status = event_shut_down_stack();
|
|
||||||
switch (status) {
|
|
||||||
case BT_STATUS_SUCCESS: return ESP_OK;
|
|
||||||
case BT_STATUS_NOT_READY:
|
|
||||||
case BT_STATUS_DONE:
|
|
||||||
return ESP_ERR_INVALID_STATE;
|
|
||||||
default: return ESP_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool stack_manager_is_stack_running(void)
|
|
||||||
{
|
|
||||||
return stack_is_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
future_t *stack_manager_get_hack_future(void)
|
|
||||||
{
|
|
||||||
return hack_future;
|
|
||||||
}
|
|
@@ -17,6 +17,7 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
|
|||||||
bluedroid/btc/profile/esp/include \
|
bluedroid/btc/profile/esp/include \
|
||||||
bluedroid/btc/profile/std/gatt/include \
|
bluedroid/btc/profile/std/gatt/include \
|
||||||
bluedroid/btc/profile/std/gap/include \
|
bluedroid/btc/profile/std/gap/include \
|
||||||
|
bluedroid/btc/profile/std/a2dp/include \
|
||||||
bluedroid/btc/profile/std/sdp/include \
|
bluedroid/btc/profile/std/sdp/include \
|
||||||
bluedroid/btc/profile/std/include \
|
bluedroid/btc/profile/std/include \
|
||||||
bluedroid/btc/include \
|
bluedroid/btc/include \
|
||||||
|
Reference in New Issue
Block a user