2 * Copyright (C) 2012 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ANDROID_INCLUDE_BT_AV_H
18 #define ANDROID_INCLUDE_BT_AV_H
22 /* Bluetooth AV connection states */
24 BTAV_CONNECTION_STATE_DISCONNECTED = 0,
25 BTAV_CONNECTION_STATE_CONNECTING,
26 BTAV_CONNECTION_STATE_CONNECTED,
27 BTAV_CONNECTION_STATE_DISCONNECTING
28 } btav_connection_state_t;
30 /* Bluetooth AV datapath states */
32 BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0,
33 BTAV_AUDIO_STATE_STOPPED,
34 BTAV_AUDIO_STATE_STARTED,
38 /** Callback for connection state change.
39 * state will have one of the values from btav_connection_state_t
41 typedef void (*btav_connection_state_callback)(btav_connection_state_t state,
42 bt_bdaddr_t *bd_addr);
44 /** Callback for audiopath state change.
45 * state will have one of the values from btav_audio_state_t
47 typedef void (*btav_audio_state_callback)(btav_audio_state_t state,
48 bt_bdaddr_t *bd_addr);
50 /** Callback for audio configuration change.
51 * Used only for the A2DP sink interface.
52 * state will have one of the values from btav_audio_state_t
53 * sample_rate: sample rate in Hz
54 * channel_count: number of channels (1 for mono, 2 for stereo)
56 typedef void (*btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
58 uint8_t channel_count);
60 /** BT-AV callback structure. */
62 /** set to sizeof(btav_callbacks_t) */
64 btav_connection_state_callback connection_state_cb;
65 btav_audio_state_callback audio_state_cb;
66 btav_audio_config_callback audio_config_cb;
72 * 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands
73 * shall be handled internally via uinput
75 * 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger
76 * android_audio_hw library and the Bluetooth stack.
79 /** Represents the standard BT-AV interface.
80 * Used for both the A2DP source and sink interfaces.
84 /** set to sizeof(btav_interface_t) */
87 * Register the BtAv callbacks
89 bt_status_t (*init)(btav_callbacks_t* callbacks);
91 /** connect to headset */
92 bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
94 /** dis-connect from headset */
95 bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
97 /** Closes the interface. */
98 void (*cleanup)(void);
103 #endif /* ANDROID_INCLUDE_BT_AV_H */