3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2006-2010 Nokia Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
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.
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.
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
25 #define AUDIO_HEADSET_INTERFACE "org.bluez.Headset"
27 #define DEFAULT_HS_AG_CHANNEL 12
28 #define DEFAULT_HF_AG_CHANNEL 13
31 HEADSET_STATE_DISCONNECTED,
32 HEADSET_STATE_CONNECTING,
33 HEADSET_STATE_CONNECTED,
34 HEADSET_STATE_PLAY_IN_PROGRESS,
39 HEADSET_LOCK_READ = 1,
40 HEADSET_LOCK_WRITE = 1 << 1,
43 typedef void (*headset_state_cb) (struct audio_device *dev,
44 headset_state_t old_state,
45 headset_state_t new_state,
47 typedef void (*headset_nrec_cb) (struct audio_device *dev,
51 unsigned int headset_add_state_cb(headset_state_cb cb, void *user_data);
52 gboolean headset_remove_state_cb(unsigned int id);
54 typedef void (*headset_stream_cb_t) (struct audio_device *dev, void *user_data);
56 void headset_connect_cb(GIOChannel *chan, GError *err, gpointer user_data);
58 GIOChannel *headset_get_rfcomm(struct audio_device *dev);
60 struct headset *headset_init(struct audio_device *dev, uint16_t svc,
63 void headset_unregister(struct audio_device *dev);
65 uint32_t headset_config_init(GKeyFile *config);
67 void headset_update(struct audio_device *dev, uint16_t svc,
70 unsigned int headset_config_stream(struct audio_device *dev,
72 headset_stream_cb_t cb,
74 unsigned int headset_request_stream(struct audio_device *dev,
75 headset_stream_cb_t cb,
77 unsigned int headset_suspend_stream(struct audio_device *dev,
78 headset_stream_cb_t cb,
80 gboolean headset_cancel_stream(struct audio_device *dev, unsigned int id);
82 gboolean headset_get_hfp_active(struct audio_device *dev);
83 void headset_set_hfp_active(struct audio_device *dev, gboolean active);
85 gboolean headset_get_rfcomm_initiator(struct audio_device *dev);
86 void headset_set_rfcomm_initiator(struct audio_device *dev,
89 int headset_connect_rfcomm(struct audio_device *dev, GIOChannel *chan);
90 int headset_connect_sco(struct audio_device *dev, GIOChannel *io);
92 headset_state_t headset_get_state(struct audio_device *dev);
93 void headset_set_state(struct audio_device *dev, headset_state_t state);
95 int headset_get_channel(struct audio_device *dev);
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);
105 gboolean headset_is_active(struct audio_device *dev);
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);