From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 09/17] heartrate: Enable measurement when watchers are registered
Date: Wed, 5 Sep 2012 10:49:41 -0300 [thread overview]
Message-ID: <20120905134941.GB11695@samus> (raw)
In-Reply-To: <1346850348-21176-10-git-send-email-andrzej.kaczmarek@tieto.com>
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
next prev parent reply other threads:[~2012-09-05 13:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 13:05 [PATCH v2 00/17] Heart Rate Profile plugin Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 01/17] Heart Rate Profile API Andrzej Kaczmarek
2012-09-05 13:47 ` Vinicius Costa Gomes
2012-09-05 13:05 ` [PATCH v2 02/17] heartrate: Add Heart Rate Profile client Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 03/17] heartrate: Add attio callbacks Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 04/17] heartrate: Discover characteristics Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 05/17] heartrate: Process characteristics Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 06/17] heartrate: Discover characteristics descriptors Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 07/17] heartrate: Process " Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 08/17] heartrate: Add HeartRateManager interface Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 09/17] heartrate: Enable measurement when watchers are registered Andrzej Kaczmarek
2012-09-05 13:49 ` Vinicius Costa Gomes [this message]
2012-09-05 13:05 ` [PATCH v2 10/17] heartrate: Read Body Sensor Location characteristics Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 11/17] heartrate: Read Heart Rate Control Point characteristics Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 12/17] heartrate: Handle characteristics value changed notification Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 13/17] heartrate: Process Heart Rate Measurement characteristics Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 14/17] heartrate: Add Reset method Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 15/17] heartrate: Add GetProperties method Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 16/17] heartrate: Add HeartRateWatcher interface to default policy Andrzej Kaczmarek
2012-09-05 13:05 ` [PATCH v2 17/17] heartrate: Add test script Andrzej Kaczmarek
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=20120905134941.GB11695@samus \
--to=vinicius.gomes@openbossa.org \
--cc=andrzej.kaczmarek@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