Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/3] android/handsfree: Send indicator notif to all connected devices
Date: Thu, 13 Nov 2014 18:14:46 +0100	[thread overview]
Message-ID: <2101011.n5l4rYIcFz@uw000953> (raw)
In-Reply-To: <1415893972-18656-2-git-send-email-lukasz.rymanowski@tieto.com>

Hi Łukasz,

On Thursday 13 of November 2014 16:52:50 Lukasz Rymanowski wrote:
> ---
>  android/handsfree.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/android/handsfree.c b/android/handsfree.c
> index 9a2fdd0..0001eb6 100644
> --- a/android/handsfree.c
> +++ b/android/handsfree.c
> @@ -2038,24 +2038,31 @@ static void update_indicator(struct hf_device *dev, int ind, uint8_t val)
>  	hfp_gw_send_info(dev->gw, "+CIEV: %u,%u", ind + 1, val);
>  }
>  
> +static void device_status_notif(void *data, void *user_data)
> +{
> +	struct hf_device *dev = data;
> +	struct hal_cmd_handsfree_device_status_notif *cmd = user_data;

I think we should send this only to devices with SLC established.

> +
> +	update_indicator(dev, IND_SERVICE, cmd->state);
> +	update_indicator(dev, IND_ROAM, cmd->type);
> +	update_indicator(dev, IND_SIGNAL, cmd->signal);
> +	update_indicator(dev, IND_BATTCHG, cmd->battery);
> +}
> +
>  static void handle_device_status_notif(const void *buf, uint16_t len)
>  {
>  	const struct hal_cmd_handsfree_device_status_notif *cmd = buf;
> -	struct hf_device *dev;
>  	uint8_t status;
>  
>  	DBG("");
>  
> -	dev = find_default_device();
> -	if (!dev) {
> +	if (queue_isempty(devices)) {
>  		status = HAL_STATUS_FAILED;
>  		goto done;
>  	}
>  
> -	update_indicator(dev, IND_SERVICE, cmd->state);
> -	update_indicator(dev, IND_ROAM, cmd->type);
> -	update_indicator(dev, IND_SIGNAL, cmd->signal);
> -	update_indicator(dev, IND_BATTCHG, cmd->battery);
> +	/* Cast cmd to void as queue api needs that */
> +	queue_foreach(devices, device_status_notif, (void *) cmd);
>  
>  	status = HAL_STATUS_SUCCESS;
>  
> 

-- 
Best regards, 
Szymon Janc

  reply	other threads:[~2014-11-13 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13 15:52 [PATCH 0/3] android/handsfree: Support multiply devices Lukasz Rymanowski
2014-11-13 15:52 ` [PATCH 1/3] android/handsfree: Send indicator notif to all connected devices Lukasz Rymanowski
2014-11-13 17:14   ` Szymon Janc [this message]
2014-11-13 17:24     ` Szymon Janc
2014-11-13 15:52 ` [PATCH 2/3] android/handsfree: Send phone state " Lukasz Rymanowski
2014-11-13 15:52 ` [PATCH 3/3] android/handsfree: Remove find default device Lukasz Rymanowski
2014-11-13 15:58   ` Lukasz Rymanowski

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=2101011.n5l4rYIcFz@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