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_sm_event_t;
49 
50 
51 /*******************************************************************************
52 **  BTIF AV API
53 ********************************************************************************/
54 
55 /*******************************************************************************
56 **
57 ** Function         btif_av_get_sm_handle
58 **
59 ** Description      Fetches current av SM handle
60 **
61 ** Returns          None
62 **
63 *******************************************************************************/
64 
65 btif_sm_handle_t btif_av_get_sm_handle(void);
66 
67 /*******************************************************************************
68 **
69 ** Function         btif_av_stream_ready
70 **
71 ** Description      Checks whether AV is ready for starting a stream
72 **
73 ** Returns          None
74 **
75 *******************************************************************************/
76 
77 BOOLEAN btif_av_stream_ready(void);
78 
79 /*******************************************************************************
80 **
81 ** Function         btif_av_stream_started_ready
82 **
83 ** Description      Checks whether AV ready for media start in streaming state
84 **
85 ** Returns          None
86 **
87 *******************************************************************************/
88 
89 BOOLEAN btif_av_stream_started_ready(void);
90 
91 /*******************************************************************************
92 **
93 ** Function         btif_dispatch_sm_event
94 **
95 ** Description      Send event to AV statemachine
96 **
97 ** Returns          None
98 **
99 *******************************************************************************/
100 
101 /* used to pass events to AV statemachine from other tasks */
102 void btif_dispatch_sm_event(btif_av_sm_event_t event, void *p_data, int len);
103 
104 /*******************************************************************************
105 **
106 ** Function         btif_av_init
107 **
108 ** Description      Initializes btif AV if not already done
109 **
110 ** Returns          bt_status_t
111 **
112 *******************************************************************************/
113 
114 bt_status_t btif_av_init(void);
115 
116 /*******************************************************************************
117 **
118 ** Function         btif_av_is_connected
119 **
120 ** Description      Checks if av has a connected sink
121 **
122 ** Returns          BOOLEAN
123 **
124 *******************************************************************************/
125 
126 BOOLEAN btif_av_is_connected(void);
127 
128 
129 /*******************************************************************************
130 **
131 ** Function         btif_av_is_peer_edr
132 **
133 ** Description      Check if the connected a2dp device supports
134 **                  EDR or not. Only when connected this function
135 **                  will accurately provide a true capability of
136 **                  remote peer. If not connected it will always be false.
137 **
138 ** Returns          TRUE if remote device is capable of EDR
139 **
140 *******************************************************************************/
141 
142 BOOLEAN btif_av_is_peer_edr(void);
143 
144 /******************************************************************************
145 **
146 ** Function         btif_av_clear_remote_suspend_flag
147 **
148 ** Description      Clears remote suspended flag
149 **
150 ** Returns          Void
151 ********************************************************************************/
152 void btif_av_clear_remote_suspend_flag(void);
153 
154 #endif /* BTIF_AV_H */
155