Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / profiles / audio / a2dp.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2006-2010  Nokia Corporation
6  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
7  *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
8  *
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23  *
24  */
25
26 struct a2dp_sep;
27 struct a2dp_setup;
28
29 typedef void (*a2dp_endpoint_select_t) (struct a2dp_setup *setup, void *ret,
30                                         int size);
31 typedef void (*a2dp_endpoint_config_t) (struct a2dp_setup *setup, gboolean ret);
32
33 struct a2dp_endpoint {
34         const char *(*get_name) (struct a2dp_sep *sep, void *user_data);
35         size_t (*get_capabilities) (struct a2dp_sep *sep,
36                                                 uint8_t **capabilities,
37                                                 void *user_data);
38         int (*select_configuration) (struct a2dp_sep *sep,
39                                                 uint8_t *capabilities,
40                                                 size_t length,
41                                                 struct a2dp_setup *setup,
42                                                 a2dp_endpoint_select_t cb,
43                                                 void *user_data);
44         int (*set_configuration) (struct a2dp_sep *sep,
45                                                 uint8_t *configuration,
46                                                 size_t length,
47                                                 struct a2dp_setup *setup,
48                                                 a2dp_endpoint_config_t cb,
49                                                 void *user_data);
50         void (*clear_configuration) (struct a2dp_sep *sep, void *user_data);
51         void (*set_delay) (struct a2dp_sep *sep, uint16_t delay,
52                                                         void *user_data);
53 };
54
55 typedef void (*a2dp_discover_cb_t) (struct avdtp *session, GSList *seps,
56                                         struct avdtp_error *err,
57                                         void *user_data);
58 typedef void (*a2dp_select_cb_t) (struct avdtp *session,
59                                         struct a2dp_sep *sep, GSList *caps,
60                                         void *user_data);
61 typedef void (*a2dp_config_cb_t) (struct avdtp *session, struct a2dp_sep *sep,
62                                         struct avdtp_stream *stream,
63                                         struct avdtp_error *err,
64                                         void *user_data);
65 typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
66                                         struct avdtp_error *err,
67                                         void *user_data);
68
69 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
70                                 uint8_t codec, gboolean delay_reporting,
71                                 struct a2dp_endpoint *endpoint,
72                                 void *user_data, GDestroyNotify destroy,
73                                 int *err);
74 void a2dp_remove_sep(struct a2dp_sep *sep);
75
76
77 unsigned int a2dp_discover(struct avdtp *session, a2dp_discover_cb_t cb,
78                                                         void *user_data);
79 unsigned int a2dp_select_capabilities(struct avdtp *session,
80                                         uint8_t type, const char *sender,
81                                         a2dp_select_cb_t cb,
82                                         void *user_data);
83 unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
84                                 a2dp_config_cb_t cb, GSList *caps,
85                                 void *user_data);
86 unsigned int a2dp_resume(struct avdtp *session, struct a2dp_sep *sep,
87                                 a2dp_stream_cb_t cb, void *user_data);
88 unsigned int a2dp_suspend(struct avdtp *session, struct a2dp_sep *sep,
89                                 a2dp_stream_cb_t cb, void *user_data);
90 gboolean a2dp_cancel(unsigned int id);
91
92 gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session);
93 gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session);
94 struct avdtp_stream *a2dp_sep_get_stream(struct a2dp_sep *sep);
95 struct btd_device *a2dp_setup_get_device(struct a2dp_setup *setup);
96 struct avdtp *a2dp_avdtp_get(struct btd_device *device);