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 "avdt_api.h"
31 
32 /* start AVDTC events here to distinguish from AVDT events */
33 #define AVDTC_EVT_BEGIN 0x80
34 
35 /* Discover indication */
36 #define AVDTC_DISCOVER_IND_EVT (0 + AVDTC_EVT_BEGIN)
37 /* Get capabilities indication */
38 #define AVDTC_GETCAP_IND_EVT (1 + AVDTC_EVT_BEGIN)
39 /* Set configuration confirm */
40 #define AVDTC_SETCONFIG_CFM_EVT (2 + AVDTC_EVT_BEGIN)
41 /* Get configuration indication */
42 #define AVDTC_GETCONFIG_IND_EVT (3 + AVDTC_EVT_BEGIN)
43 /* Get configuration confirm */
44 #define AVDTC_GETCONFIG_CFM_EVT (4 + AVDTC_EVT_BEGIN)
45 /* Open indication */
46 #define AVDTC_OPEN_IND_EVT (5 + AVDTC_EVT_BEGIN)
47 /* Start indication */
48 #define AVDTC_START_IND_EVT (6 + AVDTC_EVT_BEGIN)
49 /* Close indication */
50 #define AVDTC_CLOSE_IND_EVT (7 + AVDTC_EVT_BEGIN)
51 /* Suspend indication */
52 #define AVDTC_SUSPEND_IND_EVT (8 + AVDTC_EVT_BEGIN)
53 /* Abort indication */
54 #define AVDTC_ABORT_IND_EVT (9 + AVDTC_EVT_BEGIN)
55 /* Abort confirm */
56 #define AVDTC_ABORT_CFM_EVT (10 + AVDTC_EVT_BEGIN)
57 
58 typedef struct {
59   tAVDT_EVT_HDR hdr;                /* Event header */
60   uint8_t seid_list[AVDT_NUM_SEPS]; /* Array of SEID values */
61   uint8_t num_seps;                 /* Number of values in array */
62 } tAVDT_MULTI;
63 
64 /* Union of all control callback event data structures */
65 typedef union {
66   tAVDT_EVT_HDR hdr;
67   tAVDT_CONFIG getconfig_cfm;
68   tAVDT_MULTI start_ind;
69   tAVDT_MULTI suspend_ind;
70 } tAVDTC_CTRL;
71 
72 typedef void tAVDTC_CTRL_CBACK(uint8_t handle, const RawAddress& bd_addr,
73                                uint8_t event, tAVDTC_CTRL* p_data);
74 
75 /*******************************************************************************
76  *
77  * Function         AVDTC_Init
78  *
79  * Description      This function is called to begin using the conformance API.
80  *                  It must be called after AVDT_Register() and before any
81  *                  other API or conformance API functions are called.
82  *
83  * Returns          void
84  *
85  ******************************************************************************/
86 extern void AVDTC_Init(tAVDTC_CTRL_CBACK* p_cback);
87 
88 /*******************************************************************************
89  *
90  * Function         AVDTC_DiscoverRsp
91  *
92  * Description      Send a discover response.
93  *
94  * Returns          void
95  *
96  ******************************************************************************/
97 extern void AVDTC_DiscoverRsp(const RawAddress& bd_addr, uint8_t label,
98                               tAVDT_SEP_INFO sep_info[], uint8_t num_seps);
99 
100 /*******************************************************************************
101  *
102  * Function         AVDTC_GetCapRsp
103  *
104  * Description     Send a get capabilities response.
105  *
106  * Returns          void
107  *
108  ******************************************************************************/
109 extern void AVDTC_GetCapRsp(const RawAddress& bd_addr, uint8_t label,
110                             AvdtpSepConfig* p_cap);
111 
112 /*******************************************************************************
113  *
114  * Function         AVDTC_GetAllCapRsp
115  *
116  * Description     Send a get all capabilities response.
117  *
118  * Returns          void
119  *
120  ******************************************************************************/
121 extern void AVDTC_GetAllCapRsp(const RawAddress& bd_addr, uint8_t label,
122                                AvdtpSepConfig* p_cap);
123 
124 /*******************************************************************************
125  *
126  * Function         AVDTC_GetConfigReq
127  *
128  * Description      Send a get configuration request.
129  *
130  * Returns          void
131  *
132  ******************************************************************************/
133 extern void AVDTC_GetConfigReq(uint8_t handle);
134 
135 /*******************************************************************************
136  *
137  * Function         AVDTC_GetConfigRsp
138  *
139  * Description      Send a get configuration response.
140  *
141  * Returns          void
142  *
143  ******************************************************************************/
144 extern void AVDTC_GetConfigRsp(uint8_t handle, uint8_t label,
145                                AvdtpSepConfig* p_cfg);
146 
147 /*******************************************************************************
148  *
149  * Function         AVDTC_OpenReq
150  *
151  * Description      Send an open request.
152  *
153  * Returns          void
154  *
155  ******************************************************************************/
156 extern void AVDTC_OpenReq(uint8_t handle);
157 
158 /*******************************************************************************
159  *
160  * Function         AVDTC_OpenRsp
161  *
162  * Description      Send an open response.
163  *
164  * Returns          void
165  *
166  ******************************************************************************/
167 extern void AVDTC_OpenRsp(uint8_t handle, uint8_t label);
168 
169 /*******************************************************************************
170  *
171  * Function         AVDTC_StartRsp
172  *
173  * Description      Send a start response.
174  *
175  * Returns          void
176  *
177  ******************************************************************************/
178 extern void AVDTC_StartRsp(uint8_t* p_handles, uint8_t num_handles,
179                            uint8_t label);
180 
181 /*******************************************************************************
182  *
183  * Function         AVDTC_CloseRsp
184  *
185  * Description      Send a close response.
186  *
187  * Returns          void
188  *
189  ******************************************************************************/
190 extern void AVDTC_CloseRsp(uint8_t handle, uint8_t label);
191 
192 /*******************************************************************************
193  *
194  * Function         AVDTC_SuspendRsp
195  *
196  * Description      Send a suspend response.
197  *
198  * Returns          void
199  *
200  ******************************************************************************/
201 extern void AVDTC_SuspendRsp(uint8_t* p_handles, uint8_t num_handles,
202                              uint8_t label);
203 
204 /*******************************************************************************
205  *
206  * Function         AVDTC_AbortReq
207  *
208  * Description      Send an abort request.
209  *
210  * Returns          void
211  *
212  ******************************************************************************/
213 extern 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 extern 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 extern 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