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, uint8_t event,
76                                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, tAVDT_SEP_INFO sep_info[],
101                        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, AvdtpSepConfig* p_cap);
113 
114 /*******************************************************************************
115  *
116  * Function         AVDTC_GetAllCapRsp
117  *
118  * Description     Send a get all capabilities response.
119  *
120  * Returns          void
121  *
122  ******************************************************************************/
123 void AVDTC_GetAllCapRsp(const RawAddress& bd_addr, uint8_t label, AvdtpSepConfig* p_cap);
124 
125 /*******************************************************************************
126  *
127  * Function         AVDTC_GetConfigReq
128  *
129  * Description      Send a get configuration request.
130  *
131  * Returns          void
132  *
133  ******************************************************************************/
134 void AVDTC_GetConfigReq(uint8_t handle);
135 
136 /*******************************************************************************
137  *
138  * Function         AVDTC_GetConfigRsp
139  *
140  * Description      Send a get configuration response.
141  *
142  * Returns          void
143  *
144  ******************************************************************************/
145 void AVDTC_GetConfigRsp(uint8_t handle, uint8_t label, AvdtpSepConfig* p_cfg);
146 
147 /*******************************************************************************
148  *
149  * Function         AVDTC_OpenReq
150  *
151  * Description      Send an open request.
152  *
153  * Returns          void
154  *
155  ******************************************************************************/
156 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 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 void AVDTC_StartRsp(uint8_t* p_handles, uint8_t num_handles, uint8_t label);
179 
180 /*******************************************************************************
181  *
182  * Function         AVDTC_CloseRsp
183  *
184  * Description      Send a close response.
185  *
186  * Returns          void
187  *
188  ******************************************************************************/
189 void AVDTC_CloseRsp(uint8_t handle, uint8_t label);
190 
191 /*******************************************************************************
192  *
193  * Function         AVDTC_SuspendRsp
194  *
195  * Description      Send a suspend response.
196  *
197  * Returns          void
198  *
199  ******************************************************************************/
200 void AVDTC_SuspendRsp(uint8_t* p_handles, uint8_t num_handles, uint8_t label);
201 
202 /*******************************************************************************
203  *
204  * Function         AVDTC_AbortReq
205  *
206  * Description      Send an abort request.
207  *
208  * Returns          void
209  *
210  ******************************************************************************/
211 void AVDTC_AbortReq(uint8_t handle);
212 
213 /*******************************************************************************
214  *
215  * Function         AVDTC_AbortRsp
216  *
217  * Description      Send an abort response.
218  *
219  * Returns          void
220  *
221  ******************************************************************************/
222 void AVDTC_AbortRsp(uint8_t handle, uint8_t label);
223 
224 /*******************************************************************************
225  *
226  * Function         AVDTC_Rej
227  *
228  * Description      Send a reject message.
229  *
230  * Returns          void
231  *
232  ******************************************************************************/
233 void AVDTC_Rej(uint8_t handle, const RawAddress& bd_addr, uint8_t cmd, uint8_t label,
234                uint8_t err_code, uint8_t err_param);
235 
236 #endif /* AVDT_CAPI_H */
237