diff options
author | Forrest <forrest.zhao@gmail.com> | 2009-04-03 11:49:47 +0800 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-04-03 21:43:38 +0300 |
commit | e9ad28fb72de33caebb8b444b6ede1e7b852dc6e (patch) | |
tree | e6a45ba762c2a4c39a60905c96fcaab6cb18d723 /audio/gateway.c | |
parent | d041343f20d063f7850a412a3a4c6483e2f640ac (diff) | |
download | bluez-e9ad28fb72de33caebb8b444b6ede1e7b852dc6e.tar.gz |
Add basic framework support for HFP HF role (org.bluez.HeadsetGateway)
Diffstat (limited to 'audio/gateway.c')
-rw-r--r-- | audio/gateway.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/audio/gateway.c b/audio/gateway.c index edf38deb9..cf37e4b2a 100644 --- a/audio/gateway.c +++ b/audio/gateway.c @@ -4,6 +4,7 @@ * * Copyright (C) 2006-2007 Nokia Corporation * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2008-2009 Leonid Movshovich <event.riga@gmail.org> * * * This program is free software; you can redistribute it and/or modify @@ -27,8 +28,71 @@ #endif #include <stdint.h> +#include <errno.h> #include <glib.h> #include <dbus/dbus.h> +#include <gdbus.h> +#include <bluetooth/bluetooth.h> + +#include "device.h" #include "gateway.h" + +struct gateway { + GIOChannel *rfcomm; + guint rfcomm_watch_id; + GIOChannel *sco; + GIOChannel *sco_server; + gateway_stream_cb_t sco_start_cb; + void *sco_start_cb_data; + DBusMessage *connect_message; + guint ag_features; + guint hold_multiparty_features; + GSList *indies; + gboolean is_dialing; +}; + +static GDBusMethodTable gateway_methods[] = { + { NULL, NULL, NULL, NULL } +}; + +static GDBusSignalTable gateway_signals[] = { + { NULL, NULL } +}; + +struct gateway *gateway_init(struct audio_device *dev) +{ + struct gateway *gw; + + if (!g_dbus_register_interface(dev->conn, dev->path, + AUDIO_GATEWAY_INTERFACE, + gateway_methods, gateway_signals, + NULL, dev, NULL)) + return NULL; + + gw = g_new0(struct gateway, 1); + gw->indies = NULL; + gw->is_dialing = FALSE; + return gw; + +} + +gboolean gateway_is_connected(struct audio_device *dev) +{ + return (dev && dev->gateway && dev->gateway->rfcomm); +} + +int gateway_connect_rfcomm(struct audio_device *dev, GIOChannel *io) +{ + if (!io) + return -EINVAL; + + dev->gateway->rfcomm = io; + + return 0; +} + +void gateway_start_service(struct audio_device *device) +{ +} |