1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 /*******************************************************************************
16  *
17  *  Filename:      btc_a2dp.h
18  *
19  *  Description:   Common definitions for A2DP
20  *
21  *******************************************************************************/
22 
23 #ifndef __BTC_A2DP_H__
24 #define __BTC_A2DP_H__
25 
26 #include <stdbool.h>
27 #include "common/bt_target.h"
28 #include "bta/bta_api.h"
29 #include "btc_av_api.h"
30 #include "esp_a2dp_api.h"
31 
32 #if BTC_AV_INCLUDED
33 
34 /*******************************************************************************
35  **  Constants
36  *******************************************************************************/
37 #define BTC_AV_SUCCESS                             (0)
38 /**
39  * AV (Audio Video source) Errors
40  */
41 #define BTC_ERROR_SRV_AV_NOT_ENABLED               700     /* AV is not enabled */
42 #define BTC_ERROR_SRV_AV_FEEDING_NOT_SUPPORTED     701     /* Requested Feeding not supported */
43 #define BTC_ERROR_SRV_AV_BUSY                      702     /* Another operation ongoing */
44 #define BTC_ERROR_SRV_AV_NOT_OPENED                703     /* No AV link opened */
45 #define BTC_ERROR_SRV_AV_NOT_STARTED               704     /* AV is not started */
46 #define BTC_ERROR_SRV_AV_CP_NOT_SUPPORTED          705     /* Content protection is not supported by all headsets */
47 
48 /* Transcoding definition for TxTranscoding and RxTranscoding */
49 #define BTC_MEDIA_TRSCD_OFF                        0
50 #define BTC_MEDIA_TRSCD_PCM_2_SBC                  1       /* Tx */
51 
52 
53 /*******************************************************************************
54  **  Data types
55  *******************************************************************************/
56 typedef int tBTC_AV_STATUS;
57 
58 /*******************************************************************************
59  **  Public functions
60  *******************************************************************************/
61 
62 void btc_a2dp_on_init(void);
63 
64 /*******************************************************************************
65  **
66  ** Function         btc_a2dp_on_idle
67  **
68  ** Description      Process 'idle' request from BTC AV state machine during
69  **                  initialization
70  **
71  *******************************************************************************/
72 void btc_a2dp_on_idle(void);
73 
74 /*******************************************************************************
75  **
76  ** Function         btc_a2dp_on_started
77  **
78  ** Description      Process 'start' request from BTC AV state machine to prepare
79  **                  for A2DP streaming
80  **
81  ** Return           TRUE if an ACK for the local command is sent
82  **
83  *******************************************************************************/
84 BOOLEAN btc_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start);
85 
86 /*******************************************************************************
87  **
88  ** Function         btc_a2dp_on_stopped
89  **
90  ** Description      Process 'stop' request from BTC AV state machine to stop
91  **                  A2DP streaming
92  **
93  *******************************************************************************/
94 void btc_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av);
95 
96 /*******************************************************************************
97  **
98  ** Function         btc_a2dp_on_suspended
99  **
100  ** Description      Process 'stop' request from BTC AV state machine to suspend
101  **                  A2DP streaming
102  **
103  *******************************************************************************/
104 void btc_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av);
105 
106 #endif /* #if BTC_AV_INCLUDED */
107 
108 #endif /* __BTC_A2DP_H__ */
109