Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 1/4] emulator: add AT+BIA support for HFP
@ 2011-08-31 15:21 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-08-31 15:21 ` [PATCH 2/4] include: update HFP features types to version 1.6 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-08-31 15:21 UTC (permalink / raw)
  To: ofono

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

---
 src/emulator.c |   83 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 73 insertions(+), 10 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 06ec06c..a907b12 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -60,6 +60,8 @@ struct indicator {
 	int min;
 	int max;
 	gboolean deferred;
+	gboolean active;
+	gboolean mandatory;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -360,7 +362,8 @@ static void notify_deferred_indicators(GAtServer *server, void *user_data)
 		if (!ind->deferred)
 			continue;
 
-		if (em->events_mode == 3 && em->events_ind && em->slc) {
+		if (em->events_mode == 3 && em->events_ind && em->slc &&
+				ind->active) {
 			sprintf(buf, "+CIEV: %d,%d", i, ind->value);
 			g_at_server_send_unsolicited(em->server, buf);
 		}
@@ -783,8 +786,60 @@ fail:
 	}
 }
 
+static void bia_cb(GAtServer *server, GAtServerRequestType type,
+			GAtResult *result, gpointer user_data)
+{
+	struct ofono_emulator *em = user_data;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+	{
+		GAtResultIter iter;
+		GSList *l;
+		struct indicator *ind;
+		int val;
+
+		g_at_result_iter_init(&iter, result);
+		g_at_result_iter_next(&iter, "");
+
+		/* check validity of the request */
+		while (g_at_result_iter_next_number_default(&iter, 0, &val)) {
+			if (val != 0 &&  val != 1)
+				goto fail;
+		}
+
+		if (g_at_result_iter_skip_next(&iter))
+			goto fail;
+
+		/* request is valid, update the indicator activation status */
+		g_at_result_iter_init(&iter, result);
+		g_at_result_iter_next(&iter, "");
+
+		for (l = em->indicators; l; l = l->next) {
+			ind = l->data;
+
+			if (!g_at_result_iter_next_number_default(&iter,
+							ind->active, &val))
+				break;
+
+			if (!ind->mandatory)
+				ind->active = val;
+		}
+
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	}
+
+	default:
+fail:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+		break;
+	}
+}
+
 static void emulator_add_indicator(struct ofono_emulator *em, const char* name,
-					int min, int max, int dflt)
+					int min, int max, int dflt,
+					gboolean mandatory)
 {
 	struct indicator *ind;
 
@@ -798,6 +853,8 @@ static void emulator_add_indicator(struct ofono_emulator *em, const char* name,
 	ind->min = min;
 	ind->max = max;
 	ind->value = dflt;
+	ind->active = TRUE;
+	ind->mandatory = mandatory;
 
 	em->indicators = g_slist_append(em->indicators, ind);
 }
@@ -860,15 +917,20 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
 						em);
 
 	if (em->type == OFONO_EMULATOR_TYPE_HFP) {
-		emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0);
-		emulator_add_indicator(em, OFONO_EMULATOR_IND_CALL, 0, 1, 0);
+		emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0,
+									FALSE);
+		emulator_add_indicator(em, OFONO_EMULATOR_IND_CALL, 0, 1, 0,
+									TRUE);
 		emulator_add_indicator(em, OFONO_EMULATOR_IND_CALLSETUP, 0, 3,
-									0);
+								0, TRUE);
 		emulator_add_indicator(em, OFONO_EMULATOR_IND_CALLHELD, 0, 2,
-									0);
-		emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
-		emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
-		emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
+								0, TRUE);
+		emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0,
+									FALSE);
+		emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0,
+									FALSE);
+		emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5,
+									FALSE);
 
 		g_at_server_register(em->server, "+BRSF", brsf_cb, em, NULL);
 		g_at_server_register(em->server, "+CIND", cind_cb, em, NULL);
@@ -876,6 +938,7 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
 		g_at_server_register(em->server, "+CLIP", clip_cb, em, NULL);
 		g_at_server_register(em->server, "+CCWA", ccwa_cb, em, NULL);
 		g_at_server_register(em->server, "+CMEE", cmee_cb, em, NULL);
+		g_at_server_register(em->server, "+BIA", bia_cb, em, NULL);
 	}
 
 	__ofono_atom_register(em->atom, emulator_unregister);
@@ -1149,7 +1212,7 @@ void ofono_emulator_set_indicator(struct ofono_emulator *em,
 	if (waiting)
 		notify_ccwa(em);
 
-	if (em->events_mode == 3 && em->events_ind && em->slc) {
+	if (em->events_mode == 3 && em->events_ind && em->slc && ind->active) {
 		if (!g_at_server_command_pending(em->server)) {
 			sprintf(buf, "+CIEV: %d,%d", i, ind->value);
 			g_at_server_send_unsolicited(em->server, buf);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] include: update HFP features types to version 1.6
  2011-08-31 15:21 [PATCH 1/4] emulator: add AT+BIA support for HFP =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-08-31 15:21 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-09-08  8:45   ` Denis Kenzior
  2011-08-31 15:21 ` [PATCH 3/4] hfp_ag: update SDP record " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-08-31 15:21 UTC (permalink / raw)
  To: ofono

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

---
 include/types.h |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/types.h b/include/types.h
index 536dac7..0a3b72c 100644
--- a/include/types.h
+++ b/include/types.h
@@ -115,7 +115,7 @@ struct ofono_uuid {
 	unsigned char uuid[OFONO_SHA1_UUID_LEN];
 };
 
-/* HFP AG supported features bitmap. Bluetooth HFP 1.5 spec page 77 */
+/* HFP AG supported features bitmap. Bluetooth HFP 1.6 spec page 88 */
 enum hfp_ag_feature {
 	HFP_AG_FEATURE_3WAY =			0x1,
 	HFP_AG_FEATURE_ECNR =			0x2,
@@ -125,10 +125,11 @@ enum hfp_ag_feature {
 	HFP_AG_FEATURE_REJECT_CALL =		0x20,
 	HFP_AG_FEATURE_ENHANCED_CALL_STATUS =	0x40,
 	HFP_AG_FEATURE_ENHANCED_CALL_CONTROL =	0x80,
-	HFP_AG_FEATURE_EXTENDED_RES_CODE =	0x100
+	HFP_AG_FEATURE_EXTENDED_RES_CODE =	0x100,
+	HFP_AG_FEATURE_CODEC_NEGOTIATION =	0x200
 };
 
-/* HFP HF supported features bitmap. Bluetooth HFP 1.5 spec page 77 */
+/* HFP HF supported features bitmap. Bluetooth HFP 1.6 spec page 88 */
 enum hfp_hf_feature {
 	HFP_HF_FEATURE_ECNR =			0x1,
 	HFP_HF_FEATURE_3WAY =			0x2,
@@ -136,7 +137,8 @@ enum hfp_hf_feature {
 	HFP_HF_FEATURE_VOICE_RECOGNITION =	0x8,
 	HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL =	0x10,
 	HFP_HF_FEATURE_ENHANCED_CALL_STATUS =	0x20,
-	HFP_HF_FEATURE_ENHANCED_CALL_CONTROL =	0x40
+	HFP_HF_FEATURE_ENHANCED_CALL_CONTROL =	0x40,
+	HFP_HF_FEATURE_CODEC_NEGOTIATION =	0x80
 };
 
 const char *ofono_uuid_to_str(const struct ofono_uuid *uuid);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] hfp_ag: update SDP record to version 1.6
  2011-08-31 15:21 [PATCH 1/4] emulator: add AT+BIA support for HFP =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-08-31 15:21 ` [PATCH 2/4] include: update HFP features types to version 1.6 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-08-31 15:21 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-09-08  8:46   ` Denis Kenzior
  2011-08-31 15:21 ` [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-09-08  8:45 ` [PATCH 1/4] emulator: add AT+BIA support for HFP Denis Kenzior
  3 siblings, 1 reply; 8+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-08-31 15:21 UTC (permalink / raw)
  To: ofono

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

---
 plugins/hfp_ag.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/hfp_ag.c b/plugins/hfp_ag.c
index dc65fde..96230fc 100644
--- a/plugins/hfp_ag.c
+++ b/plugins/hfp_ag.c
@@ -68,7 +68,7 @@ static const gchar *hfp_ag_record =
 "    <sequence>\n"
 "      <sequence>\n"
 "        <uuid value=\"0x111E\"/>\n"
-"        <uint16 value=\"0x0105\" name=\"version\"/>\n"
+"        <uint16 value=\"0x0106\" name=\"version\"/>\n"
 "      </sequence>\n"
 "    </sequence>\n"
 "  </attribute>\n"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done
  2011-08-31 15:21 [PATCH 1/4] emulator: add AT+BIA support for HFP =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-08-31 15:21 ` [PATCH 2/4] include: update HFP features types to version 1.6 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-08-31 15:21 ` [PATCH 3/4] hfp_ag: update SDP record " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-08-31 15:21 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-09-08  8:45   ` Denis Kenzior
  2011-09-08  8:45 ` [PATCH 1/4] emulator: add AT+BIA support for HFP Denis Kenzior
  3 siblings, 1 reply; 8+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-08-31 15:21 UTC (permalink / raw)
  To: ofono

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

---
 TODO             |    7 -------
 doc/features.txt |    8 ++++----
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/TODO b/TODO
index 516d325..5672259 100644
--- a/TODO
+++ b/TODO
@@ -148,13 +148,6 @@ Modem Emulator
   Complexity: C4
   Priority: Medium
 
-- Support new HFP 1.6 AG command related to indicators (AT+BIA).
-
-  Complexity: C1
-  Priority: Low
-  Owner: Frédéric Danis <frederic.danis@linux.intel.com>
-  Depends: HFP AG emulator
-
 - Support new HFP 1.6 AG commands allowing to publish, select and connect audio
   codecs (AT+BAC, AT+BCS, +BCS, AT+BCC). This will need to interact with audio
   framework.
diff --git a/doc/features.txt b/doc/features.txt
index b8bcdb1..ad4d176 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -675,11 +675,11 @@ Modem Emulator
 ==============
 
 - Support for Bluetooth HandsFree Profile Audio Gateway (HFP AG).  oFono
-  supports the underlying AT command protocol specified by BT HFP version 1.5.
+  supports the underlying AT command protocol specified by BT HFP version 1.6.
   Supported features include 3-way calling, ability to reject a call,
-  enhanced call status, enhanced call control and report of extended error
-  results code.  Audio management is assumed to be performed in another system
-  component, e.g. PulseAudio.
+  enhanced call status, enhanced call control, report of extended error results
+  code and indicator activation. Audio management is assumed to be performed in
+  another system component, e.g. PulseAudio.
 
 - Support for Bluetooth DUN profile.  oFono supports the Dial Up Networking
   profile and all mandatory commands specified by BT DUN 1.1.  For a list
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] emulator: add AT+BIA support for HFP
  2011-08-31 15:21 [PATCH 1/4] emulator: add AT+BIA support for HFP =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (2 preceding siblings ...)
  2011-08-31 15:21 ` [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-09-08  8:45 ` Denis Kenzior
  3 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2011-09-08  8:45 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 08/31/2011 10:21 AM, Frédéric Danis wrote:
> ---
>  src/emulator.c |   83 +++++++++++++++++++++++++++++++++++++++++++++++++-------
>  1 files changed, 73 insertions(+), 10 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] include: update HFP features types to version 1.6
  2011-08-31 15:21 ` [PATCH 2/4] include: update HFP features types to version 1.6 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-09-08  8:45   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2011-09-08  8:45 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 08/31/2011 10:21 AM, Frédéric Danis wrote:
> ---
>  include/types.h |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done
  2011-08-31 15:21 ` [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-09-08  8:45   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2011-09-08  8:45 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 08/31/2011 10:21 AM, Frédéric Danis wrote:
> ---
>  TODO             |    7 -------
>  doc/features.txt |    8 ++++----
>  2 files changed, 4 insertions(+), 11 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] hfp_ag: update SDP record to version 1.6
  2011-08-31 15:21 ` [PATCH 3/4] hfp_ag: update SDP record " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-09-08  8:46   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2011-09-08  8:46 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 08/31/2011 10:21 AM, Frédéric Danis wrote:
> ---
>  plugins/hfp_ag.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

As discussed on IRC, I'm holding off on this one for now.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-08  8:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31 15:21 [PATCH 1/4] emulator: add AT+BIA support for HFP =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-08-31 15:21 ` [PATCH 2/4] include: update HFP features types to version 1.6 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-09-08  8:45   ` Denis Kenzior
2011-08-31 15:21 ` [PATCH 3/4] hfp_ag: update SDP record " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-09-08  8:46   ` Denis Kenzior
2011-08-31 15:21 ` [PATCH 4/4] TODO: mark HFP AG 1.6 indicator activation as done =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-09-08  8:45   ` Denis Kenzior
2011-09-08  8:45 ` [PATCH 1/4] emulator: add AT+BIA support for HFP Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox