Fix build break for rpm
[framework/connectivity/bluez.git] / audio / headset.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  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #define AUDIO_HEADSET_INTERFACE "org.bluez.Headset"
26
27 #define DEFAULT_HS_AG_CHANNEL 12
28 #define DEFAULT_HF_AG_CHANNEL 13
29
30 typedef enum {
31         HEADSET_STATE_DISCONNECTED,
32         HEADSET_STATE_CONNECTING,
33         HEADSET_STATE_CONNECTED,
34         HEADSET_STATE_PLAY_IN_PROGRESS,
35         HEADSET_STATE_PLAYING
36 } headset_state_t;
37
38 typedef enum {
39         HEADSET_LOCK_READ = 1,
40         HEADSET_LOCK_WRITE = 1 << 1,
41 } headset_lock_t;
42
43 typedef void (*headset_state_cb) (struct audio_device *dev,
44                                         headset_state_t old_state,
45                                         headset_state_t new_state,
46                                         void *user_data);
47 typedef void (*headset_nrec_cb) (struct audio_device *dev,
48                                         gboolean nrec,
49                                         void *user_data);
50
51 unsigned int headset_add_state_cb(headset_state_cb cb, void *user_data);
52 gboolean headset_remove_state_cb(unsigned int id);
53
54 typedef void (*headset_stream_cb_t) (struct audio_device *dev, void *user_data);
55
56 void headset_connect_cb(GIOChannel *chan, GError *err, gpointer user_data);
57
58 GIOChannel *headset_get_rfcomm(struct audio_device *dev);
59
60 struct headset *headset_init(struct audio_device *dev, uint16_t svc,
61                                 const char *uuidstr);
62
63 void headset_unregister(struct audio_device *dev);
64
65 uint32_t headset_config_init(GKeyFile *config);
66
67 void headset_update(struct audio_device *dev, uint16_t svc,
68                         const char *uuidstr);
69
70 unsigned int headset_config_stream(struct audio_device *dev,
71                                         gboolean auto_dc,
72                                         headset_stream_cb_t cb,
73                                         void *user_data);
74 unsigned int headset_request_stream(struct audio_device *dev,
75                                         headset_stream_cb_t cb,
76                                         void *user_data);
77 unsigned int headset_suspend_stream(struct audio_device *dev,
78                                         headset_stream_cb_t cb,
79                                         void *user_data);
80 gboolean headset_cancel_stream(struct audio_device *dev, unsigned int id);
81
82 gboolean headset_get_hfp_active(struct audio_device *dev);
83 void headset_set_hfp_active(struct audio_device *dev, gboolean active);
84
85 gboolean headset_get_rfcomm_initiator(struct audio_device *dev);
86 void headset_set_rfcomm_initiator(struct audio_device *dev,
87                                                         gboolean initiator);
88
89 int headset_connect_rfcomm(struct audio_device *dev, GIOChannel *chan);
90 int headset_connect_sco(struct audio_device *dev, GIOChannel *io);
91
92 headset_state_t headset_get_state(struct audio_device *dev);
93 void headset_set_state(struct audio_device *dev, headset_state_t state);
94
95 int headset_get_channel(struct audio_device *dev);
96
97 int headset_get_sco_fd(struct audio_device *dev);
98 gboolean headset_get_nrec(struct audio_device *dev);
99 unsigned int headset_add_nrec_cb(struct audio_device *dev,
100                                         headset_nrec_cb cb, void *user_data);
101 gboolean headset_remove_nrec_cb(struct audio_device *dev, unsigned int id);
102 gboolean headset_get_inband(struct audio_device *dev);
103 gboolean headset_get_sco_hci(struct audio_device *dev);
104
105 gboolean headset_is_active(struct audio_device *dev);
106
107 headset_lock_t headset_get_lock(struct audio_device *dev);
108 gboolean headset_lock(struct audio_device *dev, headset_lock_t lock);
109 gboolean headset_unlock(struct audio_device *dev, headset_lock_t lock);
110 gboolean headset_suspend(struct audio_device *dev, void *data);
111 gboolean headset_play(struct audio_device *dev, void *data);
112 void headset_shutdown(struct audio_device *dev);