2007-04-09 07:13:18 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
2010-01-07 17:02:51 +08:00
|
|
|
* Copyright (C) 2006-2010 Nokia Corporation
|
2010-01-02 09:08:17 +08:00
|
|
|
* Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
|
2007-04-09 07:13:18 +08:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
2007-06-07 01:58:19 +08:00
|
|
|
|
2008-09-06 07:09:05 +08:00
|
|
|
#define AUDIO_HEADSET_INTERFACE "org.bluez.Headset"
|
2007-05-09 23:51:02 +08:00
|
|
|
|
2007-06-23 04:58:12 +08:00
|
|
|
#define DEFAULT_HS_AG_CHANNEL 12
|
|
|
|
#define DEFAULT_HF_AG_CHANNEL 13
|
2007-05-15 20:45:35 +08:00
|
|
|
|
2007-06-23 04:58:12 +08:00
|
|
|
typedef enum {
|
2007-08-11 19:05:24 +08:00
|
|
|
HEADSET_STATE_DISCONNECTED,
|
2009-09-02 02:27:28 +08:00
|
|
|
HEADSET_STATE_CONNECTING,
|
2007-08-11 19:05:24 +08:00
|
|
|
HEADSET_STATE_CONNECTED,
|
|
|
|
HEADSET_STATE_PLAY_IN_PROGRESS,
|
|
|
|
HEADSET_STATE_PLAYING
|
2007-06-23 04:58:12 +08:00
|
|
|
} headset_state_t;
|
2007-05-31 17:23:17 +08:00
|
|
|
|
2007-08-31 19:51:43 +08:00
|
|
|
typedef enum {
|
|
|
|
HEADSET_LOCK_READ = 1,
|
|
|
|
HEADSET_LOCK_WRITE = 1 << 1,
|
|
|
|
} headset_lock_t;
|
|
|
|
|
2009-03-27 22:57:40 +08:00
|
|
|
typedef void (*headset_state_cb) (struct audio_device *dev,
|
|
|
|
headset_state_t old_state,
|
|
|
|
headset_state_t new_state,
|
|
|
|
void *user_data);
|
2011-01-18 18:00:15 +08:00
|
|
|
typedef void (*headset_nrec_cb) (struct audio_device *dev,
|
|
|
|
gboolean nrec,
|
|
|
|
void *user_data);
|
2009-03-27 22:57:40 +08:00
|
|
|
|
|
|
|
unsigned int headset_add_state_cb(headset_state_cb cb, void *user_data);
|
|
|
|
gboolean headset_remove_state_cb(unsigned int id);
|
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
typedef void (*headset_stream_cb_t) (struct audio_device *dev, void *user_data);
|
2007-08-27 19:31:01 +08:00
|
|
|
|
2009-02-20 03:08:20 +08:00
|
|
|
void headset_connect_cb(GIOChannel *chan, GError *err, gpointer user_data);
|
|
|
|
|
|
|
|
GIOChannel *headset_get_rfcomm(struct audio_device *dev);
|
|
|
|
|
2008-10-09 20:11:16 +08:00
|
|
|
struct headset *headset_init(struct audio_device *dev, uint16_t svc,
|
|
|
|
const char *uuidstr);
|
2007-05-31 17:23:17 +08:00
|
|
|
|
2008-07-31 04:57:50 +08:00
|
|
|
void headset_unregister(struct audio_device *dev);
|
2007-04-10 19:44:10 +08:00
|
|
|
|
2008-01-23 02:01:19 +08:00
|
|
|
uint32_t headset_config_init(GKeyFile *config);
|
2008-01-16 17:08:26 +08:00
|
|
|
|
2008-10-09 20:11:16 +08:00
|
|
|
void headset_update(struct audio_device *dev, uint16_t svc,
|
|
|
|
const char *uuidstr);
|
2007-05-19 02:26:56 +08:00
|
|
|
|
2008-11-27 01:50:16 +08:00
|
|
|
unsigned int headset_config_stream(struct audio_device *dev,
|
2009-04-02 22:30:31 +08:00
|
|
|
gboolean auto_dc,
|
2008-11-27 01:50:16 +08:00
|
|
|
headset_stream_cb_t cb,
|
|
|
|
void *user_data);
|
2008-05-29 16:05:16 +08:00
|
|
|
unsigned int headset_request_stream(struct audio_device *dev,
|
2008-11-25 22:42:25 +08:00
|
|
|
headset_stream_cb_t cb,
|
2008-11-26 03:11:24 +08:00
|
|
|
void *user_data);
|
|
|
|
unsigned int headset_suspend_stream(struct audio_device *dev,
|
|
|
|
headset_stream_cb_t cb,
|
2008-11-25 22:42:25 +08:00
|
|
|
void *user_data);
|
2008-05-29 16:05:16 +08:00
|
|
|
gboolean headset_cancel_stream(struct audio_device *dev, unsigned int id);
|
2007-04-10 19:44:10 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
gboolean get_hfp_active(struct audio_device *dev);
|
|
|
|
void set_hfp_active(struct audio_device *dev, gboolean active);
|
2007-06-07 01:58:19 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
void headset_set_authorized(struct audio_device *dev);
|
|
|
|
int headset_connect_rfcomm(struct audio_device *dev, GIOChannel *chan);
|
2008-09-10 20:35:45 +08:00
|
|
|
int headset_connect_sco(struct audio_device *dev, GIOChannel *io);
|
2007-06-28 00:58:19 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
headset_state_t headset_get_state(struct audio_device *dev);
|
|
|
|
void headset_set_state(struct audio_device *dev, headset_state_t state);
|
2007-08-11 19:05:24 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
int headset_get_channel(struct audio_device *dev);
|
2007-08-11 19:05:24 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
int headset_get_sco_fd(struct audio_device *dev);
|
2008-12-15 22:11:23 +08:00
|
|
|
gboolean headset_get_nrec(struct audio_device *dev);
|
2011-01-18 18:00:15 +08:00
|
|
|
unsigned int headset_add_nrec_cb(struct audio_device *dev,
|
|
|
|
headset_nrec_cb cb, void *user_data);
|
|
|
|
gboolean headset_remove_nrec_cb(struct audio_device *dev, unsigned int id);
|
2010-09-13 17:19:58 +08:00
|
|
|
gboolean headset_get_inband(struct audio_device *dev);
|
2009-02-19 02:50:46 +08:00
|
|
|
gboolean headset_get_sco_hci(struct audio_device *dev);
|
2007-08-27 19:31:01 +08:00
|
|
|
|
2008-05-29 16:05:16 +08:00
|
|
|
gboolean headset_is_active(struct audio_device *dev);
|
2007-08-16 23:42:10 +08:00
|
|
|
|
2009-03-20 03:16:19 +08:00
|
|
|
headset_lock_t headset_get_lock(struct audio_device *dev);
|
2008-05-29 16:05:16 +08:00
|
|
|
gboolean headset_lock(struct audio_device *dev, headset_lock_t lock);
|
|
|
|
gboolean headset_unlock(struct audio_device *dev, headset_lock_t lock);
|
|
|
|
gboolean headset_suspend(struct audio_device *dev, void *data);
|
|
|
|
gboolean headset_play(struct audio_device *dev, void *data);
|
2009-07-03 05:12:43 +08:00
|
|
|
void headset_shutdown(struct audio_device *dev);
|