1 /******************************************************************************
2  *
3  *  Copyright 2006-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 is the interface file for device mananger callout functions.
22  *
23  ******************************************************************************/
24 #ifndef BTA_DM_CO_H
25 #define BTA_DM_CO_H
26 
27 #include "bta_sys.h"
28 #include "btm_api.h"
29 
30 #ifndef BTA_SCO_OUT_PKT_SIZE
31 #define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
32 #endif
33 
34 /*****************************************************************************
35  *  Function Declarations
36  ****************************************************************************/
37 
38 /*******************************************************************************
39  *
40  * Function         bta_dm_co_io_req
41  *
42  * Description      This callout function is executed by DM to get IO
43  *                  capabilities of the local device for the Simple Pairing
44  *                  process
45  *
46  * Parameters       bd_addr  - The peer device
47  *                  *p_io_cap - The local Input/Output capabilities
48  *                  *p_oob_data - true, if OOB data is available for the peer
49  *                                device.
50  *                  *p_auth_req - true, if MITM protection is required.
51  *
52  * Returns          void.
53  *
54  ******************************************************************************/
55 extern void bta_dm_co_io_req(const RawAddress& bd_addr, tBTA_IO_CAP* p_io_cap,
56                              tBTA_OOB_DATA* p_oob_data,
57                              tBTA_AUTH_REQ* p_auth_req, bool is_orig);
58 
59 /*******************************************************************************
60  *
61  * Function         bta_dm_co_io_rsp
62  *
63  * Description      This callout function is executed by DM to report IO
64  *                  capabilities of the peer device for the Simple Pairing
65  *                  process
66  *
67  * Parameters       bd_addr  - The peer device
68  *                  io_cap - The remote Input/Output capabilities
69  *                  oob_data - true, if OOB data is available for the peer
70  *                             device.
71  *                  auth_req - true, if MITM protection is required.
72  *
73  * Returns          void.
74  *
75  ******************************************************************************/
76 extern void bta_dm_co_io_rsp(const RawAddress& bd_addr, tBTA_IO_CAP io_cap,
77                              tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
78 
79 /*******************************************************************************
80  *
81  * Function         bta_dm_co_lk_upgrade
82  *
83  * Description      This callout function is executed by DM to check if the
84  *                  platform wants allow link key upgrade
85  *
86  * Parameters       bd_addr  - The peer device
87  *                  *p_upgrade - true, if link key upgrade is desired.
88  *
89  * Returns          void.
90  *
91  ******************************************************************************/
92 extern void bta_dm_co_lk_upgrade(const RawAddress& bd_addr, bool* p_upgrade);
93 
94 /*******************************************************************************
95  *
96  * Function         bta_dm_co_loc_oob
97  *
98  * Description      This callout function is executed by DM to report the OOB
99  *                  data of the local device for the Simple Pairing process
100  *
101  * Parameters       valid - true, if the local OOB data is retrieved from LM
102  *                  c     - Simple Pairing Hash C
103  *                  r     - Simple Pairing Randomnizer R
104  *
105  * Returns          void.
106  *
107  ******************************************************************************/
108 extern void bta_dm_co_loc_oob(bool valid, const Octet16& c, const Octet16& r);
109 
110 /*******************************************************************************
111  *
112  * Function         bta_dm_co_rmt_oob
113  *
114  * Description      This callout function is executed by DM to request the OOB
115  *                  data for the remote device for the Simple Pairing process
116  *
117  * Parameters       bd_addr  - The peer device
118  *
119  * Returns          void.
120  *
121  ******************************************************************************/
122 extern void bta_dm_co_rmt_oob(const RawAddress& bd_addr);
123 
124 /*******************************************************************************
125  *
126  * Function         bta_dm_sco_co_open
127  *
128  * Description      This function is executed when a SCO connection is open.
129  *
130  *
131  * Returns          void
132  *
133  ******************************************************************************/
134 extern void bta_dm_sco_co_open(uint16_t handle, uint8_t pkt_size,
135                                uint16_t event);
136 
137 /*******************************************************************************
138  *
139  * Function         bta_dm_sco_co_close
140  *
141  * Description      This function is called when a SCO connection is closed
142  *
143  *
144  * Returns          void
145  *
146  ******************************************************************************/
147 extern void bta_dm_sco_co_close(void);
148 
149 /*******************************************************************************
150  *
151  * Function         bta_dm_sco_co_out_data
152  *
153  * Description      This function is called to send SCO data over HCI.
154  *
155  * Returns          void
156  *
157  ******************************************************************************/
158 extern void bta_dm_sco_co_out_data(BT_HDR** p_buf);
159 
160 /*******************************************************************************
161  *
162  * Function         bta_dm_sco_co_in_data
163  *
164  * Description      This function is called to send incoming SCO data to
165  *                  application.
166  *
167  * Returns          void
168  *
169  ******************************************************************************/
170 extern void bta_dm_sco_co_in_data(BT_HDR* p_buf, tBTM_SCO_DATA_FLAG status);
171 
172 /*******************************************************************************
173  *
174  * Function         bta_dm_co_ble_io_req
175  *
176  * Description      This callout function is executed by DM to get BLE IO
177  *                  capabilities before SMP pairing gets going.
178  *
179  * Parameters       bd_addr  - The peer device
180  *                  *p_io_cap - The local Input/Output capabilities
181  *                  *p_oob_data - true, if OOB data is available for the peer
182  *                                device.
183  *                  *p_auth_req -  Auth request setting (Bonding and MITM
184  *                                                       required or not)
185  *                  *p_max_key_size - max key size local device supported.
186  *                  *p_init_key - initiator keys.
187  *                  *p_resp_key - responder keys.
188  *
189  * Returns          void.
190  *
191  ******************************************************************************/
192 extern void bta_dm_co_ble_io_req(
193     const RawAddress& bd_addr, tBTA_IO_CAP* p_io_cap, tBTA_OOB_DATA* p_oob_data,
194     tBTA_LE_AUTH_REQ* p_auth_req, uint8_t* p_max_key_size,
195     tBTA_LE_KEY_TYPE* p_init_key, tBTA_LE_KEY_TYPE* p_resp_key);
196 
197 /*******************************************************************************
198  *
199  * Function         bta_dm_co_ble_local_key_reload
200  *
201  * Description      This callout function is to load the local BLE keys if
202  *                  available on the device.
203  *
204  * Parameters       none
205  *
206  * Returns          void.
207  *
208  ******************************************************************************/
209 extern void bta_dm_co_ble_load_local_keys(
210     tBTA_DM_BLE_LOCAL_KEY_MASK* p_key_mask, Octet16* p_er,
211     tBTA_BLE_LOCAL_ID_KEYS* p_id_keys);
212 
213 #endif /* BTA_DM_CO_H */
214