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 "bta_av_api.h" 32 #include "btif_common.h" 33 #include "btif_sm.h" 34 35 /******************************************************************************* 36 * Type definitions for callback functions 37 ******************************************************************************/ 38 39 typedef enum { 40 /* Reuse BTA_AV_XXX_EVT - No need to redefine them here */ 41 BTIF_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT, 42 BTIF_AV_DISCONNECT_REQ_EVT, 43 BTIF_AV_START_STREAM_REQ_EVT, 44 BTIF_AV_STOP_STREAM_REQ_EVT, 45 BTIF_AV_SUSPEND_STREAM_REQ_EVT, 46 BTIF_AV_SOURCE_CONFIG_REQ_EVT, 47 BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, 48 BTIF_AV_SINK_CONFIG_REQ_EVT, 49 BTIF_AV_OFFLOAD_START_REQ_EVT, 50 BTIF_AV_CLEANUP_REQ_EVT, 51 } btif_av_sm_event_t; 52 53 /******************************************************************************* 54 * BTIF AV API 55 ******************************************************************************/ 56 57 /******************************************************************************* 58 * 59 * Function btif_av_get_addr 60 * 61 * Description Fetches current AV BD address 62 * 63 * Returns BD address 64 * 65 ******************************************************************************/ 66 67 bt_bdaddr_t btif_av_get_addr(void); 68 69 /******************************************************************************* 70 * Function btif_av_is_sink_enabled 71 * 72 * Description Checks if A2DP Sink is enabled or not 73 * 74 * Returns true if A2DP Sink is enabled, false otherwise 75 * 76 ******************************************************************************/ 77 78 bool btif_av_is_sink_enabled(void); 79 80 /******************************************************************************* 81 * 82 * Function btif_av_stream_ready 83 * 84 * Description Checks whether AV is ready for starting a stream 85 * 86 * Returns None 87 * 88 ******************************************************************************/ 89 90 bool btif_av_stream_ready(void); 91 92 /******************************************************************************* 93 * 94 * Function btif_av_stream_started_ready 95 * 96 * Description Checks whether AV ready for media start in streaming state 97 * 98 * Returns None 99 * 100 ******************************************************************************/ 101 102 bool btif_av_stream_started_ready(void); 103 104 /******************************************************************************* 105 * 106 * Function btif_dispatch_sm_event 107 * 108 * Description Send event to AV statemachine 109 * 110 * Returns None 111 * 112 ******************************************************************************/ 113 114 /* used to pass events to AV statemachine from other tasks */ 115 void btif_dispatch_sm_event(btif_av_sm_event_t event, void* p_data, int len); 116 117 /******************************************************************************* 118 * 119 * Function btif_av_init 120 * 121 * Description Initializes btif AV if not already done 122 * 123 * Returns bt_status_t 124 * 125 ******************************************************************************/ 126 127 bt_status_t btif_av_init(int service_id); 128 129 /******************************************************************************* 130 * 131 * Function btif_av_is_connected 132 * 133 * Description Checks if av has a connected sink 134 * 135 * Returns bool 136 * 137 ******************************************************************************/ 138 139 bool btif_av_is_connected(void); 140 141 /******************************************************************************* 142 * 143 * Function btif_av_get_peer_sep 144 * 145 * Description Get the stream endpoint type. 146 * 147 * Returns The stream endpoint type: either AVDT_TSEP_SRC or 148 * AVDT_TSEP_SNK. 149 * 150 ******************************************************************************/ 151 152 uint8_t btif_av_get_peer_sep(void); 153 154 /******************************************************************************* 155 * 156 * Function btif_av_is_peer_edr 157 * 158 * Description Check if the connected a2dp device supports 159 * EDR or not. Only when connected this function 160 * will accurately provide a true capability of 161 * remote peer. If not connected it will always be false. 162 * 163 * Returns true if remote device is capable of EDR 164 * 165 ******************************************************************************/ 166 167 bool btif_av_is_peer_edr(void); 168 169 /****************************************************************************** 170 * 171 * Function btif_av_clear_remote_suspend_flag 172 * 173 * Description Clears remote suspended flag 174 * 175 * Returns Void 176 ******************************************************************************/ 177 void btif_av_clear_remote_suspend_flag(void); 178 179 /******************************************************************************* 180 * 181 * Function btif_av_peer_supports_3mbps 182 * 183 * Description Check if the connected A2DP device supports 184 * 3 Mbps EDR. This function will only work while connected. 185 * If not connected it will always return false. 186 * 187 * Returns true if remote device is EDR and supports 3 Mbps 188 * 189 ******************************************************************************/ 190 bool btif_av_peer_supports_3mbps(void); 191 192 #endif /* BTIF_AV_H */ 193