linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v13 11/14] audio: Replace headset and gateway by telephony
Date: Tue, 17 Jul 2012 15:40:37 +0200	[thread overview]
Message-ID: <1342532440-730-12-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1342532440-730-1-git-send-email-frederic.danis@linux.intel.com>

Replace Headset and Gateway configuration options by new
Telephony option.
Remove HFP option  in Headset section as it is no more
relevant.
---
 audio/audio.conf |    8 ++---
 audio/manager.c  |   90 ++++++++++++------------------------------------------
 audio/manager.h  |    4 +--
 3 files changed, 23 insertions(+), 79 deletions(-)

diff --git a/audio/audio.conf b/audio/audio.conf
index 9e9e664..2878030 100644
--- a/audio/audio.conf
+++ b/audio/audio.conf
@@ -8,8 +8,8 @@
 #Master=true
 
 # If we want to disable support for specific services
-# Defaults to supporting the services: HFP, Headset, Sink, Control and Media
-#Disable=Gateway,Source
+# Defaults to supporting the services: Telephony, Sink, Control and Media
+#Disable=Source
 
 # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
 # Defaults to HCI
@@ -25,9 +25,5 @@
 # service interacts with remote headset devices)
 [Headset]
 
-# Set to true to support HFP, false means only HSP is supported
-# Defaults to true
-HFP=true
-
 # Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
 MaxConnected=1
diff --git a/audio/manager.c b/audio/manager.c
index 5dcf52d..5a90398 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -100,9 +100,7 @@ static GSList *adapters = NULL;
 static GSList *devices = NULL;
 
 static struct enabled_interfaces enabled = {
-	.hfp		= TRUE,
-	.headset	= TRUE,
-	.gateway	= FALSE,
+	.telephony	= TRUE,
 	.sink		= TRUE,
 	.source		= FALSE,
 	.control	= TRUE,
@@ -126,13 +124,13 @@ gboolean server_is_enabled(bdaddr_t *src, uint16_t svc)
 {
 	switch (svc) {
 	case HEADSET_SVCLASS_ID:
-		return enabled.headset;
+		return enabled.telephony;
 	case HEADSET_AGW_SVCLASS_ID:
 		return FALSE;
 	case HANDSFREE_SVCLASS_ID:
-		return enabled.headset && enabled.hfp;
+		return enabled.telephony;
 	case HANDSFREE_AGW_SVCLASS_ID:
-		return enabled.gateway;
+		return enabled.telephony;
 	case AUDIO_SINK_SVCLASS_ID:
 		return enabled.sink;
 	case AUDIO_SOURCE_SVCLASS_ID:
@@ -189,7 +187,7 @@ static void handle_uuid(const char *uuidstr, struct audio_device *device)
 		break;
 	case HANDSFREE_AGW_SVCLASS_ID:
 		DBG("Found Handsfree AG record");
-		if (enabled.gateway && (device->gateway == NULL))
+		if (enabled.telephony && (device->gateway == NULL))
 			device->gateway = gateway_init(device);
 		break;
 	case AUDIO_SINK_SVCLASS_ID:
@@ -350,7 +348,7 @@ static void state_changed(struct btd_adapter *adapter, gboolean powered)
 	telephony = FALSE;
 }
 
-static int headset_server_probe(struct btd_adapter *adapter)
+static int telephony_server_probe(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
@@ -368,7 +366,7 @@ static int headset_server_probe(struct btd_adapter *adapter)
 	return 0;
 }
 
-static void headset_server_remove(struct btd_adapter *adapter)
+static void telephony_server_remove(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
@@ -384,31 +382,6 @@ static void headset_server_remove(struct btd_adapter *adapter)
 	audio_adapter_unref(adp);
 }
 
-static int gateway_server_probe(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	return 0;
-}
-
-static void gateway_server_remove(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-
-	DBG("path %s", path);
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
-
-	audio_adapter_unref(adp);
-}
-
 static int a2dp_server_probe(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
@@ -533,16 +506,10 @@ static struct btd_device_driver audio_driver = {
 	.remove	= audio_remove,
 };
 
-static struct btd_adapter_driver headset_server_driver = {
-	.name	= "audio-headset",
-	.probe	= headset_server_probe,
-	.remove	= headset_server_remove,
-};
-
-static struct btd_adapter_driver gateway_server_driver = {
-	.name	= "audio-gateway",
-	.probe	= gateway_server_probe,
-	.remove	= gateway_server_remove,
+static struct btd_adapter_driver telephony_server_driver = {
+	.name	= "telephony",
+	.probe	= telephony_server_probe,
+	.remove	= telephony_server_remove,
 };
 
 static struct btd_adapter_driver a2dp_server_driver = {
@@ -581,10 +548,8 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	list = g_key_file_get_string_list(config, "General", "Enable",
 						NULL, NULL);
 	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Headset"))
-			enabled.headset = TRUE;
-		else if (g_str_equal(list[i], "Gateway"))
-			enabled.gateway = TRUE;
+		if (g_str_equal(list[i], "Telephony"))
+			enabled.telephony = TRUE;
 		else if (g_str_equal(list[i], "Sink"))
 			enabled.sink = TRUE;
 		else if (g_str_equal(list[i], "Source"))
@@ -600,10 +565,8 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	list = g_key_file_get_string_list(config, "General", "Disable",
 						NULL, NULL);
 	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Headset"))
-			enabled.headset = FALSE;
-		else if (g_str_equal(list[i], "Gateway"))
-			enabled.gateway = FALSE;
+		if (g_str_equal(list[i], "Telephony"))
+			enabled.telephony = FALSE;
 		else if (g_str_equal(list[i], "Sink"))
 			enabled.sink = FALSE;
 		else if (g_str_equal(list[i], "Source"))
@@ -622,13 +585,6 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	} else
 		auto_connect = b;
 
-	b = g_key_file_get_boolean(config, "Headset", "HFP",
-					&err);
-	if (err)
-		g_clear_error(&err);
-	else
-		enabled.hfp = b;
-
 	err = NULL;
 	i = g_key_file_get_integer(config, "Headset", "MaxConnected",
 					&err);
@@ -645,18 +601,15 @@ proceed:
 	if (enabled.media)
 		btd_register_adapter_driver(&media_server_driver);
 
-	if (enabled.headset)
-		btd_register_adapter_driver(&headset_server_driver);
-
-	if (enabled.gateway)
-		btd_register_adapter_driver(&gateway_server_driver);
+	if (enabled.telephony)
+		btd_register_adapter_driver(&telephony_server_driver);
 
 	if (enabled.source || enabled.sink)
 		btd_register_adapter_driver(&a2dp_server_driver);
 
 	btd_register_device_driver(&audio_driver);
 
-	*enable_sco = (enabled.gateway || enabled.headset);
+	*enable_sco = (enabled.telephony);
 
 	return 0;
 }
@@ -678,11 +631,8 @@ void audio_manager_exit(void)
 	if (enabled.media)
 		btd_unregister_adapter_driver(&media_server_driver);
 
-	if (enabled.headset)
-		btd_unregister_adapter_driver(&headset_server_driver);
-
-	if (enabled.gateway)
-		btd_unregister_adapter_driver(&gateway_server_driver);
+	if (enabled.telephony)
+		btd_unregister_adapter_driver(&telephony_server_driver);
 
 	if (enabled.source || enabled.sink)
 		btd_unregister_adapter_driver(&a2dp_server_driver);
diff --git a/audio/manager.h b/audio/manager.h
index 85e5065..cd13a59 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -23,9 +23,7 @@
  */
 
 struct enabled_interfaces {
-	gboolean hfp;
-	gboolean headset;
-	gboolean gateway;
+	gboolean telephony;
 	gboolean sink;
 	gboolean source;
 	gboolean control;
-- 
1.7.9.5


  parent reply	other threads:[~2012-07-17 13:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 13:40 [PATCH v13 00/14] Add org.bluez.Telephony interface Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 01/14] doc: Add telephony interface documents Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 02/14] audio: Move telephony drivers to D-Bus interface Frédéric Danis
2012-07-18 11:51   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 03/14] audio: Simplify org.bluez.Headset Frédéric Danis
2012-07-18 12:02   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 04/14] audio: Remove dummy telephony driver Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 05/14] audio: Remove maemo5 " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 06/14] audio: Remove maemo6 " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 07/14] audio: Remove oFono " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 08/14] audio: Move HFP/HSP AG servers to telephony.c Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 09/14] audio: Send transport path to telephony agent Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 10/14] audio: Move HFP HF server to telephony.c Frédéric Danis
2012-07-18 11:54   ` Johan Hedberg
2012-07-17 13:40 ` Frédéric Danis [this message]
2012-07-17 13:40 ` [PATCH v13 12/14] audio: Add DUN GW to org.bluez.Telephony Frédéric Danis
2012-07-18 11:58   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 13/14] audio: Add SAP " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 14/14] audio: Add fast connectable to telephony interface Frédéric Danis
2012-07-18 11:59   ` Johan Hedberg

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=1342532440-730-12-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).