bt_av.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 #ifndef ANDROID_INCLUDE_BT_AV_H
18 #define ANDROID_INCLUDE_BT_AV_H
19 
20 __BEGIN_DECLS
21 
22 /* Bluetooth AV connection states */
23 typedef enum {
29 
30 /* Bluetooth AV datapath states */
31 typedef enum {
36 
37 
38 /** Callback for connection state change.
39  * state will have one of the values from btav_connection_state_t
40  */
42  bt_bdaddr_t *bd_addr);
43 
44 /** Callback for audiopath state change.
45  * state will have one of the values from btav_audio_state_t
46  */
48  bt_bdaddr_t *bd_addr);
49 
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)
55  */
56 typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
57  uint32_t sample_rate,
58  uint8_t channel_count);
59 
60 /** BT-AV callback structure. */
61 typedef struct {
62  /** set to sizeof(btav_callbacks_t) */
63  size_t size;
68 
69 /**
70  * NOTE:
71  *
72  * 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands
73  * shall be handled internally via uinput
74  *
75  * 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger
76  * android_audio_hw library and the Bluetooth stack.
77  *
78  */
79 /** Represents the standard BT-AV interface.
80  * Used for both the A2DP source and sink interfaces.
81  */
82 typedef struct {
83 
84  /** set to sizeof(btav_interface_t) */
85  size_t size;
86  /**
87  * Register the BtAv callbacks
88  */
89  bt_status_t (*init)( btav_callbacks_t* callbacks );
90 
91  /** connect to headset */
92  bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
93 
94  /** dis-connect from headset */
95  bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
96 
97  /** Closes the interface. */
98  void (*cleanup)( void );
100 
101 __END_DECLS
102 
103 #endif /* ANDROID_INCLUDE_BT_AV_H */
btav_audio_state_t
Definition: bt_av.h:31
size_t size
Definition: bt_av.h:63
void(* btav_connection_state_callback)(btav_connection_state_t state, bt_bdaddr_t *bd_addr)
Definition: bt_av.h:41
void(* btav_audio_state_callback)(btav_audio_state_t state, bt_bdaddr_t *bd_addr)
Definition: bt_av.h:47
bt_status_t
Definition: bluetooth.h:80
btav_audio_config_callback audio_config_cb
Definition: bt_av.h:66
btav_connection_state_t
Definition: bt_av.h:23
btav_connection_state_callback connection_state_cb
Definition: bt_av.h:64
btav_audio_state_callback audio_state_cb
Definition: bt_av.h:65
size_t size
Definition: bt_av.h:85
void(* btav_audio_config_callback)(bt_bdaddr_t *bd_addr, uint32_t sample_rate, uint8_t channel_count)
Definition: bt_av.h:56