bta_dm_co.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 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. * This is the interface file for device mananger callout functions.
  21. *
  22. ******************************************************************************/
  23. #ifndef BTA_DM_CO_H
  24. #define BTA_DM_CO_H
  25. #include "bta_sys.h"
  26. #ifndef BTA_SCO_OUT_PKT_SIZE
  27. #define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
  28. #endif
  29. #define BTA_SCO_CODEC_PCM 0 /* used for regular SCO */
  30. #define BTA_SCO_CODEC_SBC 1 /* used for WBS */
  31. typedef UINT8 tBTA_SCO_CODEC_TYPE;
  32. #define BTA_DM_SCO_SAMP_RATE_8K 8000
  33. #define BTA_DM_SCO_SAMP_RATE_16K 16000
  34. /* SCO codec information */
  35. typedef struct {
  36. tBTA_SCO_CODEC_TYPE codec_type;
  37. } tBTA_CODEC_INFO;
  38. #define BTA_DM_SCO_ROUTE_PCM BTM_SCO_ROUTE_PCM
  39. #define BTA_DM_SCO_ROUTE_HCI BTM_SCO_ROUTE_HCI
  40. typedef tBTM_SCO_ROUTE_TYPE tBTA_DM_SCO_ROUTE_TYPE;
  41. /*****************************************************************************
  42. ** Function Declarations
  43. *****************************************************************************/
  44. /*******************************************************************************
  45. **
  46. ** Function bta_dm_co_io_req
  47. **
  48. ** Description This callout function is executed by DM to get IO capabilities
  49. ** of the local device for the Simple Pairing process
  50. **
  51. ** Parameters bd_addr - The peer device
  52. ** *p_io_cap - The local Input/Output capabilities
  53. ** *p_oob_data - TRUE, if OOB data is available for the peer device.
  54. ** *p_auth_req - TRUE, if MITM protection is required.
  55. **
  56. ** Returns void.
  57. **
  58. *******************************************************************************/
  59. extern void bta_dm_co_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
  60. tBTA_OOB_DATA *p_oob_data, tBTA_AUTH_REQ *p_auth_req,
  61. BOOLEAN is_orig);
  62. /*******************************************************************************
  63. **
  64. ** Function bta_dm_co_io_rsp
  65. **
  66. ** Description This callout function is executed by DM to report IO capabilities
  67. ** of the peer device for the Simple Pairing process
  68. **
  69. ** Parameters bd_addr - The peer device
  70. ** io_cap - The remote Input/Output capabilities
  71. ** oob_data - TRUE, if OOB data is available for the peer device.
  72. ** auth_req - TRUE, if MITM protection is required.
  73. **
  74. ** Returns void.
  75. **
  76. *******************************************************************************/
  77. extern void bta_dm_co_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
  78. tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
  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(BD_ADDR bd_addr, BOOLEAN *p_upgrade );
  93. /*******************************************************************************
  94. **
  95. ** Function bta_dm_co_loc_oob
  96. **
  97. ** Description This callout function is executed by DM to report the OOB
  98. ** data of the local device for the Simple Pairing process
  99. **
  100. ** Parameters valid - TRUE, if the local OOB data is retrieved from LM
  101. ** c - Simple Pairing Hash C
  102. ** r - Simple Pairing Randomnizer R
  103. **
  104. ** Returns void.
  105. **
  106. *******************************************************************************/
  107. extern void bta_dm_co_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r);
  108. /*******************************************************************************
  109. **
  110. ** Function bta_dm_co_rmt_oob
  111. **
  112. ** Description This callout function is executed by DM to request the OOB
  113. ** data for the remote device for the Simple Pairing process
  114. **
  115. ** Parameters bd_addr - The peer device
  116. **
  117. ** Returns void.
  118. **
  119. *******************************************************************************/
  120. extern void bta_dm_co_rmt_oob(BD_ADDR bd_addr);
  121. /*****************************************************************************
  122. ** SCO over HCI Function Declarations
  123. *****************************************************************************/
  124. /*******************************************************************************
  125. **
  126. ** Function bta_dm_sco_co_init
  127. **
  128. ** Description This function can be used by the phone to initialize audio
  129. ** codec or for other initialization purposes before SCO connection
  130. ** is opened.
  131. **
  132. **
  133. ** Returns Void.
  134. **
  135. *******************************************************************************/
  136. extern tBTA_DM_SCO_ROUTE_TYPE bta_dm_sco_co_init(UINT32 rx_bw, UINT32 tx_bw,
  137. tBTA_CODEC_INFO *p_codec_info, UINT8 app_id);
  138. /*******************************************************************************
  139. **
  140. ** Function bta_dm_sco_co_open
  141. **
  142. ** Description This function is executed when a SCO connection is open.
  143. **
  144. **
  145. ** Returns void
  146. **
  147. *******************************************************************************/
  148. extern void bta_dm_sco_co_open(UINT16 handle, UINT8 pkt_size, UINT16 event);
  149. /*******************************************************************************
  150. **
  151. ** Function bta_dm_sco_co_close
  152. **
  153. ** Description This function is called when a SCO connection is closed
  154. **
  155. **
  156. ** Returns void
  157. **
  158. *******************************************************************************/
  159. extern void bta_dm_sco_co_close(void);
  160. /*******************************************************************************
  161. **
  162. ** Function bta_dm_sco_co_out_data
  163. **
  164. ** Description This function is called to send SCO data over HCI.
  165. **
  166. ** Returns void
  167. **
  168. *******************************************************************************/
  169. extern void bta_dm_sco_co_out_data(BT_HDR **p_buf);
  170. /*******************************************************************************
  171. **
  172. ** Function bta_dm_sco_co_in_data
  173. **
  174. ** Description This function is called to send incoming SCO data to application.
  175. **
  176. ** Returns void
  177. **
  178. *******************************************************************************/
  179. extern void bta_dm_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status);
  180. /*******************************************************************************
  181. **
  182. ** Function bta_dm_co_ble_io_req
  183. **
  184. ** Description This callout function is executed by DM to get BLE IO capabilities
  185. ** before SMP pairing gets going.
  186. **
  187. ** Parameters bd_addr - The peer device
  188. ** *p_io_cap - The local Input/Output capabilities
  189. ** *p_oob_data - TRUE, if OOB data is available for the peer device.
  190. ** *p_auth_req - Auth request setting (Bonding and MITM required or not)
  191. ** *p_max_key_size - max key size local device supported.
  192. ** *p_init_key - initiator keys.
  193. ** *p_resp_key - responder keys.
  194. **
  195. ** Returns void.
  196. **
  197. *******************************************************************************/
  198. extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
  199. tBTA_OOB_DATA *p_oob_data,
  200. tBTA_LE_AUTH_REQ *p_auth_req,
  201. UINT8 *p_max_key_size,
  202. tBTA_LE_KEY_TYPE *p_init_key,
  203. tBTA_LE_KEY_TYPE *p_resp_key );
  204. /*******************************************************************************
  205. **
  206. ** Function bta_dm_co_ble_local_key_reload
  207. **
  208. ** Description This callout function is to load the local BLE keys if available
  209. ** on the device.
  210. **
  211. ** Parameters none
  212. **
  213. ** Returns void.
  214. **
  215. *******************************************************************************/
  216. extern void bta_dm_co_ble_load_local_keys (tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
  217. tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
  218. // btla-specific ++
  219. /*******************************************************************************
  220. **
  221. ** Function bta_dm_co_ble_io_req
  222. **
  223. ** Description This callout function is executed by DM to get BLE IO capabilities
  224. ** before SMP pairing gets going.
  225. **
  226. ** Parameters bd_addr - The peer device
  227. ** *p_io_cap - The local Input/Output capabilities
  228. ** *p_oob_data - TRUE, if OOB data is available for the peer device.
  229. ** *p_auth_req - Auth request setting (Bonding and MITM required or not)
  230. ** *p_max_key_size - max key size local device supported.
  231. ** *p_init_key - initiator keys.
  232. ** *p_resp_key - responder keys.
  233. **
  234. ** Returns void.
  235. **
  236. *******************************************************************************/
  237. extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
  238. tBTA_OOB_DATA *p_oob_data,
  239. tBTA_LE_AUTH_REQ *p_auth_req,
  240. UINT8 *p_max_key_size,
  241. tBTA_LE_KEY_TYPE *p_init_key,
  242. tBTA_LE_KEY_TYPE *p_resp_key );
  243. // btla-specific --
  244. extern void bta_dm_co_ble_set_io_cap(UINT8 ble_io_cap);
  245. extern void bta_dm_co_ble_set_auth_req(UINT8 ble_auth_req);
  246. extern void bta_dm_co_ble_set_init_key_req(UINT8 init_key);
  247. extern void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key);
  248. extern void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size);
  249. #endif