~ubuntu-branches/ubuntu/wily/bluez/wily

« back to all changes in this revision

Viewing changes to audio/avdtp.h

ImportĀ upstreamĀ versionĀ 4.81

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 *  BlueZ - Bluetooth protocol stack for Linux
4
4
 *
5
 
 *  Copyright (C) 2006-2007  Nokia Corporation
6
 
 *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@holtmann.org>
 
5
 *  Copyright (C) 2006-2010  Nokia Corporation
 
6
 *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
7
7
 *
8
8
 *
9
9
 *  This program is free software; you can redistribute it and/or modify
23
23
 */
24
24
 
25
25
typedef enum {
26
 
        AVDTP_ERROR_ERRNO,
27
 
        AVDTP_ERROR_ERROR_CODE
28
 
} avdtp_error_type_t;
29
 
 
30
 
typedef enum {
31
26
        AVDTP_SESSION_STATE_DISCONNECTED,
32
27
        AVDTP_SESSION_STATE_CONNECTING,
33
28
        AVDTP_SESSION_STATE_CONNECTED
38
33
struct avdtp_local_sep;
39
34
struct avdtp_remote_sep;
40
35
struct avdtp_error {
41
 
        avdtp_error_type_t type;
 
36
        uint8_t category;
42
37
        union {
43
38
                uint8_t error_code;
44
39
                int posix_errno;
53
48
#define AVDTP_HEADER_COMPRESSION                0x05
54
49
#define AVDTP_MULTIPLEXING                      0x06
55
50
#define AVDTP_MEDIA_CODEC                       0x07
 
51
#define AVDTP_DELAY_REPORTING                   0x08
 
52
#define AVDTP_ERRNO                             0xff
56
53
 
57
54
/* AVDTP error definitions */
58
55
#define AVDTP_BAD_HEADER_FORMAT                 0x01
131
128
                                        struct avdtp_error *err,
132
129
                                        void *user_data);
133
130
 
 
131
typedef void (*avdtp_set_configuration_cb) (struct avdtp *session,
 
132
                                                struct avdtp_stream *stream,
 
133
                                                struct avdtp_error *err);
 
134
 
134
135
/* Callbacks for when a reply is received to a command that we sent */
135
136
struct avdtp_sep_cfm {
136
137
        void (*set_configuration) (struct avdtp *session,
162
163
                                struct avdtp_local_sep *lsep,
163
164
                                struct avdtp_stream *stream,
164
165
                                struct avdtp_error *err, void *user_data);
 
166
        void (*delay_report) (struct avdtp *session, struct avdtp_local_sep *lsep,
 
167
                                struct avdtp_stream *stream,
 
168
                                struct avdtp_error *err, void *user_data);
165
169
};
166
170
 
167
171
/* Callbacks for indicating when we received a new command. The return value
169
173
struct avdtp_sep_ind {
170
174
        gboolean (*get_capability) (struct avdtp *session,
171
175
                                        struct avdtp_local_sep *sep,
 
176
                                        gboolean get_all,
172
177
                                        GSList **caps, uint8_t *err,
173
178
                                        void *user_data);
174
179
        gboolean (*set_configuration) (struct avdtp *session,
175
180
                                        struct avdtp_local_sep *lsep,
176
181
                                        struct avdtp_stream *stream,
177
 
                                        GSList *caps, uint8_t *err,
178
 
                                        uint8_t *category, void *user_data);
 
182
                                        GSList *caps,
 
183
                                        avdtp_set_configuration_cb cb,
 
184
                                        void *user_data);
179
185
        gboolean (*get_configuration) (struct avdtp *session,
180
186
                                        struct avdtp_local_sep *lsep,
181
187
                                        uint8_t *err, void *user_data);
198
204
        gboolean (*reconfigure) (struct avdtp *session,
199
205
                                        struct avdtp_local_sep *lsep,
200
206
                                        uint8_t *err, void *user_data);
 
207
        gboolean (*delayreport) (struct avdtp *session,
 
208
                                        struct avdtp_local_sep *lsep,
 
209
                                        uint8_t rseid, uint16_t delay,
 
210
                                        uint8_t *err, void *user_data);
201
211
};
202
212
 
203
213
typedef void (*avdtp_discover_cb_t) (struct avdtp *session, GSList *seps,
222
232
 
223
233
struct avdtp_service_capability *avdtp_get_codec(struct avdtp_remote_sep *sep);
224
234
 
 
235
gboolean avdtp_get_delay_reporting(struct avdtp_remote_sep *sep);
 
236
 
225
237
struct avdtp_stream *avdtp_get_stream(struct avdtp_remote_sep *sep);
226
238
 
227
239
int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb,
264
276
                        struct avdtp_stream *stream);
265
277
int avdtp_start(struct avdtp *session, struct avdtp_stream *stream);
266
278
int avdtp_suspend(struct avdtp *session, struct avdtp_stream *stream);
267
 
int avdtp_close(struct avdtp *session, struct avdtp_stream *stream);
 
279
int avdtp_close(struct avdtp *session, struct avdtp_stream *stream,
 
280
                gboolean immediate);
268
281
int avdtp_abort(struct avdtp *session, struct avdtp_stream *stream);
 
282
int avdtp_delay_report(struct avdtp *session, struct avdtp_stream *stream,
 
283
                                                        uint16_t delay);
269
284
 
270
285
struct avdtp_local_sep *avdtp_register_sep(const bdaddr_t *src, uint8_t type,
271
286
                                                uint8_t media_type,
272
287
                                                uint8_t codec_type,
 
288
                                                gboolean delay_reporting,
273
289
                                                struct avdtp_sep_ind *ind,
274
290
                                                struct avdtp_sep_cfm *cfm,
275
291
                                                void *user_data);
276
292
 
277
293
/* Find a matching pair of local and remote SEP ID's */
278
 
int avdtp_get_seps(struct avdtp *session, uint8_t type, uint8_t media,
279
 
                        uint8_t codec, struct avdtp_local_sep **lsep,
280
 
                        struct avdtp_remote_sep **rsep);
 
294
struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session,
 
295
                                                struct avdtp_local_sep *lsep);
281
296
 
282
297
int avdtp_unregister_sep(struct avdtp_local_sep *sep);
283
298
 
285
300
 
286
301
void avdtp_error_init(struct avdtp_error *err, uint8_t type, int id);
287
302
const char *avdtp_strerror(struct avdtp_error *err);
288
 
avdtp_error_type_t avdtp_error_type(struct avdtp_error *err);
 
303
uint8_t avdtp_error_category(struct avdtp_error *err);
289
304
int avdtp_error_error_code(struct avdtp_error *err);
290
305
int avdtp_error_posix_errno(struct avdtp_error *err);
291
306
 
293
308
 
294
309
void avdtp_set_auto_disconnect(struct avdtp *session, gboolean auto_dc);
295
310
gboolean avdtp_stream_setup_active(struct avdtp *session);
 
311
void avdtp_set_device_disconnect(struct avdtp *session, gboolean dev_dc);
296
312
 
297
 
int avdtp_init(const bdaddr_t *src, GKeyFile *config);
 
313
int avdtp_init(const bdaddr_t *src, GKeyFile *config, uint16_t *version);
298
314
void avdtp_exit(const bdaddr_t *src);