From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/3] android/handsfree: Add initial support for configure WBS commmand
Date: Fri, 19 Dec 2014 14:31:33 +0100 [thread overview]
Message-ID: <3945025.Q1StLrMxgl@uw000953> (raw)
In-Reply-To: <1418828013-12385-1-git-send-email-szymon.janc@tieto.com>
On Wednesday 17 of December 2014 15:53:31 Szymon Janc wrote:
> This adds required IPC message and handler for configure WBS command.
> ---
> android/hal-handsfree.c | 17 ++++++++++++++---
> android/hal-ipc-api.txt | 12 ++++++++++++
> android/hal-msg.h | 10 ++++++++++
> android/handsfree.c | 21 +++++++++++++++++++++
> 4 files changed, 57 insertions(+), 3 deletions(-)
>
> diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
> index 2c638e6..279b26a 100644
> --- a/android/hal-handsfree.c
> +++ b/android/hal-handsfree.c
> @@ -832,11 +832,22 @@ static void cleanup(void)
> #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
> static bt_status_t configure_wbs(bt_bdaddr_t *bd_addr, bthf_wbs_config_t config)
> {
> - /* TODO: implement */
> + struct hal_cmd_handsfree_configure_wbs cmd;
>
> - DBG("");
> + DBG("%u", config);
> +
> + if (!interface_ready())
> + return BT_STATUS_NOT_READY;
>
> - return BT_STATUS_UNSUPPORTED;
> + if (!bd_addr)
> + return BT_STATUS_PARM_INVALID;
> +
> + memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
> + cmd.config = config;
> +
> + return hal_ipc_cmd(HAL_SERVICE_ID_HANDSFREE,
> + HAL_OP_HANDSFREE_CONFIGURE_WBS,
> + sizeof(cmd), &cmd, NULL, NULL, NULL);
> }
> #endif
>
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index 01490fa..f15c12e 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -955,6 +955,18 @@ Commands and responses:
>
> In case of an error, the error response will be returned.
>
> + Opcode 0x0f - Configure WBS command/response
> +
> + Command parameters: Remote address (6 octets)
> + Config (1 octet)
> + Response parameters: <none>
> +
> + Valid config values: 0x00 = None
> + 0x01 = No
> + 0x02 = Yes
> +
> + In case of an error, the error response will be returned.
> +
> Notifications:
>
> Opcode 0x81 - Connection State notification
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 88b0c52..ecc1150 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -624,6 +624,16 @@ struct hal_cmd_handsfree_phone_state_change {
> uint8_t number[0];
> } __attribute__((packed));
>
> +#define HAL_HANDSFREE_WBS_NONE 0x00
> +#define HAL_HANDSFREE_WBS_NO 0x01
> +#define HAL_HANDSFREE_WBS_YES 0x02
> +
> +#define HAL_OP_HANDSFREE_CONFIGURE_WBS 0x0F
> +struct hal_cmd_handsfree_configure_wbs {
> + uint8_t bdaddr[6];
> + uint8_t config;
> +} __attribute__((packed));
> +
> /* AVRCP TARGET HAL API */
>
> #define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
> diff --git a/android/handsfree.c b/android/handsfree.c
> index 7fbe64b..da89623 100644
> --- a/android/handsfree.c
> +++ b/android/handsfree.c
> @@ -2496,6 +2496,24 @@ failed:
> HAL_OP_HANDSFREE_PHONE_STATE_CHANGE, status);
> }
>
> +static void handle_configure_wbs(const void *buf, uint16_t len)
> +{
> + const struct hal_cmd_handsfree_configure_wbs *cmd = buf;
> + uint8_t status;
> +
> + switch (cmd->config) {
> + case HAL_HANDSFREE_WBS_NONE:
> + case HAL_HANDSFREE_WBS_NO:
> + case HAL_HANDSFREE_WBS_YES:
> + default:
> + status = HAL_STATUS_FAILED;
> + break;
> + }
> +
> + ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE,
> + HAL_OP_HANDSFREE_CONFIGURE_WBS, status);
> +}
> +
> static const struct ipc_handler cmd_handlers[] = {
> /* HAL_OP_HANDSFREE_CONNECT */
> { handle_connect, false,
> @@ -2537,6 +2555,9 @@ static const struct ipc_handler cmd_handlers[] = {
> /* HAL_OP_HANDSFREE_PHONE_STATE_CHANGE */
> { handle_phone_state_change, true,
> sizeof(struct hal_cmd_handsfree_phone_state_change) },
> + /* HAL_OP_HANDSFREE_CONFIGURE_WBS */
> + { handle_configure_wbs, false,
> + sizeof(struct hal_cmd_handsfree_configure_wbs) },
> };
>
> static sdp_record_t *headset_ag_record(void)
>
Pushed (with some minor changes).
--
Best regards,
Szymon Janc
prev parent reply other threads:[~2014-12-19 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 14:53 [PATCH 1/3] android/handsfree: Add initial support for configure WBS commmand Szymon Janc
2014-12-17 14:53 ` [PATCH 2/3] android/handsfree: Add support for configure WBS command Szymon Janc
2014-12-17 14:53 ` [PATCH 3/3] android/README: Update implementation status for handsfree Szymon Janc
2014-12-19 13:31 ` Szymon Janc [this message]
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=3945025.Q1StLrMxgl@uw000953 \
--to=szymon.janc@tieto.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