All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arman Uguray <armansito@chromium.org>
To: BlueZ development <linux-bluetooth@vger.kernel.org>
Cc: "Giovanni Ortuño" <ortuno@google.com>
Subject: Re: [PATCH BlueZ 1/2] core/gatt: Add btd_gatt_client_foreach_service
Date: Wed, 6 May 2015 13:50:03 -0700	[thread overview]
Message-ID: <CAHrH25SPqUBGQbLXjB7-+wd37=mo4Zhh_Jthx2YfL_HvLf-NJQ@mail.gmail.com> (raw)
In-Reply-To: <1430863554-30611-1-git-send-email-armansito@chromium.org>

Hi,

> On Tue, May 5, 2015 at 3:05 PM, Arman Uguray <armansito@chromium.org> wrote:
> This patch introduces btd_gatt_client_foreach_service which allows
> users to iterate through the object paths of currently exported
> GattService1 objects.
> ---
>  src/gatt-client.c | 28 ++++++++++++++++++++++++++++
>  src/gatt-client.h |  6 ++++++
>  2 files changed, 34 insertions(+)
>
> diff --git a/src/gatt-client.c b/src/gatt-client.c
> index 2e26ed7..3614553 100644
> --- a/src/gatt-client.c
> +++ b/src/gatt-client.c
> @@ -1961,3 +1961,31 @@ void btd_gatt_client_disconnected(struct btd_gatt_client *client)
>         bt_gatt_client_unref(client->gatt);
>         client->gatt = NULL;
>  }
> +
> +struct foreach_service_data {
> +       btd_gatt_client_service_path_t func;
> +       void *user_data;
> +};
> +
> +static void client_service_foreach(void *data, void *user_data)
> +{
> +       struct service *service = data;
> +       struct foreach_service_data *foreach_data = user_data;
> +
> +       foreach_data->func(service->path, foreach_data->user_data);
> +}
> +
> +void btd_gatt_client_foreach_service(struct btd_gatt_client *client,
> +                                       btd_gatt_client_service_path_t func,
> +                                       void *user_data)
> +{
> +       struct foreach_service_data data;
> +
> +       if (!client)
> +               return;
> +
> +       data.func = func;
> +       data.user_data = user_data;
> +
> +       queue_foreach(client->services, client_service_foreach, &data);
> +}
> diff --git a/src/gatt-client.h b/src/gatt-client.h
> index f6da3b0..a18db17 100644
> --- a/src/gatt-client.h
> +++ b/src/gatt-client.h
> @@ -28,3 +28,9 @@ void btd_gatt_client_service_added(struct btd_gatt_client *client,
>  void btd_gatt_client_service_removed(struct btd_gatt_client *client,
>                                         struct gatt_db_attribute *attrib);
>  void btd_gatt_client_disconnected(struct btd_gatt_client *client);
> +
> +typedef void (*btd_gatt_client_service_path_t)(const char *service_path,
> +                                                       void *user_data);
> +void btd_gatt_client_foreach_service(struct btd_gatt_client *client,
> +                                       btd_gatt_client_service_path_t func,
> +                                       void *user_data);
> --
> 2.2.0.rc0.207.ga3a616c
>

Both patches in this set have been pushed.

Thanks,
Arman

      parent reply	other threads:[~2015-05-06 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 22:05 [PATCH BlueZ 1/2] core/gatt: Add btd_gatt_client_foreach_service Arman Uguray
2015-05-05 22:05 ` [PATCH BlueZ 2/2] core/device: Implement GattServices property Arman Uguray
2015-05-07  8:04   ` Luiz Augusto von Dentz
2015-05-06 20:50 ` Arman Uguray [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='CAHrH25SPqUBGQbLXjB7-+wd37=mo4Zhh_Jthx2YfL_HvLf-NJQ@mail.gmail.com' \
    --to=armansito@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ortuno@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.