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 4/9] hsp_ag: Initial plugin commit
Date: Thu, 17 Mar 2011 19:55:43 +0100	[thread overview]
Message-ID: <1300388148-925-5-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: 3900 bytes --]

---
 Makefile.am      |    3 +
 plugins/hsp_ag.c |  115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 plugins/hsp_ag.c

diff --git a/Makefile.am b/Makefile.am
index 79bf364..50e7e96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -335,6 +335,9 @@ builtin_sources += plugins/hfp_ag.c plugins/bluetooth.h
 builtin_modules += dun_gw
 builtin_sources += plugins/dun_gw.c plugins/bluetooth.h
 
+builtin_modules += hsp_ag
+builtin_sources += plugins/hsp_ag.c plugins/bluetooth.h
+
 builtin_sources += $(btio_sources)
 builtin_cflags += @BLUEZ_CFLAGS@
 builtin_libadd += @BLUEZ_LIBS@
diff --git a/plugins/hsp_ag.c b/plugins/hsp_ag.c
new file mode 100644
index 0000000..a8e6f40
--- /dev/null
+++ b/plugins/hsp_ag.c
@@ -0,0 +1,115 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gatchat.h>
+#include <gattty.h>
+#include <gdbus.h>
+#include <ofono.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/netreg.h>
+#include <ofono/voicecall.h>
+#include <ofono/call-volume.h>
+
+#include <ofono/dbus.h>
+
+#include "bluetooth.h"
+
+#define HSP_RFCOMM_CHAN 17
+
+static struct server *hsp;
+
+static const gchar *hsp_record =
+"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+"<record>\n"
+" <attribute id=\"0x0000\">\n"
+"  <uint32 value=\"0x00010006\" />\n"
+" </attribute>\n"
+" <attribute id=\"0x0001\">\n"
+"  <sequence>\n"
+"   <uuid value=\"0x1112\" />\n"
+"   <uuid value=\"0x1203\" />\n"
+"  </sequence>\n"
+" </attribute>\n"
+" <attribute id=\"0x0004\">\n"
+"  <sequence>\n"
+"   <sequence>\n"
+"    <uuid value=\"0x0100\" />\n"
+"   </sequence>\n"
+"   <sequence>\n"
+"    <uuid value=\"0x0003\" />\n"
+"    <uint8 value=\"17\" name=\"channel\" />\n"
+"   </sequence>\n"
+"  </sequence>\n"
+" </attribute>\n"
+" <attribute id=\"0x0005\">\n"
+"  <sequence>\n"
+"   <uuid value=\"0x1002\" />\n"
+"  </sequence>\n"
+" </attribute>\n"
+" <attribute id=\"0x0009\">\n"
+"  <sequence>\n"
+"   <sequence>\n"
+"    <uuid value=\"0x1108\" />\n"
+"    <uint16 value=\"0x0102\" />\n"
+"   </sequence>\n"
+"   </sequence>\n"
+"  </attribute>\n"
+" <attribute id=\"0x0100\">\n"
+"   <text value=\"Headset Audio Gateway\" />\n"
+" </attribute>\n"
+"</record>\n";
+
+static void connect_cb(GIOChannel *channel, GError *err, gpointer user_data)
+{
+}
+
+static int hsp_ag_init(void)
+{
+	hsp = bluetooth_register_server(HSP_RFCOMM_CHAN, hsp_record, connect_cb, NULL);
+
+	if(!hsp)
+		return -1;
+
+	DBG("HSP Gateway profile starting");
+	return 0;
+}
+
+static void hsp_ag_exit(void)
+{
+	if(hsp)
+		bluetooth_unregister_server(hsp);
+}
+
+OFONO_PLUGIN_DEFINE(hsp_ag, "Headset Gateway Profile", VERSION,
+			OFONO_PLUGIN_PRIORITY_DEFAULT, hsp_ag_init, hsp_ag_exit)
-- 
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 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau [this message]
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 ` [PATCH v2 9/9] hsp_ag: add audio connection support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
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-5-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