• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2005-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 implementation file for advanced audio/video call-in
22  *  functions.
23  *
24  ******************************************************************************/
25 
26 #include "bta_av_ci.h"
27 #include "bta_api.h"
28 #include "bta_av_int.h"
29 #include "bta_sys.h"
30 
31 #include <string.h>
32 
33 /*******************************************************************************
34  *
35  * Function         bta_av_ci_src_data_ready
36  *
37  * Description      This function sends an event to the AV indicating that
38  *                  the phone has audio stream data ready to send and AV
39  *                  should call bta_av_co_audio_src_data_path().
40  *
41  * Returns          void
42  *
43  ******************************************************************************/
bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl)44 void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl) {
45   BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));
46 
47   p_buf->layer_specific = chnl;
48   p_buf->event = BTA_AV_CI_SRC_DATA_READY_EVT;
49 
50   bta_sys_sendmsg(p_buf);
51 }
52 
53 /*******************************************************************************
54  *
55  * Function         bta_av_ci_setconfig
56  *
57  * Description      This function must be called in response to function
58  *                  bta_av_co_audio_setconfig().
59  *                  Parameter err_code is set to an AVDTP status value;
60  *                  AVDT_SUCCESS if the codec configuration is ok,
61  *                  otherwise error.
62  *
63  * Returns          void
64  *
65  ******************************************************************************/
bta_av_ci_setconfig(tBTA_AV_HNDL hndl,uint8_t err_code,uint8_t category,uint8_t num_seid,uint8_t * p_seid,bool recfg_needed,uint8_t avdt_handle)66 void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, uint8_t err_code, uint8_t category,
67                          uint8_t num_seid, uint8_t* p_seid, bool recfg_needed,
68                          uint8_t avdt_handle) {
69   tBTA_AV_CI_SETCONFIG* p_buf =
70       (tBTA_AV_CI_SETCONFIG*)osi_malloc(sizeof(tBTA_AV_CI_SETCONFIG));
71 
72   p_buf->hdr.layer_specific = hndl;
73   p_buf->hdr.event = (err_code == A2DP_SUCCESS) ? BTA_AV_CI_SETCONFIG_OK_EVT
74                                                 : BTA_AV_CI_SETCONFIG_FAIL_EVT;
75   p_buf->err_code = err_code;
76   p_buf->category = category;
77   p_buf->recfg_needed = recfg_needed;
78   p_buf->num_seid = num_seid;
79   p_buf->avdt_handle = avdt_handle;
80   if (p_seid && num_seid) {
81     p_buf->p_seid = (uint8_t*)(p_buf + 1);
82     memcpy(p_buf->p_seid, p_seid, num_seid);
83   } else {
84     p_buf->p_seid = NULL;
85     p_buf->num_seid = 0;
86   }
87 
88   bta_sys_sendmsg(p_buf);
89 }
90