1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-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 API implementation file for the BTA device manager. 22 * 23 ******************************************************************************/ 24 25 #include "gki.h" 26 #include "bta_sys.h" 27 #include "bta_api.h" 28 #include "bta_dm_int.h" 29 #include <string.h> 30 #include "bta_dm_ci.h" 31 32 33 #if (BTM_OOB_INCLUDED == TRUE) 34 /******************************************************************************* 35 ** 36 ** Function bta_dm_ci_io_req 37 ** 38 ** Description This function must be called in response to function 39 ** bta_dm_co_io_req(), if *p_oob_data to BTA_OOB_UNKNOWN 40 ** by bta_dm_co_io_req(). 41 ** 42 ** Returns void 43 ** 44 *******************************************************************************/ 45 void bta_dm_ci_io_req(BD_ADDR bd_addr, tBTA_IO_CAP io_cap, tBTA_OOB_DATA oob_data, 46 tBTA_AUTH_REQ auth_req) 47 48 { 49 tBTA_DM_CI_IO_REQ *p_msg; 50 51 if ((p_msg = (tBTA_DM_CI_IO_REQ *) GKI_getbuf(sizeof(tBTA_DM_CI_IO_REQ))) != NULL) 52 { 53 p_msg->hdr.event = BTA_DM_CI_IO_REQ_EVT; 54 bdcpy(p_msg->bd_addr, bd_addr); 55 p_msg->io_cap = io_cap; 56 p_msg->oob_data = oob_data; 57 p_msg->auth_req = auth_req; 58 bta_sys_sendmsg(p_msg); 59 } 60 } 61 62 /******************************************************************************* 63 ** 64 ** Function bta_dm_ci_rmt_oob 65 ** 66 ** Description This function must be called in response to function 67 ** bta_dm_co_rmt_oob() to provide the OOB data associated 68 ** with the remote device. 69 ** 70 ** Returns void 71 ** 72 *******************************************************************************/ 73 void bta_dm_ci_rmt_oob(BOOLEAN accept, BD_ADDR bd_addr, BT_OCTET16 c, BT_OCTET16 r) 74 { 75 tBTA_DM_CI_RMT_OOB *p_msg; 76 77 if ((p_msg = (tBTA_DM_CI_RMT_OOB *) GKI_getbuf(sizeof(tBTA_DM_CI_RMT_OOB))) != NULL) 78 { 79 p_msg->hdr.event = BTA_DM_CI_RMT_OOB_EVT; 80 bdcpy(p_msg->bd_addr, bd_addr); 81 p_msg->accept = accept; 82 memcpy(p_msg->c, c, BT_OCTET16_LEN); 83 memcpy(p_msg->r, r, BT_OCTET16_LEN); 84 bta_sys_sendmsg(p_msg); 85 } 86 } 87 #endif /* BTM_OOB_INCLUDED */ 88 89 #if (BTM_SCO_HCI_INCLUDED == TRUE) 90 /******************************************************************************* 91 ** 92 ** Function bta_dm_sco_ci_data_ready 93 ** 94 ** Description This function sends an event to indicating that the phone 95 ** has SCO data ready. 96 ** 97 ** Parameters event: is obtained from bta_dm_sco_co_open() function, which 98 ** is the BTA event we want to send back to BTA module 99 ** when there is encoded data ready. 100 ** sco_handle: is the BTA sco handle which indicate a specific 101 ** SCO connection. 102 ** Returns void 103 ** 104 *******************************************************************************/ 105 void bta_dm_sco_ci_data_ready(UINT16 event, UINT16 sco_handle) 106 { 107 BT_HDR *p_buf; 108 109 if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) 110 { 111 p_buf->event = event; 112 p_buf->layer_specific = sco_handle; 113 114 bta_sys_sendmsg(p_buf); 115 } 116 } 117 #endif 118