All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hfpmodem: Split AT+VTS command into multiple +VTS
@ 2014-06-20  8:03 Sergio Checa Blanco
  2014-06-21 17:05 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Sergio Checa Blanco @ 2014-06-20  8:03 UTC (permalink / raw)
  To: ofono

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

From: Sergio Checa Blanco <sergio.checa@bmw-carit.de>

According to the standard "3GPP 27.007 v6.8.0" Appendix C.2.11,
when sending multiple DTMF characters, these must go in individual
+VTS commands for each tone. This adopts the AT modem approach.

Before: AT+VTS=1234\r
After:  AT+VTS=1;+VTS=2;+VTS=3;+VTS=4\r
---
 drivers/hfpmodem/voicecall.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index e958fe0..f16282c 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -654,8 +654,10 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
 {
 	struct voicecall_data *vd = ofono_voicecall_get_data(vc);
 	struct change_state_req *req = g_try_new0(struct change_state_req, 1);
+	int len = strlen(dtmf);
 	char *buf;
 	int s;
+	int i;
 
 	if (req == NULL)
 		goto error;
@@ -665,12 +667,15 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
 	req->data = data;
 	req->affected_types = 0;
 
-	/* strlen("AT+VTS=) = 7 + NULL */
-	buf = g_try_new(char, strlen(dtmf) + 8);
+	/* strlen("AT") + (n-1) * strlen("+VTS=T;") + strlen(+VTS=T) + null */
+	buf = g_try_new(char, len * 7 + 2);
 	if (buf == NULL)
 		goto error;
 
-	sprintf(buf, "AT+VTS=%s", dtmf);
+	s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
+
+	for (i = 1; i < len; i++)
+		s += sprintf(buf + s, ";+VTS=%c", dtmf[i]);
 
 	s = g_at_chat_send(vd->chat, buf, none_prefix,
 				generic_cb, req, g_free);
-- 
2.0.0


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

* Re: [PATCH] hfpmodem: Split AT+VTS command into multiple +VTS
  2014-06-20  8:03 [PATCH] hfpmodem: Split AT+VTS command into multiple +VTS Sergio Checa Blanco
@ 2014-06-21 17:05 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2014-06-21 17:05 UTC (permalink / raw)
  To: ofono

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

Hi Sergio,

On 06/20/2014 03:03 AM, Sergio Checa Blanco wrote:
> From: Sergio Checa Blanco <sergio.checa@bmw-carit.de>
> 
> According to the standard "3GPP 27.007 v6.8.0" Appendix C.2.11,
> when sending multiple DTMF characters, these must go in individual
> +VTS commands for each tone. This adopts the AT modem approach.
> 
> Before: AT+VTS=1234\r
> After:  AT+VTS=1;+VTS=2;+VTS=3;+VTS=4\r
> ---
>  drivers/hfpmodem/voicecall.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2014-06-21 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20  8:03 [PATCH] hfpmodem: Split AT+VTS command into multiple +VTS Sergio Checa Blanco
2014-06-21 17:05 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.