Open Source Telephony
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau <frederic.dalleau@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 9/9] hsp_ag: add audio connection support
Date: Thu, 17 Mar 2011 19:55:48 +0100	[thread overview]
Message-ID: <1300388148-925-10-git-send-email-frederic.dalleau@linux.intel.com> (raw)
In-Reply-To: <1300388148-925-1-git-send-email-frederic.dalleau@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]

---
 plugins/hsp_ag.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/plugins/hsp_ag.c b/plugins/hsp_ag.c
index 5a60269..73050aa 100644
--- a/plugins/hsp_ag.c
+++ b/plugins/hsp_ag.c
@@ -92,10 +92,30 @@ static const gchar *hsp_record =
 " </attribute>\n"
 "</record>\n";
 
+static gboolean sco_unregister_cb(GIOChannel *channel,
+					GIOCondition cond, gpointer data)
+{
+	struct sco *sco = data;
+
+	if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
+		sco_unregister_server(sco);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void audio_connect_cb(struct ofono_emulator *em, void *data)
+{
+	struct sco *sco = data;
+	sco_connect(sco);
+}
+
 static void connect_cb(GIOChannel *channel, GError *err, gpointer data)
 {	int fd;
 	struct ofono_emulator *em;
 	struct ofono_modem *modem;
+	struct sco *sco;
 
 	/* Pick the first powered modem */
 	modem = modems->data;
@@ -110,6 +130,13 @@ static void connect_cb(GIOChannel *channel, GError *err, gpointer data)
 	ofono_emulator_register(em, fd);
 
 	g_io_channel_set_close_on_unref(channel, FALSE);
+
+	sco = sco_register_server(channel);
+
+	ofono_emulator_set_audio_connect_handler(em, audio_connect_cb, sco);
+
+	g_io_add_watch(channel,	G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+						sco_unregister_cb, sco);
 }
 
 static void voicecall_watch(struct ofono_atom *atom,
-- 
1.7.1


  parent reply	other threads:[~2011-03-17 18:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17 18:55 [PATCH v2 0/9] HSP profile implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 1/9] bluetooth: add functions for sco connection =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-18 20:27   ` Denis Kenzior
2011-03-19 11:06     ` Johan Hedberg
2011-03-21 17:08       ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 2/9] emulator: add hsp emulator type =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 3/9] hsp_ag: add hsp atom type =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 4/9] hsp_ag: Initial plugin commit =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 5/9] hsp_ag: add modem watch =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 6/9] emulator: add CKPD support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-18 20:25   ` Denis Kenzior
2011-03-21 18:15     ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-21 18:28       ` Denis Kenzior
2011-03-17 18:55 ` [PATCH v2 7/9] emulator: add audio connection API =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` [PATCH v2 8/9] emulator: implement " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-03-17 18:55 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau [this message]
2011-03-21 12:53 ` [PATCH v2 0/9] HSP profile implementation Luiz Augusto von Dentz
2011-03-21 18:10   ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300388148-925-10-git-send-email-frederic.dalleau@linux.intel.com \
    --to=frederic.dalleau@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox