1 /*
2  * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*******************************************************************************
8  *
9  *  Filename:      btc_a2dp.h
10  *
11  *  Description:   Common definitions for A2DP
12  *
13  *******************************************************************************/
14 
15 #ifndef __BTC_A2DP_H__
16 #define __BTC_A2DP_H__
17 
18 #include <stdbool.h>
19 #include "common/bt_target.h"
20 #include "bta/bta_api.h"
21 #include "btc_av_api.h"
22 #include "esp_a2dp_api.h"
23 
24 #if BTC_AV_INCLUDED
25 
26 /*******************************************************************************
27  **  Constants
28  *******************************************************************************/
29 #define BTC_AV_SUCCESS                             (0)
30 /**
31  * AV (Audio Video source) Errors
32  */
33 #define BTC_ERROR_SRV_AV_NOT_ENABLED               700     /* AV is not enabled */
34 #define BTC_ERROR_SRV_AV_FEEDING_NOT_SUPPORTED     701     /* Requested Feeding not supported */
35 #define BTC_ERROR_SRV_AV_BUSY                      702     /* Another operation ongoing */
36 #define BTC_ERROR_SRV_AV_NOT_OPENED                703     /* No AV link opened */
37 #define BTC_ERROR_SRV_AV_NOT_STARTED               704     /* AV is not started */
38 #define BTC_ERROR_SRV_AV_CP_NOT_SUPPORTED          705     /* Content protection is not supported by all headsets */
39 
40 /* Transcoding definition for TxTranscoding and RxTranscoding */
41 #define BTC_MEDIA_TRSCD_OFF                        0
42 #define BTC_MEDIA_TRSCD_PCM_2_SBC                  1       /* Tx */
43 
44 
45 /*******************************************************************************
46  **  Data types
47  *******************************************************************************/
48 typedef int tBTC_AV_STATUS;
49 
50 /*******************************************************************************
51  **  Public functions
52  *******************************************************************************/
53 
54 void btc_a2dp_on_init(void);
55 
56 /*******************************************************************************
57  **
58  ** Function         btc_a2dp_on_idle
59  **
60  ** Description      Process 'idle' request from BTC AV state machine during
61  **                  initialization
62  **
63  *******************************************************************************/
64 void btc_a2dp_on_idle(void);
65 
66 /*******************************************************************************
67  **
68  ** Function         btc_a2dp_on_started
69  **
70  ** Description      Process 'start' request from BTC AV state machine to prepare
71  **                  for A2DP streaming
72  **
73  ** Return           TRUE if an ACK for the local command is sent
74  **
75  *******************************************************************************/
76 BOOLEAN btc_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start);
77 
78 /*******************************************************************************
79  **
80  ** Function         btc_a2dp_on_stopped
81  **
82  ** Description      Process 'stop' request from BTC AV state machine to stop
83  **                  A2DP streaming
84  **
85  *******************************************************************************/
86 void btc_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av);
87 
88 /*******************************************************************************
89  **
90  ** Function         btc_a2dp_on_suspended
91  **
92  ** Description      Process 'stop' request from BTC AV state machine to suspend
93  **                  A2DP streaming
94  **
95  *******************************************************************************/
96 void btc_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av);
97 
98 #endif /* #if BTC_AV_INCLUDED */
99 
100 #endif /* __BTC_A2DP_H__ */
101