From: Szymon Janc <szymon.janc@tieto.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 03/14] android/handsfree-client: Add handling dial command
Date: Tue, 18 Nov 2014 17:18:57 +0100 [thread overview]
Message-ID: <1791694.BgTKT9YC7S@uw000953> (raw)
In-Reply-To: <1415789377-20458-4-git-send-email-lukasz.rymanowski@tieto.com>
On Wednesday 12 of November 2014 11:49:26 Lukasz Rymanowski wrote:
> ---
> android/handsfree-client.c | 66 +++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 57 insertions(+), 9 deletions(-)
>
> diff --git a/android/handsfree-client.c b/android/handsfree-client.c
> index e498f89..4dfe9fb 100644
> --- a/android/handsfree-client.c
> +++ b/android/handsfree-client.c
> @@ -429,24 +429,72 @@ done:
> static void handle_dial(const void *buf, uint16_t len)
> {
> const struct hal_cmd_hf_client_dial *cmd = buf;
> + struct device *dev;
> + uint8_t status;
> + bool ret;
>
> - if (len != sizeof(*cmd) + cmd->number_len) {
> - error("Malformed number data, size (%u bytes), terminating",
> - len);
> - raise(SIGTERM);
> - return;
> + DBG("");
> +
> + if (len != sizeof(*cmd) + cmd->number_len)
> + goto failed;
> +
> + dev = find_default_device();
> + if (!dev) {
> + status = HAL_STATUS_FAILED;
> + goto done;
> }
>
> - DBG("Not Implemented");
> + if (cmd->number_len > 0) {
> + if (cmd->number[cmd->number_len - 1] != '\0')
> + goto failed;
> +
> + DBG("Dialing %s", cmd->number);
> +
> + ret = hfp_hf_send_command(dev->hf, cmd_complete_cb, NULL,
> + "ATD%s;", cmd->number);
> + } else {
> + DBG("Redialing");
> +
> + ret = hfp_hf_send_command(dev->hf, cmd_complete_cb, NULL,
> + "AT+BLDN");
> + }
> +
> + status = ret ? HAL_STATUS_SUCCESS : HAL_STATUS_FAILED;
> +
> +done:
> ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT,
> - HAL_OP_HF_CLIENT_DIAL, HAL_STATUS_UNSUPPORTED);
> + HAL_OP_HF_CLIENT_DIAL, status);
> +
> + return;
> +
> +failed:
> + error("Malformed number data, size (%u bytes), terminating", len);
> + raise(SIGTERM);
> }
>
> static void handle_dial_memory(const void *buf, uint16_t len)
> {
> - DBG("Not Implemented");
> + const struct hal_cmd_hf_client_dial_memory *cmd = buf;
> + struct device *dev;
> + uint8_t status;
> +
> + DBG("");
> +
> + dev = find_default_device();
> + if (!dev) {
> + status = HAL_STATUS_FAILED;
> + goto done;
> + }
Check if cmd->location is not < 0 (just in case).
> +
> + if (hfp_hf_send_command(dev->hf, cmd_complete_cb, NULL , "ATD>%d;",
> + cmd->location))
> + status = HAL_STATUS_SUCCESS;
> + else
> + status = HAL_STATUS_FAILED;
> +
> +done:
> ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT,
> - HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
> + HAL_OP_HF_CLIENT_DIAL_MEMORY, status);
> }
>
> static void handle_call_action(const void *buf, uint16_t len)
>
--
Best regards,
Szymon Janc
next prev parent reply other threads:[~2014-11-18 16:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 10:49 [PATCH 00/14] android/handsfree-clien: Second set of HFP HF Lukasz Rymanowski
2014-11-12 10:49 ` [PATCH 01/14] android/handsfree-client: Add handle start/stop vr Lukasz Rymanowski
2014-11-18 16:04 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 02/14] android/handsfree-client: Add volume control handling Lukasz Rymanowski
2014-11-18 16:12 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 03/14] android/handsfree-client: Add handling dial command Lukasz Rymanowski
2014-11-18 16:18 ` Szymon Janc [this message]
2014-11-12 10:49 ` [PATCH 04/14] android/handsfree-client: Add call action implementation Lukasz Rymanowski
2014-11-18 16:24 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 05/14] android/handsfree-client: Implement query current calls Lukasz Rymanowski
2014-11-12 10:49 ` [PATCH 06/14] android/handsfree-client: Add handling +CLCC Lukasz Rymanowski
2014-11-18 16:29 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 07/14] android/handsfree-client: Add support for +CIEV events Lukasz Rymanowski
2014-11-18 19:54 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 08/14] android/handsfree-client: Send indicators val we got during SLC setup Lukasz Rymanowski
2014-11-18 19:55 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 09/14] android/handsfree-client: Add support to get operator name Lukasz Rymanowski
2014-11-18 20:17 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 10/14] android/handsfree-client: Send to AG that we do support long name Lukasz Rymanowski
2014-11-12 10:49 ` [PATCH 11/14] android/handsfree-client: Retrieve subscriber number information Lukasz Rymanowski
2014-11-18 20:52 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 12/14] android/handsfree-client: Implement send DTMF codes Lukasz Rymanowski
2014-11-12 10:49 ` [PATCH 13/14] android/handsfree-client: Implement handling AT+BIND and +BIND Lukasz Rymanowski
2014-11-18 21:09 ` Szymon Janc
2014-11-12 10:49 ` [PATCH 14/14] android/handsfree-client: Implement codec negotiations Lukasz Rymanowski
2014-11-18 21:58 ` Szymon Janc
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=1791694.BgTKT9YC7S@uw000953 \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=lukasz.rymanowski@tieto.com \
/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