• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-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 #include "gki.h"
19 #include "bta_api.h"
20 #include "bta_sys.h"
21 #include "bta_ag_api.h"
22 #include "bta_ag_co.h"
23 #include "bte_appl.h"
24 
25 #define LOG_TAG "BTA_AG_CO: "
26 
27 #ifndef LINUX_NATIVE
28 #include <cutils/properties.h>
29 #include <cutils/log.h>
30 #else
31 #include <stdio.h>
32 #define LOGI(format, ...)  fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
33 #define LOGD(format, ...)  fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
34 #define LOGV(format, ...)  fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
35 #define LOGE(format, ...)  fprintf (stderr, LOG_TAG format"\n", ## __VA_ARGS__)
36 #endif
37 
38 
39 /*******************************************************************************
40 **
41 ** Function         bta_ag_co_init
42 **
43 ** Description      This callout function is executed by AG when it is
44 **                  started by calling BTA_AgEnable().  This function can be
45 **                  used by the phone to initialize audio paths or for other
46 **                  initialization purposes.
47 **
48 **
49 ** Returns          Void.
50 **
51 *******************************************************************************/
bta_ag_co_init(void)52 void bta_ag_co_init(void)
53 {
54     BTM_WriteVoiceSettings(AG_VOICE_SETTINGS);
55 }
56 
57 
58 /*******************************************************************************
59 **
60 ** Function         bta_ag_co_audio_state
61 **
62 ** Description      This function is called by the AG before the audio connection
63 **                  is brought up, after it comes up, and after it goes down.
64 **
65 ** Parameters       handle - handle of the AG instance
66 **                  state - Audio state
67 **                      BTA_AG_CO_AUD_STATE_OFF     - Audio has been turned off
68 **                      BTA_AG_CO_AUD_STATE_OFF_XFER - Audio has been turned off (xfer)
69 **                      BTA_AG_CO_AUD_STATE_ON      - Audio has been turned on
70 **                      BTA_AG_CO_AUD_STATE_SETUP   - Audio is about to be turned on
71 **
72 ** Returns          void
73 **
74 *******************************************************************************/
bta_ag_co_audio_state(UINT16 handle,UINT8 app_id,UINT8 state)75 void bta_ag_co_audio_state(UINT16 handle, UINT8 app_id, UINT8 state)
76 {
77     BTIF_TRACE_DEBUG2("bta_ag_co_audio_state: handle %d, state %d", handle, state);
78 }
79 
80 
81 /*******************************************************************************
82 **
83 ** Function         bta_ag_co_data_open
84 **
85 ** Description      This function is executed by AG when a service level connection
86 **                  is opened.  The phone can use this function to set
87 **                  up data paths or perform any required initialization or
88 **                  set up particular to the connected service.
89 **
90 **
91 ** Returns          void
92 **
93 *******************************************************************************/
bta_ag_co_data_open(UINT16 handle,tBTA_SERVICE_ID service)94 void bta_ag_co_data_open(UINT16 handle, tBTA_SERVICE_ID service)
95 {
96     BTIF_TRACE_DEBUG2("bta_ag_co_data_open handle:%d service:%d", handle, service);
97 }
98 
99 /*******************************************************************************
100 **
101 ** Function         bta_ag_co_data_close
102 **
103 ** Description      This function is called by AG when a service level
104 **                  connection is closed
105 **
106 **
107 ** Returns          void
108 **
109 *******************************************************************************/
bta_ag_co_data_close(UINT16 handle)110 void bta_ag_co_data_close(UINT16 handle)
111 {
112     BTIF_TRACE_DEBUG1("bta_ag_co_data_close handle:%d", handle);
113 }
114 
115 
116 /*******************************************************************************
117  **
118  ** Function         bta_ag_co_tx_write
119  **
120  ** Description      This function is called by the AG to send data to the
121  **                  phone when the AG is configured for AT command pass-through.
122  **                  The implementation of this function must copy the data to
123  **                  the phones memory.
124  **
125  ** Returns          void
126  **
127  *******************************************************************************/
bta_ag_co_tx_write(UINT16 handle,UINT8 * p_data,UINT16 len)128 void bta_ag_co_tx_write(UINT16 handle, UINT8 * p_data, UINT16 len)
129 {
130    BTIF_TRACE_DEBUG2( "bta_ag_co_tx_write: handle: %d, len: %d", handle, len );
131 }
132 
133