tizen 2.3 release
[framework/connectivity/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_select_cb_t) (struct avdtp *session,
56                                         struct a2dp_sep *sep, GSList *caps,
57                                         void *user_data);
58 typedef void (*a2dp_config_cb_t) (struct avdtp *session, struct a2dp_sep *sep,
59                                         struct avdtp_stream *stream,
60                                         struct avdtp_error *err,
61                                         void *user_data);
62 typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
63                                         struct avdtp_error *err,
64                                         void *user_data);
65
66 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
67                                 uint8_t codec, gboolean delay_reporting,
68                                 struct a2dp_endpoint *endpoint,
69                                 void *user_data, GDestroyNotify destroy,
70                                 int *err);
71 void a2dp_remove_sep(struct a2dp_sep *sep);
72
73 unsigned int a2dp_select_capabilities(struct avdtp *session,
74                                         uint8_t type, const char *sender,
75                                         a2dp_select_cb_t cb,
76                                         void *user_data);
77 unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
78                                 a2dp_config_cb_t cb, GSList *caps,
79                                 void *user_data);
80 unsigned int a2dp_resume(struct avdtp *session, struct a2dp_sep *sep,
81                                 a2dp_stream_cb_t cb, void *user_data);
82 unsigned int a2dp_suspend(struct avdtp *session, struct a2dp_sep *sep,
83                                 a2dp_stream_cb_t cb, void *user_data);
84 gboolean a2dp_cancel(unsigned int id);
85
86 gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session);
87 gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session);
88 struct avdtp_stream *a2dp_sep_get_stream(struct a2dp_sep *sep);
89 struct btd_device *a2dp_setup_get_device(struct a2dp_setup *setup);