Re: [PATCH v2 09/17] heartrate: Enable measurement when watchers are registered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 15:05 Wed 05 Sep, Andrzej Kaczmarek wrote:
> This patch will enable measurement notification when first watcher is
> registered or when device is connected and watcher is already registered.
> 
> Measurement will be disabled when last watcher is unregistered.
> 
> ---
>  profiles/heartrate/heartrate.c | 129 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 128 insertions(+), 1 deletion(-)
> 
> diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
> index a223fe0..5464a9f 100644
> --- a/profiles/heartrate/heartrate.c
> +++ b/profiles/heartrate/heartrate.c
> @@ -101,6 +101,22 @@ static gint cmp_device(gconstpointer a, gconstpointer b)
>  	return -1;
>  }
>  
> +static gint cmp_char_uuid(gconstpointer a, gconstpointer b)
> +{
> +	const struct characteristic *ch = a;
> +	const char *uuid = b;
> +
> +	return g_strcmp0(ch->attr.uuid, uuid);
> +}
> +
> +static gint cmp_descriptor(gconstpointer a, gconstpointer b)
> +{
> +	const struct descriptor *desc = a;
> +	const bt_uuid_t *uuid = b;
> +
> +	return bt_uuid_cmp(&desc->uuid, uuid);
> +}
> +
>  static gint cmp_watcher(gconstpointer a, gconstpointer b)
>  {
>  	const struct watcher *watcher = a;
> @@ -181,6 +197,91 @@ static void destroy_heartrate_adapter(gpointer user_data)
>  	g_free(hra);
>  }
>  
> +static struct characteristic *
> +get_characteristic(struct heartrate *hr, const char *uuid)

Nitpick: I think it is possible to break the line after the first parameter.

> +{
> +	GSList *l;
> +
> +	l = g_slist_find_custom(hr->chars, uuid, cmp_char_uuid);
> +	if (l == NULL)
> +		return NULL;
> +
> +	return l->data;
> +}
> +

Cheers,
-- 
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux