1 /******************************************************************************
3 * Copyright (C) 2003-2012 Broadcom Corporation
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ******************************************************************************/
19 /******************************************************************************
21 * This is the API implementation file for the BTA device manager.
23 ******************************************************************************/
25 #include "bt_common.h"
28 #include "bta_dm_int.h"
30 #include "bta_dm_ci.h"
33 /*******************************************************************************
35 ** Function bta_dm_ci_io_req
37 ** Description This function must be called in response to function
38 ** bta_dm_co_io_req(), if *p_oob_data to BTA_OOB_UNKNOWN
39 ** by bta_dm_co_io_req().
43 *******************************************************************************/
44 void bta_dm_ci_io_req(BD_ADDR bd_addr, tBTA_IO_CAP io_cap, tBTA_OOB_DATA oob_data,
45 tBTA_AUTH_REQ auth_req)
48 tBTA_DM_CI_IO_REQ *p_msg =
49 (tBTA_DM_CI_IO_REQ *)osi_malloc(sizeof(tBTA_DM_CI_IO_REQ));
51 p_msg->hdr.event = BTA_DM_CI_IO_REQ_EVT;
52 bdcpy(p_msg->bd_addr, bd_addr);
53 p_msg->io_cap = io_cap;
54 p_msg->oob_data = oob_data;
55 p_msg->auth_req = auth_req;
57 bta_sys_sendmsg(p_msg);
60 /*******************************************************************************
62 ** Function bta_dm_ci_rmt_oob
64 ** Description This function must be called in response to function
65 ** bta_dm_co_rmt_oob() to provide the OOB data associated
66 ** with the remote device.
70 *******************************************************************************/
71 void bta_dm_ci_rmt_oob(BOOLEAN accept, BD_ADDR bd_addr, BT_OCTET16 c, BT_OCTET16 r)
73 tBTA_DM_CI_RMT_OOB *p_msg =
74 (tBTA_DM_CI_RMT_OOB *)osi_malloc(sizeof(tBTA_DM_CI_RMT_OOB));
76 p_msg->hdr.event = BTA_DM_CI_RMT_OOB_EVT;
77 bdcpy(p_msg->bd_addr, bd_addr);
78 p_msg->accept = accept;
79 memcpy(p_msg->c, c, BT_OCTET16_LEN);
80 memcpy(p_msg->r, r, BT_OCTET16_LEN);
82 bta_sys_sendmsg(p_msg);
85 #if (BTM_SCO_HCI_INCLUDED == TRUE)
86 /*******************************************************************************
88 ** Function bta_dm_sco_ci_data_ready
90 ** Description This function sends an event to indicating that the phone
91 ** has SCO data ready.
93 ** Parameters event: is obtained from bta_dm_sco_co_open() function, which
94 ** is the BTA event we want to send back to BTA module
95 ** when there is encoded data ready.
96 ** sco_handle: is the BTA sco handle which indicate a specific
100 *******************************************************************************/
101 void bta_dm_sco_ci_data_ready(UINT16 event, UINT16 sco_handle)
103 BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
105 p_buf->event = event;
106 p_buf->layer_specific = sco_handle;
108 bta_sys_sendmsg(p_buf);