1 /******************************************************************************
2  *
3  *  Copyright 2002-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This interface file contains the interface AVDTP conformance API.  These
22  *  additional API functions and callback events are provided for
23  *  conformance testing purposes only.  They are not intended to be used by
24  *  an application.
25  *
26  ******************************************************************************/
27 #ifndef AVDT_CAPI_H
28 #define AVDT_CAPI_H
29 
30 #include <cstdint>
31 
32 #include "avdt_api.h"
33 #include "types/raw_address.h"
34 
35 /* start AVDTC events here to distinguish from AVDT events */
36 #define AVDTC_EVT_BEGIN 0x80
37 
38 /* Discover indication */
39 #define AVDTC_DISCOVER_IND_EVT (0 + AVDTC_EVT_BEGIN)
40 /* Get capabilities indication */
41 #define AVDTC_GETCAP_IND_EVT (1 + AVDTC_EVT_BEGIN)
42 /* Set configuration confirm */
43 #define AVDTC_SETCONFIG_CFM_EVT (2 + AVDTC_EVT_BEGIN)
44 /* Get configuration indication */
45 #define AVDTC_GETCONFIG_IND_EVT (3 + AVDTC_EVT_BEGIN)
46 /* Get configuration confirm */
47 #define AVDTC_GETCONFIG_CFM_EVT (4 + AVDTC_EVT_BEGIN)
48 /* Open indication */
49 #define AVDTC_OPEN_IND_EVT (5 + AVDTC_EVT_BEGIN)
50 /* Start indication */
51 #define AVDTC_START_IND_EVT (6 + AVDTC_EVT_BEGIN)
52 /* Close indication */
53 #define AVDTC_CLOSE_IND_EVT (7 + AVDTC_EVT_BEGIN)
54 /* Suspend indication */
55 #define AVDTC_SUSPEND_IND_EVT (8 + AVDTC_EVT_BEGIN)
56 /* Abort indication */
57 #define AVDTC_ABORT_IND_EVT (9 + AVDTC_EVT_BEGIN)
58 /* Abort confirm */
59 #define AVDTC_ABORT_CFM_EVT (10 + AVDTC_EVT_BEGIN)
60 
61 typedef struct {
62   tAVDT_EVT_HDR hdr;                /* Event header */
63   uint8_t seid_list[AVDT_NUM_SEPS]; /* Array of SEID values */
64   uint8_t num_seps;                 /* Number of values in array */
65 } tAVDT_MULTI;
66 
67 /* Union of all control callback event data structures */
68 typedef union {
69   tAVDT_EVT_HDR hdr;
70   tAVDT_CONFIG getconfig_cfm;
71   tAVDT_MULTI start_ind;
72   tAVDT_MULTI suspend_ind;
73 } tAVDTC_CTRL;
74 
75 typedef void tAVDTC_CTRL_CBACK(uint8_t handle, const RawAddress& bd_addr,
76                                uint8_t event, tAVDTC_CTRL* p_data);
77 
78 /*******************************************************************************
79  *
80  * Function         AVDTC_Init
81  *
82  * Description      This function is called to begin using the conformance API.
83  *                  It must be called after AVDT_Register() and before any
84  *                  other API or conformance API functions are called.
85  *
86  * Returns          void
87  *
88  ******************************************************************************/
89 void AVDTC_Init(tAVDTC_CTRL_CBACK* p_cback);
90 
91 /*******************************************************************************
92  *
93  * Function         AVDTC_DiscoverRsp
94  *
95  * Description      Send a discover response.
96  *
97  * Returns          void
98  *
99  ******************************************************************************/
100 void AVDTC_DiscoverRsp(const RawAddress& bd_addr, uint8_t label,
101                        tAVDT_SEP_INFO sep_info[], uint8_t num_seps);
102 
103 /*******************************************************************************
104  *
105  * Function         AVDTC_GetCapRsp
106  *
107  * Description     Send a get capabilities response.
108  *
109  * Returns          void
110  *
111  ******************************************************************************/
112 void AVDTC_GetCapRsp(const RawAddress& bd_addr, uint8_t label,
113                      AvdtpSepConfig* p_cap);
114 
115 /*******************************************************************************
116  *
117  * Function         AVDTC_GetAllCapRsp
118  *
119  * Description     Send a get all capabilities response.
120  *
121  * Returns          void
122  *
123  ******************************************************************************/
124 void AVDTC_GetAllCapRsp(const RawAddress& bd_addr, uint8_t label,
125                         AvdtpSepConfig* p_cap);
126 
127 /*******************************************************************************
128  *
129  * Function         AVDTC_GetConfigReq
130  *
131  * Description      Send a get configuration request.
132  *
133  * Returns          void
134  *
135  ******************************************************************************/
136 void AVDTC_GetConfigReq(uint8_t handle);
137 
138 /*******************************************************************************
139  *
140  * Function         AVDTC_GetConfigRsp
141  *
142  * Description      Send a get configuration response.
143  *
144  * Returns          void
145  *
146  ******************************************************************************/
147 void AVDTC_GetConfigRsp(uint8_t handle, uint8_t label, AvdtpSepConfig* p_cfg);
148 
149 /*******************************************************************************
150  *
151  * Function         AVDTC_OpenReq
152  *
153  * Description      Send an open request.
154  *
155  * Returns          void
156  *
157  ******************************************************************************/
158 void AVDTC_OpenReq(uint8_t handle);
159 
160 /*******************************************************************************
161  *
162  * Function         AVDTC_OpenRsp
163  *
164  * Description      Send an open response.
165  *
166  * Returns          void
167  *
168  ******************************************************************************/
169 void AVDTC_OpenRsp(uint8_t handle, uint8_t label);
170 
171 /*******************************************************************************
172  *
173  * Function         AVDTC_StartRsp
174  *
175  * Description      Send a start response.
176  *
177  * Returns          void
178  *
179  ******************************************************************************/
180 void AVDTC_StartRsp(uint8_t* p_handles, uint8_t num_handles, uint8_t label);
181 
182 /*******************************************************************************
183  *
184  * Function         AVDTC_CloseRsp
185  *
186  * Description      Send a close response.
187  *
188  * Returns          void
189  *
190  ******************************************************************************/
191 void AVDTC_CloseRsp(uint8_t handle, uint8_t label);
192 
193 /*******************************************************************************
194  *
195  * Function         AVDTC_SuspendRsp
196  *
197  * Description      Send a suspend response.
198  *
199  * Returns          void
200  *
201  ******************************************************************************/
202 void AVDTC_SuspendRsp(uint8_t* p_handles, uint8_t num_handles, uint8_t label);
203 
204 /*******************************************************************************
205  *
206  * Function         AVDTC_AbortReq
207  *
208  * Description      Send an abort request.
209  *
210  * Returns          void
211  *
212  ******************************************************************************/
213 void AVDTC_AbortReq(uint8_t handle);
214 
215 /*******************************************************************************
216  *
217  * Function         AVDTC_AbortRsp
218  *
219  * Description      Send an abort response.
220  *
221  * Returns          void
222  *
223  ******************************************************************************/
224 void AVDTC_AbortRsp(uint8_t handle, uint8_t label);
225 
226 /*******************************************************************************
227  *
228  * Function         AVDTC_Rej
229  *
230  * Description      Send a reject message.
231  *
232  * Returns          void
233  *
234  ******************************************************************************/
235 void AVDTC_Rej(uint8_t handle, const RawAddress& bd_addr, uint8_t cmd,
236                uint8_t label, uint8_t err_code, uint8_t err_param);
237 
238 #endif /* AVDT_CAPI_H */
239