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_GATEWAY_INTERFACE "org.bluez.HandsfreeGateway" 26 27 #define DEFAULT_HFP_HS_CHANNEL 7 28 29 typedef enum { 30 GATEWAY_STATE_DISCONNECTED, 31 GATEWAY_STATE_CONNECTING, 32 GATEWAY_STATE_CONNECTED, 33 GATEWAY_STATE_PLAYING, 34 } gateway_state_t; 35 36 typedef void (*gateway_stream_cb_t) (struct audio_device *dev, GError *err, 37 void *user_data); 38 39 void gateway_unregister(struct audio_device *dev); 40 struct gateway *gateway_init(struct audio_device *device); 41 gboolean gateway_is_connected(struct audio_device *dev); 42 int gateway_connect_rfcomm(struct audio_device *dev, GIOChannel *io); 43 int gateway_connect_sco(struct audio_device *dev, GIOChannel *chan); 44 void gateway_start_service(struct audio_device *device); 45 gboolean gateway_request_stream(struct audio_device *dev, 46 gateway_stream_cb_t cb, void *user_data); 47 int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb, 48 void *user_data); 49 gboolean gateway_cancel_stream(struct audio_device *dev, unsigned int id); 50 int gateway_get_sco_fd(struct audio_device *dev); 51 void gateway_suspend_stream(struct audio_device *dev); 52