Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 5/6] android/hal: Add device state changed event handler
Date: Tue, 29 Oct 2013 14:36:24 +0200	[thread overview]
Message-ID: <20131029123622.GF27517@aemeltch-MOBL1> (raw)
In-Reply-To: <1383049016-23371-5-git-send-email-jakub.tyszkowski@tieto.com>

Hi Jakub,

On Tue, Oct 29, 2013 at 01:16:55PM +0100, Jakub Tyszkowski wrote:
> This is used to report property change of already reported remote
> device.
> 
> ---
>  android/hal-bluetooth.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
> index 261ae85..0fef680 100644
> --- a/android/hal-bluetooth.c
> +++ b/android/hal-bluetooth.c
> @@ -114,6 +114,29 @@ static void handle_device_found(void *buf)
>  	bt_hal_cbacks->device_found_cb(ev->num_props, send_props);
>  }
>  
> +static void handle_device_state_changed(void *buf)
> +{
> +	uint8_t i;

I've got comment myself that first we put variables with assignments.

> +	struct hal_ev_remote_device_props *ev = buf;
> +	bt_property_t send_props[ev->num_props];
> +	struct hal_property *prop = ev->props;
> +
> +	if (!bt_hal_cbacks->remote_device_properties_cb)
> +		return;
> +
> +	/* repack props */
> +	for (i = 0; i < ev->num_props; ++i) {
> +		send_props[i].type = prop->type;
> +		send_props[i].len = prop->len;
> +		send_props[i].val = prop->val;
> +
> +		prop = (void *) prop + (sizeof(*prop) + prop->len);
> +	}

I would put empty line here. This looks a bit more readable then
handle_adapter_props_changed. Do you think those 2 might have reused code?

Best regards 
Andrei Emeltchenko 


> +	bt_hal_cbacks->remote_device_properties_cb(ev->status,
> +						(bt_bdaddr_t *)ev->bdaddr,
> +						ev->num_props, send_props);
> +}
> +
>  /* will be called from notification thread context */
>  void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
>  {
> @@ -133,6 +156,9 @@ void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
>  	case HAL_EV_DEVICE_FOUND:
>  		handle_device_found(buf);
>  		break;
> +	case HAL_EV_REMOTE_DEVICE_PROPS:
> +		handle_device_state_changed(buf);
> +		break;
>  	default:
>  		DBG("Unhandled callback opcode=0x%x", opcode);
>  		break;
> -- 
> 1.8.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-10-29 12:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 12:16 [PATCH 1/6] android: Remove reduntant structure Jakub Tyszkowski
2013-10-29 12:16 ` [PATCH 2/6] android/hal: Add support for start/cancel device discovery commands Jakub Tyszkowski
2013-10-29 12:16 ` [PATCH 3/6] android/hal: Add support for handling discovery state change event Jakub Tyszkowski
2013-10-29 12:16 ` [PATCH 4/6] android/hal: Add device found event handler Jakub Tyszkowski
2013-10-29 12:16 ` [PATCH 5/6] android/hal: Add device state changed " Jakub Tyszkowski
2013-10-29 12:36   ` Andrei Emeltchenko [this message]
2013-10-29 13:18     ` Jakub Tyszkowski
2013-10-29 12:16 ` [PATCH 6/6] android: Add missing discovery state definitions to IPC header Jakub Tyszkowski
2013-10-29 12:28 ` [PATCH 1/6] android: Remove reduntant structure Johan Hedberg
2013-10-29 13:01   ` Jakub Tyszkowski

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=20131029123622.GF27517@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=jakub.tyszkowski@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