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 19 /******************************************************************************* 20 * 21 * Filename: btif_av.h 22 * 23 * Description: Main API header file for all BTIF AV functions accessed 24 * from internal stack. 25 * 26 *******************************************************************************/ 27 28 #ifndef BTIF_AV_H 29 #define BTIF_AV_H 30 31 #include "btif_common.h" 32 #include "btif_sm.h" 33 #include "bta_av_api.h" 34 35 36 /******************************************************************************* 37 ** Type definitions for callback functions 38 ********************************************************************************/ 39 40 typedef enum { 41 /* Reuse BTA_AV_XXX_EVT - No need to redefine them here */ 42 BTIF_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT, 43 BTIF_AV_DISCONNECT_REQ_EVT, 44 BTIF_AV_START_STREAM_REQ_EVT, 45 BTIF_AV_STOP_STREAM_REQ_EVT, 46 BTIF_AV_SUSPEND_STREAM_REQ_EVT, 47 BTIF_AV_SINK_CONFIG_REQ_EVT, 48 BTIF_AV_OFFLOAD_START_REQ_EVT, 49 BTIF_AV_SINK_FOCUS_REQ_EVT, 50 BTIF_AV_CLEANUP_REQ_EVT, 51 } btif_av_sm_event_t; 52 53 54 /******************************************************************************* 55 ** BTIF AV API 56 ********************************************************************************/ 57 58 /******************************************************************************* 59 ** 60 ** Function btif_av_get_sm_handle 61 ** 62 ** Description Fetches current av SM handle 63 ** 64 ** Returns None 65 ** 66 *******************************************************************************/ 67 68 btif_sm_handle_t btif_av_get_sm_handle(void); 69 70 /******************************************************************************* 71 ** 72 ** Function btif_av_get_addr 73 ** 74 ** Description Fetches current AV BD address 75 ** 76 ** Returns BD address 77 ** 78 *******************************************************************************/ 79 80 bt_bdaddr_t btif_av_get_addr(void); 81 82 /******************************************************************************* 83 ** Function btif_av_is_sink_enabled 84 ** 85 ** Description Checks if A2DP Sink is enabled or not 86 ** 87 ** Returns TRUE if A2DP Sink is enabled, false otherwise 88 ** 89 *******************************************************************************/ 90 91 BOOLEAN btif_av_is_sink_enabled(void); 92 93 /******************************************************************************* 94 ** 95 ** Function btif_av_stream_ready 96 ** 97 ** Description Checks whether AV is ready for starting a stream 98 ** 99 ** Returns None 100 ** 101 *******************************************************************************/ 102 103 BOOLEAN btif_av_stream_ready(void); 104 105 /******************************************************************************* 106 ** 107 ** Function btif_av_stream_started_ready 108 ** 109 ** Description Checks whether AV ready for media start in streaming state 110 ** 111 ** Returns None 112 ** 113 *******************************************************************************/ 114 115 BOOLEAN btif_av_stream_started_ready(void); 116 117 /******************************************************************************* 118 ** 119 ** Function btif_dispatch_sm_event 120 ** 121 ** Description Send event to AV statemachine 122 ** 123 ** Returns None 124 ** 125 *******************************************************************************/ 126 127 /* used to pass events to AV statemachine from other tasks */ 128 void btif_dispatch_sm_event(btif_av_sm_event_t event, void *p_data, int len); 129 130 /******************************************************************************* 131 ** 132 ** Function btif_av_init 133 ** 134 ** Description Initializes btif AV if not already done 135 ** 136 ** Returns bt_status_t 137 ** 138 *******************************************************************************/ 139 140 bt_status_t btif_av_init(int service_id); 141 142 /******************************************************************************* 143 ** 144 ** Function btif_av_is_connected 145 ** 146 ** Description Checks if av has a connected sink 147 ** 148 ** Returns BOOLEAN 149 ** 150 *******************************************************************************/ 151 152 BOOLEAN btif_av_is_connected(void); 153 154 155 /******************************************************************************* 156 ** 157 ** Function btif_av_is_peer_edr 158 ** 159 ** Description Check if the connected a2dp device supports 160 ** EDR or not. Only when connected this function 161 ** will accurately provide a true capability of 162 ** remote peer. If not connected it will always be false. 163 ** 164 ** Returns TRUE if remote device is capable of EDR 165 ** 166 *******************************************************************************/ 167 168 BOOLEAN btif_av_is_peer_edr(void); 169 170 #ifdef USE_AUDIO_TRACK 171 /******************************************************************************* 172 ** 173 ** Function audio_focus_status 174 ** 175 ** Description Update Audio Focus State 176 ** 177 ** Returns None 178 ** 179 *******************************************************************************/ 180 void audio_focus_status(int state); 181 182 /******************************************************************************* 183 ** 184 ** Function btif_queue_focus_request 185 ** 186 ** Description This is used to move context to btif and 187 ** queue audio_focus_request 188 ** 189 ** Returns none 190 ** 191 *******************************************************************************/ 192 void btif_queue_focus_request(void); 193 #endif 194 195 /****************************************************************************** 196 ** 197 ** Function btif_av_clear_remote_suspend_flag 198 ** 199 ** Description Clears remote suspended flag 200 ** 201 ** Returns Void 202 ********************************************************************************/ 203 void btif_av_clear_remote_suspend_flag(void); 204 205 /******************************************************************************* 206 ** 207 ** Function btif_av_peer_supports_3mbps 208 ** 209 ** Description Check if the connected A2DP device supports 210 ** 3 Mbps EDR. This function will only work while connected. 211 ** If not connected it will always return false. 212 ** 213 ** Returns TRUE if remote device is EDR and supports 3 Mbps 214 ** 215 *******************************************************************************/ 216 BOOLEAN btif_av_peer_supports_3mbps(void); 217 218 #endif /* BTIF_AV_H */ 219