2014-10-06 10:58:04

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 1/2] shared/hfp: Improve next_field() function

In HF Client case we might have "-" separator between hf data. For
example +CIND: ("signal",(0-5))
With this patch next_field() is able to skip "-" as well.
---
src/shared/hfp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index efc981f..bc091b5 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -221,7 +221,8 @@ done:

static void next_field(struct hfp_gw_result *result)
{
- if (result->data[result->offset] == ',')
+ if (result->data[result->offset] == ',' ||
+ result->data[result->offset] == '-')
result->offset++;
}

--
1.8.4



2014-10-06 12:21:31

by Lukasz Rymanowski

[permalink] [raw]
Subject: Re: [PATCH 1/2] shared/hfp: Improve next_field() function

Hi,

On Mon, Oct 6, 2014 at 12:58 PM, Lukasz Rymanowski
<[email protected]> wrote:
> In HF Client case we might have "-" separator between hf data. For
> example +CIND: ("signal",(0-5))
> With this patch next_field() is able to skip "-" as well.
> ---
> src/shared/hfp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
> index efc981f..bc091b5 100644
> --- a/src/shared/hfp.c
> +++ b/src/shared/hfp.c
> @@ -221,7 +221,8 @@ done:
>
> static void next_field(struct hfp_gw_result *result)
> {
> - if (result->data[result->offset] == ',')
> + if (result->data[result->offset] == ',' ||
> + result->data[result->offset] == '-')

Actually this might brake parsing some AT commands. Ignore this patch.

\Lukasz
> result->offset++;
> }
>
> --
> 1.8.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-10-06 10:58:05

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 2/2] shared/hfp: Move to next field on container close

Needed in case of parsing for example:
.+CIND: ("call",(0,1)),("callsetup",(0-3))")
---
src/shared/hfp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index bc091b5..214e3a0 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -291,6 +291,8 @@ bool hfp_gw_result_close_container(struct hfp_gw_result *result)

result->offset++;

+ next_field(result);
+
return true;
}

--
1.8.4